Skip to content

Instantly share code, notes, and snippets.

@jacobsimeon
Last active September 28, 2015 13:37
Show Gist options
  • Save jacobsimeon/1446056 to your computer and use it in GitHub Desktop.
Save jacobsimeon/1446056 to your computer and use it in GitHub Desktop.
My bash profile.
alias rr='touch tmp/restart.txt'
alias apache_logs='cd /private/var/log/apache2/'
alias vhosts='vim /private/etc/apache2/users/jacob.conf'
alias hosts='vim /etc/hosts'
alias profile='vim ~/.bash_profile'
alias apache='sudo apachectl'
alias mongo_start='mongod run --config /usr/local/Cellar/mongodb/1.6.3-x86_64/mongod.conf'
alias cleardns='dscacheutil -flushcache'
alias grma='git ls-files --deleted -z | xargs -0 git rm'
alias cleanswap='find . | grep .swp | xargs rm'
#colors
cn=`tput sgr0` #'normal' color
cr=`tput setaf 1` #red
cg=`tput setaf 2` #green
cy=`tput setaf 3` #yellow
cb=`tput setaf 4` #blue
cm=`tput setaf 5` #magenta
cc=`tput setaf 6` #cyan
cw=`tput setaf 7` #white
#custom prompt config
parse_git_branch() {
export branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'`
if [ -z "$branch" ]
then
branch="none"
fi
echo -ne $branch | sed -e " "
}
branch_color ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
color=""
if git diff --quiet 2>/dev/null >&2
then
color="${cg}"
else
color=${cr}
fi
else
color=${cn}
fi
echo -ne $color
}
ruby_v(){
export v=$(~/.rvm/bin/rvm-prompt v g)
if [ -z "$v" ]
then
v="system"
fi
echo -ne $v
}
export CLICOLOR=1
export EDITOR=vim
export VISUAL=vim
export AWS_ACCESS_KEY_ID="AKIAJKPFGH2AUIPD3EYQ"
export AWS_SECRET_ACCESS_KEY="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"
export PATH="/usr/local/lib/node_modules:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin"
PS1='\n${cc}\w${cn}\n${cb}\u ${cm}$(ruby_v)\] $(branch_color)\]$(parse_git_branch)\]${cn}\n\$ '
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment