Skip to content

Instantly share code, notes, and snippets.

@grahaml
Last active August 29, 2015 14:07
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 grahaml/5196b7f01ed96c48fe60 to your computer and use it in GitHub Desktop.
Save grahaml/5196b7f01ed96c48fe60 to your computer and use it in GitHub Desktop.
My .bash_profile from the ol' office with a couple of neat things in it
# =======
# Aliases
# =======
alias ios='open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
alias refresh='source ~/.bash_profile'
alias refreshhosts='dscacheutil -flushcache'
alias ipaddr="ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'"
alias copypath="pwd | pbcopy"
# =========================================
# Shortcuts to commonly edited system files
# aka the 'me' series
#==========================================
alias bashme='subl ~/.bash_profile'
alias hostsme='subl /etc/hosts'
alias gitme='subl ~/.gitconfig'
# =======
# Exports
# =======
export PATH=/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin:~/local/bin:$PATH
export PATH=/usr/local/share/python:$PATH
export EDITOR=vim
# See your current Git branch in prompt when you're inside a git repository
# Thanks to whomever I borrowed this from. Sadly, I can't recall the source.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \w\[\033[32m\]\$(parse_git_branch)\[\033[00m\] 👺 : "
# Replace above line with correct emoji
# export PS1="\w 👺 : "
# Increase ulimit to not get the dreaded EMFILE error in node
ulimit -S -n 2048
# Run the git-completion script if it exists
# This allows you to use the tab key to autocomplete git branch names and methods
# Thanks http://code-worrier.com/blog/autocomplete-git/
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment