Created
April 19, 2012 16:38
-
-
Save gabrielfalcao/2422194 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
# <bash_profile - for mac> | |
# Copyright (C) <2011> Gabriel Falcão <[email protected]> | |
# | |
# Permission is hereby granted, free of charge, to any person | |
# obtaining a copy of this software and associated documentation | |
# files (the "Software"), to deal in the Software without | |
# restriction, including without limitation the rights to use, | |
# copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the | |
# Software is furnished to do so, subject to the following | |
# conditions: | |
# | |
# The above copyright notice and this permission notice shall be | |
# included in all copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | |
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
# OTHER DEALINGS IN THE SOFTWARE. | |
export TERM="xterm-color" | |
export PATH=/usr/local/bin:/usr/local/share/python:$PATH:/usr/local/sbin:$HOME/usr/bin:/usr/local/Cellar/php/5.3.5/bin:node_modules/.bin | |
export BASH_COMPLETION_PATH=$HOME/usr/bash_completion.d | |
if [ -f `brew --prefix`/etc/bash_completion ]; then | |
. `brew --prefix`/etc/bash_completion | |
fi | |
for completion in `ls $BASH_COMPLETION_PATH` | |
do | |
. $BASH_COMPLETION_PATH/$completion | |
done | |
source /usr/local/Cellar/coreutils/8.12/aliases | |
export YIPIT_PATH=$HOME/projects/work/yipit | |
source ${YIPIT_PATH}/conf/yipit_bash_profile | |
alias ls="ls -G" | |
alias egrep="egrep --colour" | |
alias grep="egrep --colour" | |
alias nose="nosetests --verbosity=2 -s" | |
alias gvim="/Applications/MacVim.app/Contents/MacOS/Vim -g" | |
mydump () { | |
mysqldump --add-drop-table --compact --quick -u root -B $1 | |
} | |
export HISTFILESIZE=3000 | |
export HISTCONTROL=ignoredups | |
alias hist='history | grep $1' | |
export NODE_PATH=/usr/local/lib/node:/usr/local/lib/node_modules | |
export GITHUB_USER=gabrielfalcao | |
export GITHUB_TOKEN=86ea6872ac3c551d40f641cc9543725c | |
harvest () { | |
simplekill "chrome" | |
SETTINGS=`test -f test_settings.py && echo test_settings || echo setings` | |
python manage.py harvest $@ --settings=$SETTINGS | |
simplekill "chrome" | |
} | |
unit () { | |
python manage.py test unit | |
} | |
func () { | |
python manage.py test functional | |
} | |
intg () { | |
python manage.py test integration | |
} | |
fast_runserver () { | |
if [ ! -z $1 ]; then | |
port=$1 | |
else | |
port=7000 | |
fi; | |
gunicorn_django --debug --preload -b 0.0.0.0:$port --keep-alive=30 -w 4 | |
} | |
runserver () { | |
reset; | |
if [ ! -z $1 ]; then | |
port=$1 | |
else | |
port=7000 | |
fi; | |
if [ -e test_settings.py ]; then | |
python manage.py runserver 0:$port --settings=test_settings | |
else | |
python manage.py runserver 0:$port | |
fi; | |
reset; | |
} | |
stripstring () { | |
sed 's/^[ ]*//g' | sed 's/[ ]*$//g' | |
} | |
gitroot () { | |
git rev-parse --git-dir | sed 's/\.git$//g' | stripstring | |
} | |
cwgd () { | |
# if [ `wc -c $(gitroot)` > 0 ]; then | |
# basename $(gitroot) | |
# fi; | |
printf "" | |
} | |
total_of_commits () { | |
git log --oneline | wc -l | awk '{ print $1 }' | |
} | |
branch_name () { | |
git status | head -1 | sed 's/[#] On branch //g' | |
} | |
gitps1 () { | |
(git branch 2>&1 > /dev/null) 2>&1 > /dev/null | |
if [ $? == 0 ] && [ $(basename `pwd`) != '.git' ]; then | |
printf "$USER\033[1;37m\033[1;33m\033[1;37m@\033[1;33m$(cwgd)$(branch_name)\033[1;37m" | |
else | |
printf "$USER@$(hostname | sed 's,[.].*,,g')" | |
fi | |
} | |
PS1='\[\033[01;32m\]$(gitps1)\[\033[01;34m\] \w $(printf "\xe2\x99\xac\x0a") \[\033[00m\]' | |
#source $HOME/.gitps1 | |
export WORKON_HOME=$HOME/.virtualenvs | |
source `which virtualenvwrapper.sh` | |
get_put_io_links () { | |
if [ -z $1 ]; then | |
url=http://www.fgsexy.com/blog/ | |
else | |
url=$1 | |
fi; | |
curl -s $url | egrep 'http[:][/][/][^ ]*(hotfile|fileserve|rapidshare|megaupload|mediafire|uploaded|netload)[^ ]*' | sed 's,.*href=",,g' | sed 's," .*,,g' | |
} | |
_work () { | |
_hack_on $1 "Work" | |
simplekill "chrome" | |
if [ -e scripts/qa-helpers ]; then | |
source scripts/qa-helpers | |
fi; | |
if [ -e scripts/git-helpers ]; then | |
source scripts/git-helpers | |
fi; | |
} | |
_hack () { | |
_hack_on $1 "Projetos" | |
} | |
_hack_on () { | |
kind=$2; | |
name=$1; | |
fullpath=$HOME/$kind/$name; | |
possible_virtualenv=$HOME/.virtualenvs/$name; | |
if [ ! -e $fullpath ]; then | |
echo "no such folder: $fullpath"; | |
exit 1; | |
fi; | |
# python stuff | |
if [ -e $possible_virtualenv ]; then | |
workon $1; | |
fi; | |
pushd $fullpath; | |
} | |
shell () { | |
if [ -e test_settings.py ]; then | |
python manage.py shell --settings=test_settings | |
else | |
python manage.py shell | |
fi; | |
} | |
simplekill () { | |
(sudo kill -9 `sudo ps aux | egrep -i $1 | egrep -v "(grep)" | awk '{ print $2 }'` 2>&1 > /dev/null) 2>&1 > /dev/null | |
} | |
alias gpaste='pbpaste | gist -p | xargs open' | |
goto () { | |
place=$1 | |
project=$2 | |
base_path="$HOME/projects/$place" | |
optimal_path="$base_path/$project" | |
alias optimal_path_exists="test -e $optimal_path" | |
if [ ! `optimal_path_exists` ]; then | |
mkdir -p $optimal_path | |
fi; | |
pushd $optimal_path | |
} | |
w () { goto work $*; } | |
p () { goto personal $*; } | |
third_party () { goto 3rdparty $*; } | |
#b () { cd $HOME/book;make; } | |
#b () { | |
# cmd=`history | sed 's,^[ ]*[0-9]*[ ]*,,g' | egrep '^\w+'` | |
# $cmd | |
#} | |
alias 3=third_party | |
_complete_projects_for () { | |
local cur opts | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
opts=`ls $HOME/projects/$1/` | |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | |
return 0 | |
} | |
_complete_projects_for_work () { | |
_complete_projects_for work | |
return $? | |
} | |
_complete_personal_projects () { | |
_complete_projects_for personal | |
return $? | |
} | |
_complete_3rdparty_projects () { | |
_complete_projects_for 3rdparty | |
return $? | |
} | |
complete -F _complete_projects_for_work w | |
complete -F _complete_personal_projects p | |
complete -F _complete_3rdparty_projects 3 | |
_complete_jake () { | |
local cur opts | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
opts=`jake -T | sed 's,^[^m]*m\([a-zA-Z0-9]*\).*,\1,g' | awk '{ print $1 }' | xargs` | |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | |
return 0 | |
} | |
complete -F _complete_jake jake | |
_complete_brew () { | |
local cur opts | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
opts=`ls /usr/local/Library/Formula/ | sed 's,[.]rb,,g'` | |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | |
return 0 | |
} | |
complete -F _complete_brew brew install | |
export PYTHONPATH=$PYTHONPATH:$HOME/Projetos/sure/:$HOME/Projetos/djangounclebob/:$HOME/Projetos/lettuce/:$HOME/Projetos/HTTPretty | |
erase_all() { | |
rm -rf `find . -name "$1"` | |
} | |
PIP_DOWNLOAD_CACHE=$HOME/usr/pipcache | |
# Ruby Version Manager | |
[[ -s "/Users/gabrielfalcao/.rvm/scripts/rvm" ]] && source "/Users/gabrielfalcao/.rvm/scripts/rvm" # This loads RVM into a shell session. | |
# Node.js Version Manager | |
[[ -s "/Users/gabrielfalcao/.nvm/nvm.sh" ]] && source "/Users/gabrielfalcao/.nvm/nvm.sh" # This loads NVM into a shell session. | |
takeoff () { | |
deactivate | |
popd | |
} | |
rm -f $HOME/Library/Preferences/com.apple.recentitems.plist | |
alias git=hub | |
clear_redis() { | |
for key in `echo 'keys *' | redis-cli --raw `; do | |
echo "DEL '$key'" | redis-cli --raw; | |
done | |
} | |
export PYTHONDONTWRITEBYTECODE=x | |
export CI_SERVER_NAME=`hostname` | |
export EDITOR=emacs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment