Last active
December 11, 2015 18:51
-
-
Save rossnelson/76c5202c19be02386c26 to your computer and use it in GitHub Desktop.
How my dotfiles are setup
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
| # Just includes the others | |
| source $HOME/.profile | |
| source $HOME/.bashrc |
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
| # Only contains aliases and funtions | |
| function substitute { | |
| if [ -z "$1" -o -z "$2" ]; then | |
| echo "Usage: substitue FROM_STRING TO_STRING [OPTION]..." | |
| echo | |
| echo "Replace all occurances of FROM_STRING (a sed-compatible regular" | |
| echo "expression) with TO_STRING in all files for which ack-grep matches" | |
| echo "FROM_STRING." | |
| echo | |
| echo "Any additional options are passed directly to ack-grep (e.g.," | |
| echo " --type=html would only run the substitution on html files)." | |
| return 1 | |
| fi | |
| # Escape forward slashes for sed | |
| FROM_STRING=${1/\//\\/} | |
| TO_STRING=${2/\//\\/} | |
| shift 2 | |
| grep -rl "$@" "$FROM_STRING" ./ | xargs perl -pi -E "s/$FROM_STRING/$TO_STRING/g" | |
| } | |
| function dif_stuff { | |
| diff -r $1/$3 $2/$3 | vim -R - | |
| } | |
| function pg_pull { | |
| if [ -z "$1" -o -z "$2" ]; then | |
| echo "Usage: pg_pull REMOTE_USER@REMOTE_HOST REMOTE_DB LOCAL_DB" | |
| echo | |
| echo "Pull a postgres database from a remote server down to " | |
| echo "your local instance" | |
| echo | |
| return 1 | |
| fi | |
| REMOTE=$1 | |
| REMOTE_DB=$2 | |
| LOCAL_DB=$3 | |
| ssh $REMOTE "pg_dump $REMOTE_DB --clean" | psql -d $LOCAL_DB | |
| } | |
| export vim="/usr/local/bin/vim" | |
| export TERM="xterm-256color" | |
| export BUNDLER_EDITOR=$vim | |
| export EDITOR=vim | |
| export VISUAL=vim | |
| export GIT_EDITOR="$vim -f" | |
| alias vim=$vim | |
| alias pg.start='postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log' | |
| # Rails | |
| alias rg='rails generate' | |
| alias rc='rails console' | |
| alias plog='touch log/production.log && tail -f log/production.log' | |
| alias dlog='touch log/development.log && tail -f log/development.log' | |
| alias tlog='touch log/test.log && tail -f log/test.log' | |
| # Git | |
| alias ga='git add' | |
| alias gau='git add -u' | |
| alias gai='git add --interactive' | |
| alias gap='git add --patch' | |
| alias gba='git branch -a' | |
| alias gbd='git branch -d' | |
| alias gbr='git branch' | |
| alias gcb='git checkout -b' | |
| alias gca='git commit -a -v' | |
| alias gci='git commit -v' | |
| alias gco='git checkout' | |
| alias gdf='git diff' | |
| alias gfh='git fetch' | |
| alias glg='git log' | |
| alias gmg='git merge' | |
| alias gpl='git pull' | |
| alias gpr='git pull --rebase' | |
| alias gph='git push' | |
| alias grb='git rebase' | |
| alias grm='git rm' | |
| alias gsa='git stash apply' | |
| alias gsd='git stash drop' | |
| alias gsh='git stash' | |
| alias gsl='git stash list' | |
| alias gsp='git stash pop' | |
| alias gst='git status' | |
| alias gsu='git submodule update --init' | |
| alias sag="sudo apachectl graceful" |
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
| # Used only for exoprts and assigning PATH var | |
| # NPM | |
| export PATH=/usr/local/share/npm/bin:$PATH | |
| # Homebrew | |
| export PATH=$HOME/.bin:/usr/local/bin:/usr/local/sbin:$PATH | |
| # Heroku Toolbelt | |
| export PATH="/usr/local/heroku/bin:$PATH" | |
| # RVM | |
| export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting | |
| [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* |
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
| # Path to your oh-my-zsh configuration. | |
| ZSH=$HOME/.oh-my-zsh | |
| ZSH_THEME="wuffers" | |
| export LC_ALL="en_US.UTF-8" | |
| source $ZSH/oh-my-zsh.sh | |
| source $HOME/.bash_profile | |
| export PATH="$PATH:$HOME/code/scripts/_bin" # add custom scripts to PATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment