Skip to content

Instantly share code, notes, and snippets.

@s-petit
Created July 10, 2018 12:38
Show Gist options
  • Select an option

  • Save s-petit/f8a4f69fa4b7fe801e1b38ce81cc5749 to your computer and use it in GitHub Desktop.

Select an option

Save s-petit/f8a4f69fa4b7fe801e1b38ce81cc5749 to your computer and use it in GitHub Desktop.
Useful aliases
JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
alias mci='mvn clean install -DskipTests'
alias mcp='mvn clean package -DskipTests'
alias jacoco='mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent verify org.jacoco:jacoco-maven-plugin:report'
alias zshconfig='subl ~/.zshrc'
alias j='fasd_cd -d'
alias netgrep='netstat -planet | grep $*'
alias dk='docker'
#git display current branch
alias ggb='git branch | grep \* | cut -d " " -f2-'
# git cleanup branches with remote gone
alias gcln='git fetch -p && for branch in `git branch -vv | grep '"'"': gone]'"'"' | awk '"'"'{print $1}'"'"'`; do git branch -D $branch; done'
# git update branch and return to current branch
function gub() {
CURRENT_BRANCH=$(ggb)
gco "$1"
g pr;
gco $CURRENT_BRANCH
}
function netkill() {
PID=$(lsof -i :$1 -t)
if [ -z "$PID" ]
then
echo "This port is not used. Exiting..."
else
echo "Killing pid $PID"
kill -9 $PID
fi
}
function jdk() {
JDK_VERSION=$1
if [ "$JDK_VERSION" -eq "8" ]
then
sudo update-java-alternatives --set "$JDK8_PATH"
export JAVA_HOME=$JDK8_PATH
elif [ "$JDK_VERSION" -eq "10" ]
then
sudo update-java-alternatives --set "$JDK10_PATH"
export JAVA_HOME=$JDK10_PATH
else
echo "You have to specify a valid JDK version"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment