Skip to content

Instantly share code, notes, and snippets.

@EJTH
Last active October 17, 2019 18:41
Show Gist options
  • Save EJTH/cc1bd730c0a6ebe0b3eb213a97c6efc9 to your computer and use it in GitHub Desktop.
Save EJTH/cc1bd730c0a6ebe0b3eb213a97c6efc9 to your computer and use it in GitHub Desktop.
# Śhow git branch in prompt.
gb() {
echo -n '(' && git branch 2>/dev/null | grep '^*' | colrm 1 2 | tr -d '\n' && echo -n ')'
}
git_branch() {
gb | sed 's/()//'
}
#dir(branch)$
PS1="\[\e[01;36m\]\w\[\e[33m\]\$(git_branch)\[\e[01;32m\]\\$\[\e[m\] "
# jq alternative if python is present.
alias prettyjson='python -m json.tool'
# That copy to clipboard command you always forget.
alias copy='xsel -ib'
# That crude HTML stripping tool that you should probably never use.
alias html2txt='sed "s/<[^>]\+>//g"'
# Random cowsay
alias randcow='cowsay -f `ls /usr/share/cowsay/cows/ |sort -R |tail -n1`'
# List all cows
alias cowlist='cowsay -l | tail -n +2 | tr "\n" " " | xargs -d" " -I{} cowsay -f {} {} | less'
# Holycow!
alias holycow='curl -s http://labs.bible.org/api/?passage=random | html2txt | cowsay'
# myip.com
alias myip='curl -s https://api.myip.com | jq -r .ip'
# Show git authors by commit count
alias git-author-commits='git log --format="%an" | sort | uniq -c'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment