Created
August 9, 2010 17:42
-
-
Save aviflombaum/515770 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
function superprompt { | |
local RED="\[\033[0;31m\]" | |
local LIGHT_RED="\[\033[1;31m\]" | |
export PS1="\[\e]2;\u@\h\a[\[\e[37;44;1m\]\t\[\e[0m\]]$RED\$(parse_git_branch) \[\e[32m\]\W\[\e[0m\] \$ " | |
PS2='> ' | |
PS4='+ ' | |
} | |
superprompt | |
export JAVA_HOME="/usr" | |
export EVENT_NOKQUEUE=1 | |
export VISUAL="mate -w" | |
export SVN_EDITOR="mate -w" | |
export GIT_EDITOR="mate -w" | |
export EDITOR="mate -w" | |
export EC2_HOME="/Users/avi/.ec2" | |
export EC2_PRIVATE_KEY="/Users/avi/.ec2/pk-UGSXAMQ752UUNWCAYLARZS6AL2GBVGL3.pem" | |
export EC2_CERT="/Users/avi/.ec2/cert-UGSXAMQ752UUNWCAYLARZS6AL2GBVGL3.pem" | |
export PATH="/usr/local:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/local/mysql/bin:/opt/local:/opt/local/bin:$EC2_HOME/bin:/Users/avi/Development/jruby-1.5.1/bin:$PATH" | |
# Aliases | |
# Iterm Rails Project | |
alias s="iterm_rails_project.sh $1" | |
# Subversion | |
alias sup="svn update" | |
alias sst="svn status" | |
alias scom="svn commit" | |
alias sd="svn diff | mate" | |
alias slog="svn log | mate" | |
alias sex="svn export" | |
alias sad="svn add " | |
alias srm="svn remove " | |
alias sad="svn add " | |
alias sadd='svn status | grep "^\?" | awk "{print $2}" | xargs svn add' #adds all new files to svn | |
alias srmm='svn status | grep "\!" | awk "{print $2;}" | xargs svn rm' #removes all missing files from svn | |
# Git | |
alias gst="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" | |
# TextMate | |
alias et="mate . &" | |
alias ett="mate app config lib db public test spec vendor/plugins data features BRANCH &" | |
# Rails | |
alias kl_ruby="killall -9 ruby" | |
alias ss="./script/server" | |
alias sc="./script/console" | |
alias sg="./script/generate" | |
alias sp="./script/plugin" | |
# Ruby | |
alias sgi="sudo gem install " | |
# Memcached | |
alias kl_memcached="killall -9 memcached" | |
# MongoDB | |
alias s_mongo="mongod --fork --dbpath /Users/avi/Development/data/Mongo/db/mongodb --logpath /Users/avi/Development/data/Mongo/db/mongodb.log --logappend" | |
alias kl_mongo="killall -9 mongod" | |
# A Better Rsynched Based SCP | |
alias scrp="rsync --partial --progress --rsh=ssh" | |
# extract anything | |
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 | |
} | |
# teach shell to treat aliases like symbolic links rather than files | |
function cd { | |
if [ ${#1} == 0 ]; then | |
builtin cd | |
elif [[ -d "${1}" || -L "${1}" ]]; then # regular link or directory | |
builtin cd "${1}" | |
elif [ -f "${1}" ]; then # file: is it an alias? | |
# Redirect stderr to dev null to suppress OSA environment errors | |
exec 6>&2 # Link file descriptor 6 with stderr so we can restore stderr later | |
exec 2>/dev/null # stderr replaced by /dev/null | |
path=$(osascript << EOF | |
tell application "Finder" | |
set theItem to (POSIX file "${1}") as alias | |
if the kind of theItem is "alias" then | |
get the posix path of ((original item of theItem) as text) | |
end if | |
end tell | |
EOF | |
) | |
exec 2>&6 6>&- # Restore stderr and close file descriptor #6. | |
if [ "$path" == '' ];then # probably not an alias, but regular file | |
builtin cd "${1}" # will trigger regular shell error about cd to regular file | |
else # is alias, so use the returned path of the alias | |
builtin cd "$path" | |
fi | |
else # should never get here, but just in case. | |
builtin cd "${1}" | |
fi | |
} | |
## | |
# Your previous /Users/avi/.bash_profile file was backed up as /Users/avi/.bash_profile.macports-saved_2009-10-15_at_18:24:53 | |
## | |
# MacPorts Installer addition on 2009-10-15_at_18:24:53: adding an appropriate PATH variable for use with MacPorts. | |
# export PATH=/opt/local/bin:/opt/local/sbin:$PATH | |
# Finished adapting your PATH environment variable for use with MacPorts. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment