Skip to content

Instantly share code, notes, and snippets.

@yspreen
Last active November 11, 2019 23:21
Show Gist options
  • Save yspreen/283bf42ca62a98dbbcbccd93d1e5ac49 to your computer and use it in GitHub Desktop.
Save yspreen/283bf42ca62a98dbbcbccd93d1e5ac49 to your computer and use it in GitHub Desktop.
Useful bash snippets
alias dockerlogs='docker exec -i -t `docker ps | grep '\''python man'\'' | grep -o '\''^[^ ]*'\''` bash'
alias gitrmbranches='git branch --merged | grep -v \* | xargs git branch -D'
git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -d
alias random_pw='LC_ALL=C tr -dc "A-Za-z0-9-_" </dev/urandom | head -c 20 ; echo'
alias kraken='LC_CTYPE=C open -na GitKraken --args -p "$(git rev-parse --show-toplevel)"'
alias wifion='networksetup -setnetworkserviceenabled Wi-Fi on'
alias wifioff='networksetup -setnetworkserviceenabled Wi-Fi off'
function list_all() {
emulate -L zsh
[ -f .pyenv/bin/activate ] && source .pyenv/bin/activate
}
chpwd_functions=(${chpwd_functions[@]} "list_all")
random-string()
{
cat /dev/urandom | base64 | sed 's/\//_/' | fold -w ${1:-32} | head -n 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment