Skip to content

Instantly share code, notes, and snippets.

  • count the difference between two branch commits
git rev-list --count master..origin/master
@basbs
basbs / tr-cheatsheet.md
Created November 13, 2023 23:03
tr magic

To remove new line and escape quotes from the given file

tr -d '\n' < input.txt | tr '"' '\\"' > output.txt
  • Refresh the dependencies gradle clean build --refresh-dependencies
Maven Scope Maven Dependency Declaration Gradle Configuration Gradle Dependency Declaration
compile <scope>compile</scope> implementation implementation 'groupId:artifactId:version'
provided <scope>provided</scope> compileOnly compileOnly 'groupId:artifactId:version'
runtime <scope>runtime</scope> runtimeOnly runtimeOnly 'groupId:artifactId:version'
test <scope>test</scope> testImplementation testImplementation 'groupId:artifactId:version'
te
@basbs
basbs / jdk-jre-docker-image.md
Created June 23, 2023 08:05
JDK or JRE base images for building java apps docker image
@basbs
basbs / apt-to-apk-mapping.md
Last active June 23, 2023 08:03
Debian apt to Alpine apk
@basbs
basbs / yaml-guide.md
Created June 8, 2023 12:45
Stupid yaml guide.

Stupid Yaml Guide

Some Rules to remember

  • YAML files use a .yml or .yaml extension.
  • YAML is also a superset of JSON, so JSON files are valid in YAML.
  • There are no usual format symbols, such as braces, square brackets, closing tags, or quotation marks.
  • Tab characters are not allowed by design, to maintain portability across systems, so whitespace literal space characters are used instead.

Syntax

@basbs
basbs / here_document_usage
Last active August 25, 2021 12:35
Here-Document Usage #BASH
Use-Case 1:
Creating a file without the help of touch or any text editor
$cat << EOF >> file_name
line-1 contains the plain text
line-2 contains Arithmetic expansion $(( 2 + 3))
line-3 contains Parameter expansion $SHELL
line-4 contains Command substitution $(echo "Hi, There")
EOF
Output:
@basbs
basbs / screen_cheatsheet.markdown
Last active August 25, 2021 13:13 — forked from jctosta/screen_cheatsheet.markdown
Screen Cheatsheet

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r
@basbs
basbs / ClassLoaderLeakExample.java
Created June 12, 2020 10:29 — forked from dpryden/ClassLoaderLeakExample.java
Example of a ClassLoader leak in Java
import java.io.IOException;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
/**
* Example demonstrating a ClassLoader leak.
*
* <p>To see it in action, copy this file to a temp directory somewhere,