Skip to content

Instantly share code, notes, and snippets.

@pdemanget
Last active June 26, 2023 09:34
Show Gist options
  • Save pdemanget/d04c945f08fc1612b8caee7d5af3ab4a to your computer and use it in GitHub Desktop.
Save pdemanget/d04c945f08fc1612b8caee7d5af3ab4a to your computer and use it in GitHub Desktop.
Bashrc prompt for git
#0. Only aliases, one per line
#1. warning this file is auto-sorted, no script here!
alias ale="vim ~/.bash_aliases && sort -o ~/.bash_aliases ~/.bash_aliases && source ~/.bash_aliases"
alias dc="docker-compose"
alias dcp="docker-compose -f postgres-docker-compose.yml "
alias dcs="docker-compose -f sqlserver-docker-compose.yml "
alias doc-passif="start /home/philippe/Documents/htoh/amadeus/passif/"
alias drive-ext="sshfs -o ssh_command='ssh -4 -p 443' [email protected]:/volume1/public/htoh/ ~/Documents/htoh-drive"
alias drive="sshfs fil@syno:/volume1/public/htoh/ ~/Documents/htoh-drive"
alias g="git"
alias giot="git"
alias gk="gitk --all&"
alias got="git"
alias gpsup='git push --set-upstream origin $(git_current_branch)'
alias gt="git"
alias gut="git"
alias j17="/usr/lib/jvm/java-17-adoptopenjdk/bin/java"
alias jast="archlinux-java status"
alias jh11="export JAVA_HOME=/usr/lib/jvm/java-11-openjdk"
alias jh17="export JAVA_HOME=/usr/lib/jvm/java-17-adoptopenjdk"
alias ll="lsd -l"
alias m11="JAVA_HOME=/usr/lib/jvm/java-11-openjdk/ mvn"
alias m17="JAVA_HOME=/usr/lib/jvm/java-17-adoptopenjdk/ mvn"
alias m8="JAVA_HOME=/usr/lib/jvm/java-8-adoptopenjdk/ mvn"
alias mi="mvn clean install "
alias mini="mvn clean install -Dmaven.test.skip=true"
alias min="mvn install -DskipTests"
alias morning="cd ~/project && git bulk fetch && ./tabs.sh && cd htoh-api && dc up -d "
alias morning-live="cd ~/project && git bulk fetch && ./tabs.sh && cd htoh-api && dc up -d && ../apps.sh"
alias mrs="./manage.py runserver_plus"
alias msrd='mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,address=9000,server=y,suspend=n"'
alias msr='mvn spring-boot:run '
alias mta="mvn -Dtest=HtohApiApplicationTests test"
alias mth="mvn -Dtest=TraxoMapperTest test"
alias mtm="mvn -Dtest=TripRepositoryTest#findAlice test"
alias mtp="mvn -Dtest=io.htoh.api.traveler test"
alias mts="mvn -Dtest=TripServiceImplTest test"
alias path="echo \$PATH | sed 's/:/\n/'g "
alias pe="pipenv shell"
alias pkg-list-files="pacman -Ql"
alias pkg-list-installed="pacman -Qe"
alias psqlh="docker exec -it postgres_htoh /usr/bin/psql -U htoh "
alias psqln="docker exec -it webapp-demo-db-1 /usr/local/bin/psql -d db -U npe "
alias pu="pipenv sync -d"
alias r5="rsync -avz htoh-drive/ htoh"
alias r6="rsync -avz htoh/ htoh-drive/ --no-o --no-g"
alias run='[ -f "pom.xml" ] && mvn spring-boot:run ; [ -f "package.json" ] && npm run serve'
alias rwfs="mount -o remount,rw /"
alias start="xdg-open"
alias st="git st"
alias tid="tidy -q --custom-tags blocklevel -i index.html > out.html"
alias to_hex="hexdump -ve '1/1 \"%.2x\"' && echo"
alias treesize="ncdu"
alias vf="cd"
alias vi="vim"
alias ws="python -m http.server 8000"
export PATH=$PATH:~/private/git-bulk
gp2() { echo "git clone [email protected]:pdemanget/$1 "; }
gp() { git "clone [email protected]:pdemanget/$1"; }
mite() { mvn test -Dtest=$1 ;}
shopt -s expand_aliases
ts() { date -d @$1; }
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function parse_git_status {
noupdated=`git status --porcelain 2> /dev/null | grep -E "^ (M|D)" | wc -l`
nocommitted=`git status --porcelain 2> /dev/null | grep -E "^(M|A|D|R|C)" | wc -l`
if [[ $noupdated -gt 0 ]]; then echo -n "*"; fi
if [[ $nocommitted -gt 0 ]]; then echo -n "+"; fi
}
RED="\[\033[01;31m\]"
YELLOW="\[\033[01;33m\]"
GREEN="\[\033[01;32m\]"
BLUE="\[\033[01;34m\]"
NC="\[\033[0m\]"
case $TERM in
xterm*)
TITLEBAR='\[\e]0;\u@\h: \w\a\]';
;;
*)
TITLEBAR="";
;;
esac
PS1="${TITLEBAR}$RED\$(date +%H:%M) $GREEN\u@\h $BLUE\w$YELLOW\$(parse_git_branch)\$(parse_git_status) \n$BLUE\$ $NC"
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
if [ -f ~/.bash_prompt ]; then
. ~/.bash_prompt
fi
if [ -f ~/.bash_env ]; then
. ~/.bash_env
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment