Skip to content

Instantly share code, notes, and snippets.

@spuder
Last active April 12, 2018 13:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spuder/11360447 to your computer and use it in GitHub Desktop.
Save spuder/11360447 to your computer and use it in GitHub Desktop.
.bash_profile
# MANAGED VIA GIT https://gist.github.com/spuder/11360474
# CHANGES MAY BE OVERWRITTEN
# Import the bash_ps1, adds dotted lines after every command
if [ -f "$HOME/.bash_ps1" ]; then
. "$HOME/.bash_ps1"
fi
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
alias vkill='vagrant destroy -f'
alias vreload='vagrant destroy -f && vagrant up'
alias ll='ls -alFG'
alias ls='ls -G'
alias sl='ls -G'
alias up='cd ..'
alias redo='sudo \!-1'
alias sdou='sudo'
alias suod='sudo'
alias sodu='sudo'
alias tailf='tail -f'
alias ppv='puppet parser validate'
alias ppl='puppet lint --no-80chars-check'
# Remove old openstack image keys
alias skr='ssh-keygen -R'
# ssh to openstack images
function vapor() {
ssh 10.2.192.$1
}
export -f vapor
function vapor2() {
ssh 10.2.184.$1
}
export -f vapor2
alias gzip="gzip -9n" # set strongest compression level as ‘default’ for gzip
alias preview='groff -Tps > /tmp/tmp.ps && open -a Preview /tmp/tmp.ps'
alias bashupdate='curl -L https://gist.github.com/spuder/11360474/raw/ | bash'
alias sshupdate='curl -L https://gist.github.com/spuder/7c290f8c4baf5ee9c9f2/raw/ > ~/.ssh/config'
# Get readable list of network IPs
alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"
alias myip="dig +short myip.opendns.com @resolver1.opendns.com"
alias flush="dscacheutil -flushcache" # Flush DNS cache
alias show_hidden="defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder"
alias hide_hidden="defaults write com.apple.finder AppleShowAllFiles FALSE && killall Finder"
# Alias for "." shows current directory
alias -- .='pwd'
# Alias for ".." goes to parent directory
alias -- ..="cd .."
alias -- ...="cd .. ; cd .."
alias -- ....="cd .. ; cd .. ; cd .."
## Docker
alias d='docker'
dci() {
docker rmi $(docker images --no-trunc | awk '$2 == "<none>" {print $3}')
}
dcc() {
docker rm $(docker ps -a --no-trunc | awk '$5 == "Exit" {print $1}')
}
alias dockerclean="dcc; dci"
#http://blog.stefanxo.com/2014/02/clean-up-after-docker/
# Mac needs to know where boot2docker is running
export DOCKER_HOST=tcp://192.168.59.103:2375
alias heartbleed="docker run --rm spuder/heartbleed"
# Open man page in Sublime Text
sman() {
man "${1}" | col -b | open -f -a /Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text
}
# Quit an OS X application from the command line
quit () {
for app in $*; do
osascript -e 'quit app "'$app'"'
done
}
# Use vim keys to navigate 'info' http://spuder.wordpress.com/2014/03/13/navigate-linux-info-command/
infos () {
info --vi-keys --subnodes -o - "$@" | less;
}
# Create a new directory and enter it
md() { mkdir -p "$@" && cd "$@"; }
# Setup rbenv to work with homebrew
#export RBENV_ROOT=/usr/local/var/rbenv
#if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# Setup RVM to source ~/.profile
source ~/.profile
# http://stackoverflow.com/questions/9336596/rvm-installation-not-working-rvm-is-not-a-function
source ~/.rvm/scripts/rvm
#Add GOPATH http://stackoverflow.com/questions/20628918/cannot-download-gopath-not-set
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
# http://apple.stackexchange.com/questions/5435/got-any-tips-or-tricks-for-terminal-in-mac-os-x/116691#116691
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment