Skip to content

Instantly share code, notes, and snippets.

@ablwr
Last active September 10, 2015 13:11
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 ablwr/71b8bf1beb1166340e3d to your computer and use it in GitHub Desktop.
Save ablwr/71b8bf1beb1166340e3d to your computer and use it in GitHub Desktop.
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
function prompt {
# Define some local colors
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local CHAR="🐚 (╯°□°)╯︵"
export PS1="\[\e]2;\u@\h\a[\[\033[0;39m\]\t\[\e[0m\]]$RED\$(parse_git_branch) \[\e[36m\]\W\[\e[0m\]\n\[\e[0;36m\]$CHAR \[\e[0m\]"
PS2='> '
PS4='+ '
}
prompt
export NODE_PATH="/usr/local/lib/node_modules:$NODE_PATH"
export GIT_MERGE_AUTOEDIT='no'
export VISUAL="subl -w"
export SVN_EDITOR="subl -w"
export GIT_EDITOR="subl -w"
export EDITOR="subl -w"
export USR_PATHS="/usr/local:/usr/local/bin:/usr/local/sbin:/usr/bin"
export PATH="$USR_PATHS:$PATH"
function desktop {
cd /Users/$USER/Desktop/$@
}
function psg {
FIRST=`echo $1 | sed -e 's/^\(.\).*/\1/'`
REST=`echo $1 | sed -e 's/^.\(.*\)/\1/'`
ps aux | grep "[$FIRST]$REST"
}
function lg {
FIRST=`echo $1 | sed -e 's/^\(.\).*/\1/'`
REST=`echo $1 | sed -e 's/^.\(.*\)/\1/'`
ls -la | grep "[$FIRST]$REST"
}
function extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
alias l='ls -lah'
alias gs="git status"
alias gl="git pull"
alias gp="git push"
alias gd="git diff | mate"
alias gc="git commit -v"
alias gca="git commit -v -a"
alias gb="git branch"
alias gba="git branch -a"
alias gcl="git clone"
alias gcb="git checkout -b"
alias gco="git checkout"
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
source $(brew --repository)/Library/Contributions/brew_bash_completion.sh
source ~/.profile
source ~/git-completion.bash
source ~/z.sh
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_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