Skip to content

Instantly share code, notes, and snippets.

@alx
Created August 27, 2009 14:35
Show Gist options
  • Save alx/176331 to your computer and use it in GitHub Desktop.
Save alx/176331 to your computer and use it in GitHub Desktop.
# Bash options
export HISTCONTROL=erasedups
export HISTSIZE=10000
shopt -s histappend
export TERM=linux
# Path
export PATH=/usr/local/bin:/Users/alx/.gem/ruby/1.8/bin:$PATH
export PATH=~/bin:/usr/local/sbin:/opt/local/bin/:/usr/local/git/bin:$PATH
export PATH=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin:$PATH
export PATH=/Users/alx/dev/legodata/forge/legodata-tools/bin:$PATH
# Alias
alias ll='ls -l'
alias s='ssh_connect'
alias mysql-start="sudo /usr/local/mysql/support-files/mysql.server start"
alias mysql-stop="sudo /usr/local/mysql/support-files/mysql.server stop"
alias scpresume="rsync --partial --progress --rsh=ssh"
alias slice_migrate="echo 'DataMapper.auto_migrate!' | slice -i"
alias kill_4000="kill -9 `lsof -i tcp:4000 -Fp| tr -d p`"
export EDITOR=nano
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
# iTerm Tab and Title Customization and prompt customization
# Put the string " [bash] hostname::/full/directory/path"
# in the title bar using the command sequence
# \[\e]2;[bash] \h::\]$PWD\[\a\]
# Put the penultimate and current directory
# in the iterm tab
# \[\e]1;\]$(basename $(dirname $PWD))/\W\[\a\]
# Make a simple command-line prompt: bash-$
PS1=$'\[\e]2;[bash] \h::\]$PWD\[\a\]\[\e]1;\]$(basename "$(dirname "$PWD")")/\W\[\a\]\u@\h \[\033[1;34m\]\w\[\033[0m\]$(parse_git_branch)\$ '
# ImageMagick
export MAGICK_HOME="/usr/local/ImageMagick"
export PATH="$MAGICK_HOME/bin:$PATH"
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib"
# Git alias
alias gb='git branch -a -v'
alias gs='git status'
alias gd='git diff'
alias gp='git push'
alias gita="git-archive --format=zip `git-reflog | grep 'HEAD@{0}' | cut -d \" \" -f1 | sed 's/[.]*//g'` > archive.zip"
# gc => git checkout master
# gc bugs => git checkout bugs
function gc {
if [ -z "$1" ]; then
git checkout master
else
git checkout $1
fi
}
alias gco='git commit -a -m'
# bash _profile editing
alias bashrc='nano ~/.bash_profile && source ~/.bash_profile'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment