Skip to content

Instantly share code, notes, and snippets.

@mgamba
Created October 16, 2014 21:26
Show Gist options
  • Save mgamba/c5c9eb398b8c05052587 to your computer and use it in GitHub Desktop.
Save mgamba/c5c9eb398b8c05052587 to your computer and use it in GitHub Desktop.
.bash_profile
# bash
PS1="\w: "
alias sadface='echo -e " /^^^^^^^\\ \n/ /. .\\ \\ \n| , |\n| D |\n| ___ |\n \\ / \\ / \n \\_____/ "'
alias reload="source ~/.bashrc && echo reloaded bash"
alias sp="reload"
alias dtree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'"
export HISTFILESIZE=3000
alias now="date +'%Y%m%d%H%M%S'"
alias ts="now | tr '\n' '\000' | pbcopy"
alias grep="grep --color=always"
# includes
for script in `ls ~/.bash_includes`; do source ~/.bash_includes/$script; done
# aliases
alias ep="vim ~/.bash_profile && reload"
alias ev="vim ~/.vimrc"
alias be="bundle exec"
alias r="be rspec"
# - shortcuts
alias books="cd ~/Documents/books"
alias home="cd ~"
alias desk="cd ~/Desktop"
alias p="cd ~/Documents/projects"
alias vimbundleslist="ls ~/.vim/bundle"
alias vimbundlesopen="cd ~/.vim/bundle"
# - git
alias gst="git status"
alias rebasemaster="git fetch && git rebase origin/master || sadface"
alias rebaseedge="git fetch && git rebase origin/edge || sadface"
alias eg="vim ~/.gitconfig"
alias gitx="/Applications/GitX.app/Contents/Resources/gitx"
function gittabs() { # open all commit files in vim tabs, given log-like index
vim -p `git files $1`
}
# - rbenv
alias rbenvv="ls ~/.rbenv/versions"
alias rbenvversion="rbenvv"
alias rbenvversions="rbenvv"
alias rbenvu="rbenv local"
alias rbenvuse="rbenvu"
# - util
alias turn_wifi_on="networksetup -setairportpower en1 on"
alias wifi="turn_wifi_on; networksetup -setairportnetwork en1 ## ##"
alias wifi_status="networksetup -getairportnetwork en1 | grep -q ##"
alias babysit_wifi='wifi_status || (wall <<< "Lost Wi-Fi connection, reconnecting ..." && wifi)'
# functions
function a() { #track a
date "+a %H:%M:%S" >> ~/.track
}
function b() { #track b
date "+b %H:%M:%S" >> ~/.track
}
function title() { # change title of window
echo -ne "\033]0;$1\007"
}
alias gtitle="title `gst | grep bra | cut -d' ' -f3`"
function s() { # pad command with two newlines
for i in {0..1}; do echo; done
eval `printf '"%s" ' "$@"; echo "";`
for i in {0..1}; do echo; done
}
function google() {
lynx "http://www.google.com/search?q=$(echo -n $@ | tr ' ' '+')" -accept_all_cookies -anonymous -cookie_file=/dev/null
}
# factory rbenv stuff
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
export RBENV_ROOT=/usr/local/var/rbenv
# PATH="/usr/local/bin:/usr/local/sbin:$PATH"
# export PATH
# alias git="hub"
# if which rbenv > /dev/null; then eval "$(rbenv init - --no-rehash)"; fi
# alias rehash='if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi'
# PATH="$HOME/.rbenv/shims:$PATH"
# export PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment