Created
September 11, 2013 15:27
-
-
Save rafmagana/6525251 to your computer and use it in GitHub Desktop.
My .bash_profile (Mac)
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
| set -o vi | |
| bind -m vi-insert "\C-l":clear-screen | |
| function aliaz | |
| { | |
| if [ -n "$1" ] | |
| then | |
| read COMMAND ALIAS <<<$(IFS="="; echo $1) | |
| if command -v $COMMAND > /dev/null 2>&1 | |
| then | |
| echo "The command or alias '$COMMAND' already exists!" | |
| else | |
| alias $1 | |
| fi | |
| else | |
| alias | |
| fi | |
| } | |
| #general | |
| alias d='dooby' | |
| alias m='mate' | |
| alias g='git' | |
| alias cd..='cd ..' | |
| alias reload="source ~/.bash_profile && echo ~/.bash_profile resourced" | |
| alias vless='vim -u /usr/share/vim/vim73/macros/less.vim' | |
| alias wh='type -a' | |
| alias fail='tail -f' | |
| alias ports_listening="sudo lsof -i -P | grep -i 'listen'" | |
| #maniac things | |
| alias eject='drutil tray eject' | |
| alias matebundles='cd /Users/raf/Library/Application\ Support/TextMate/Bundles' | |
| alias ql='qlmanage -p "$@" >& /dev/null' | |
| alias netstat_osx="sudo lsof -i -P" | |
| alias bitly='bitly -l rafmagana -k KEY_HERE' | |
| alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" | |
| #directory listing | |
| alias ols='ls -C' | |
| alias l='ls -alAGhp' | |
| alias ll='ls -l' | |
| alias lsa='ls -la' | |
| alias lsh='ls -lh' | |
| alias lsah='ls -lah' | |
| alias h='history' | |
| alias j="jobs -l" | |
| alias la='ls -A' | |
| alias doo='cd /Users/raf/projects/_own/ruby/dooby' | |
| alias _='cd -' | |
| alias pg_start='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start' | |
| #git related | |
| alias gs='git status' | |
| alias gss='git status -sb' | |
| alias ga='git add' | |
| alias gb='git branch' | |
| alias gba='git branch -a' | |
| alias gbv='git branch -v' | |
| alias gd='git diff' | |
| alias gdc='git diff --cached' | |
| alias gpl='git pull' | |
| alias gplo='git pull origin' | |
| alias gplom='git pull origin master' | |
| alias gplhm='git pull heroku master' | |
| alias gp='git push' | |
| alias gpo='git push origin' | |
| alias gpom='git push origin master' | |
| alias gph='git push heroku' | |
| alias gphm='git push heroku master' | |
| alias gf='git fetch' | |
| alias gr='git rebase' | |
| alias gch='git checkout $@' | |
| alias gchm='git checkout master' | |
| alias gst='git stash' | |
| alias gsta='git stash apply' | |
| alias gstl='git stash list' | |
| alias gstp='git stash pop' | |
| alias gstc='git stash clear' | |
| alias gvr='git svn rebase' | |
| alias gvf='git svn fetch' | |
| alias gvc='git svn dcommit' | |
| alias gcm='git commit -m' | |
| alias gcam='git commit -a -m' | |
| alias gca='git commit --amend' | |
| alias grh='git reset --hard' | |
| alias gedm='git edit -m' | |
| alias gedc='git edit -c' | |
| alias gedu='git edit -u' | |
| alias gt='git track' | |
| #vagrant | |
| alias vu='vagrant up' | |
| alias vh='vagrant halt' | |
| ##work | |
| alias webroot='cd /Library/WebServer/Documents' | |
| alias instaframe='cd /Users/raf/Arbeit/Instaframe/repo/canvismo' | |
| alias rackmachine='cd /Users/raf/projects/ruby/rack-machine' | |
| alias redis='redis-server /usr/local/etc/redis.conf' | |
| alias bi='bundle install ' | |
| alias be='bundle exec ' | |
| #envylabs | |
| alias envyd='cd /Users/raf/Arbeit/envylabs' | |
| alias envy='cd ~/projects/_own/envy' | |
| #apache related | |
| alias apachedir='cd /Library/WebServer/Documents' | |
| APACHE_CONF='/etc/apache2/httpd.conf' | |
| APACHE_VHOSTS='/private/etc/apache2/extra/httpd-vhosts.conf' | |
| # Personal | |
| alias standup='cd ~/projects/_own/rails/standup' | |
| #files I edit often | |
| alias bashp='mvim ~/.bash_profile' | |
| alias hosts='sudo vim /etc/hosts' | |
| alias v.='mvim .' | |
| # | |
| alias lisp='rlwrap sbcl' | |
| alias clj='rlwrap clj' | |
| ######### | |
| # RAILS # | |
| ######### | |
| alias rorcode='cd ~/projects/_own/ruby/_forks/rails_code' | |
| alias docrails='cd /Users/raf/projects/_own/ruby/_forks/docrails' | |
| alias devlog='> log/development.log && tail -f log/development.log' | |
| alias prodlog='tail -f log/production.log' | |
| alias testlog='tail -f log/test.log' | |
| alias r='rails' | |
| alias rs='rails server' | |
| alias rsd='rails server -u' | |
| alias rc='rails c' | |
| alias rcd='rails c -d' | |
| alias rs30-'rails server -p3000' | |
| alias rs31-'rails server -p3001' | |
| alias rs32-'rails server -p3002' | |
| # database migrate | |
| alias migra='rake db:migrate' | |
| alias tmigra='RAILS_ENV=test rake db:migrate' | |
| ######### | |
| # FUNCS # | |
| ######### | |
| function __git_submodule_stat | |
| { | |
| if [ -d .git ]; then | |
| stat=`git submodule --quiet foreach git ls-files -m | wc -l | tr -d ' '` | |
| if [ $stat -eq 0 ]; then return; fi | |
| echo "["$stat"]" | |
| fi | |
| } | |
| # really awesome function, use: cdgem <gem name>, cd's into your gems directory | |
| # and opens gem that best matches the gem name provided | |
| function cdgem { | |
| cd `gem env gemdir`/gems | |
| cd `ls | awk '{{print $9}}' | tr -d '/' | grep $1 | sort | tail -1` | |
| } | |
| # cdb N (goes back N subdirectories) | |
| function cdb | |
| { | |
| local TIMES=$1 | |
| local INITIAL=1 | |
| local BACK_DIR='../' | |
| local DIRS | |
| if [ $# -eq 0 ]; then | |
| DIRS[0]="${BACK_DIR}" | |
| fi | |
| for ((i=INITIAL;i<=TIMES;i++)); do | |
| DIRS=("${DIRS[@]}" "${BACK_DIR}") | |
| done | |
| cd `printf "%s" "${DIRS[@]}"` | |
| } | |
| #system related | |
| alias hibernateon="sudo pmset -a hibernatemode 5" | |
| alias hibernateoff="sudo pmset -a hibernatemode 0" | |
| ### load all completions | |
| for file in /usr/local/etc/bash_completion.d/* | |
| do | |
| . $file | |
| done | |
| ########## | |
| # PROMPT # | |
| ########## | |
| PS1="`ruby ~/.irb/geek_prompt.rb`" | |
| export MAGICK_HOME="/usr/share/ImageMagick-6.7.5" | |
| export PATH="$MAGICK_HOME/bin:$PATH" | |
| #export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/" | |
| export CLASSPATH=$CLASSPATH:/usr/local/Cellar/clojure-contrib/1.2.0/clojure-contrib.jar | |
| export PATH=/usr/local/bin:$PATH # for psql (postgresql) | |
| export LC_CTYPE='en_US.UTF-8' | |
| export ACKRC='.ackrc' | |
| #export LESS='-i-P?f%f:stdin. ?m(file %i of %m). Line %lb?L/%L(%Pb\%).' | |
| . ~/.nvm/nvm.sh | |
| . ~/projects/_own/bash/heroku_command_line_wrapper_with_app_name/heroku_command_line_wrapper_with_app_name.sh | |
| . ~/projects/_own/ruby/vagrant/scripts/bash_completion.sh | |
| . ~/.tmux_bash_completion.sh | |
| [[ -s "/Users/raf/.rvm/scripts/rvm" ]] && source "/Users/raf/.rvm/scripts/rvm" # This loads RVM into a shell session. | |
| [[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion | |
| ### Added by the Heroku Toolbelt | |
| export PATH="/usr/local/heroku/bin:/usr/local/git/bin:$PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment