Skip to content

Instantly share code, notes, and snippets.

@bhongy
Last active August 29, 2015 13:58
Show Gist options
  • Save bhongy/10313944 to your computer and use it in GitHub Desktop.
Save bhongy/10313944 to your computer and use it in GitHub Desktop.
.bash_profile
source ~/.profile
# === SSH Agent from Atlassian - https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git
SSH_ENV=$HOME/.ssh/environment
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add
}
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
# === End: SSH Agent
# === Add alias sublime to open Sublime Text 2 from Terminal
alias ls='ls -G'
alias lsa='ls -AG'
# List only directories
alias lsd='ls -l | grep "^d"'
# --- Navigation
alias ..='cd ..'
alias proj='cd ~/Projects; ls'
alias desk='cd ~/Desktop; ls'
alias website='cd ~/Projects/website; ls'
# === Launch Server
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
# === Bash Prompt & Color
parse_git_dirty () {
[[ $(git status 2> /dev/null | tail -n1 | cut -c 1-17) != "nothing to commit" ]] && echo "*"
}
parse_git_branch () {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
PS1="\n\[\e[1;37m\][+]\[\e[m\] \[\e[0;36m\]\w\[\e[m\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[\e[0;33m\]\$(parse_git_branch)\[\e[m\]\n\n::: "
export LS_COLORS='di=0;36'
export PATH=/usr/local/bin:$PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment