Skip to content

Instantly share code, notes, and snippets.

@Chayemor
Last active March 18, 2024 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chayemor/1c8aad2d03ccf649eefff905679e627f to your computer and use it in GitHub Desktop.
Save Chayemor/1c8aad2d03ccf649eefff905679e627f to your computer and use it in GitHub Desktop.
Quick .bashrc custom
# ~/.bashrc: executed by bash(1) for non-login shells.
parse_git_branch() {
branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
if [ "$branch" ]; then
if [ -n "$(git status --porcelain)" ]; then
echo -e "\002\033[38;5;121m\002$branch\033[5m🚨\033[25m"
else
echo -e "\001\033[38;5;113m\001$branch🍫"
fi
fi
}
if [ "$color_prompt" = yes ]; then
#PS1='${debian_chroot:+($debian_chroot)\[\033[01;32m\]\u@\h\[\033[00m\]🍪\[\033[01;34m\]\w\033[00m\](parse_git_branch)\[\e[00m\]🧋 '
PS1='\[\033[0m\]\u@\h🍬\033[38;5;147m\w🧋$(parse_git_branch)\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
function f() {
if [ "$1" == "this" ]; then
git commit --amend --no-edit
elif [ "$1" == "me" ]; then
git commit --amend
elif [ "$1" == "it" ]; then
git commit --amend --cleanup whitespace
else
echo "Whatcha trying to do?? Options: this (--amend --no-edit), me (--amend), it(ammend cleanup whitespace)"
fi
}
function gg() {
if [ "$1" == "nuke" ]; then
git add .
f "this"
git push --force
else
echo "Whatcha trying to do?? Options: nuke"
fi
}
alias gtc='git commit'
alias gtp='git push'
alias gtpf='git push --force'
alias gtps='git push --set-upstream origin'
alias gta='git add'
alias gtri='git rebase -i'
alias gtr='git rebase'
alias gtch='git checkout'
alias gtcb='git checkout -b'
alias gtpu='git pull'
alias gtpur='git pull --rebase'
function g() {
if [ "$1" == "wip" ]; then
git commit -m "wip #skip"
git push
else
echo "Whatcha 🤪 trying to do?? It's a one-stop-shop for wip and commit"
fi
}
alias docker-nuke='docker rm $(docker ps -aq) && docker rmi -f $(docker images -q)'
function vpn() {
if [ "$1" == "on" ]; then
nmcli connection up r2o-prod-vpn
elif [ "$1" == "off" ]; then
nmcli connection down r2o-prod-vpn
elif [ "$1" == "what" ]; then
nmcli connection show r2o-prod-vpn
else
echo "on,off,or what? You choose 🍠!"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment