Skip to content

Instantly share code, notes, and snippets.

@fguillen
Last active September 7, 2016 15:11
Show Gist options
  • Save fguillen/8802437 to your computer and use it in GitHub Desktop.
Save fguillen/8802437 to your computer and use it in GitHub Desktop.
Shell helpers
# ~/.aliasesrc
# tree visualization of your actual folder
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
# Making a fast (temporal) commit of all your changes
alias gitfast="git add . && git add -u && git commit -m 'WIP'"
# Pushing to the CI branch
alias gitci="git push -f fguillen HEAD:ci"
# Recursive grep for osx
alias rgrep="find . \( ! -name .svn -o -prune \) -type f -print0 | xargs -0 grep"
# To run a Rails test file
alias rt="ruby -Itest"
# To start the server
alias to="touch tmp/restart.txt"
# ~/.bash_profile
[.. more stuff here ..]
source ~/.aliasesrc
source ~/.ps1rc
# ~/.gemrc
$ cat ~/.gemrc
---
gem: --no-ri --no-rdoc
# ~/.gitconfig
[... more things here...]
[alias]
st = status -s
cl = clone
ci = commit
cm = commit -m
cma = commit -a -m
filelog = log -u
fl = log -u
co = checkout
le = log --oneline --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
ls1 = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
lds = log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph
ls = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
lc = "!f() { git ll "$1"^.."$1"; }; f"
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
lg = log --graph --pretty=format:'%C(red)%h%Creset -%C(green)%d%Creset %s %C(yellow)(%cr) %C(blue)<%an>%Creset' --abbrev-commit
#list all aliases
la = "!git config -l | grep alias | cut -c 7-"
diff = diff --word-diff
d = diff --word-diff
dc = diff --cached
#list modified files in last commit
dl = "!git ll -1"
#diff last commit
dlc = diff --cached HEAD^
dr = "!f() { git diff -w "$1"^.."$1"; }; f"
diffr = "!f() { git diff "$1"^.."$1"; }; f"
# ~/.irbrc
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
# ~/.ps1rc
## PS1:INI
# prompt with ruby version
# rbenv version | sed -e 's/ .*//'
__rbenv_ps1 ()
{
rbenv_ruby_version=`rbenv version | sed -e 's/ .*//'`
printf $rbenv_ruby_version
}
__parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
# prompt with git && rbenv
if [ -f $BASH_COMPLETION_DIR/git ] && [ -f `which rbenv` ]; then
export PS1='\[\033[01;32m\]\u@\h\[\033[01;33m\] \w$(__git_ps1) R[$(__rbenv_ps1)] B$(__parse_git_branch) \n\[\033[01;34m\]\$\[\033[00m\] '
elif [ -f $BASH_COMPLETION_DIR/git ]; then
export PS1='\[\033[01;32m\]\u@\h\[\033[01;33m\] \w$(__git_ps1) \n\[\033[01;34m\]\$\[\033[00m\] '
elif [ `which rbenv` ]; then
export PS1='\[\033[01;32m\]\u@\h\[\033[01;33m\] \w R[$(__rbenv_ps1)] B$(__parse_git_branch) \n\[\033[01;34m\]\$\[\033[00m\] '
else
export PS1='\[\033[01;32m\]\u@\h\[\033[01;33m\] \w \n\[\033[01;34m\]\$\[\033[00m\] '
fi
## PS1:END
{
"font_size": 13,
"hot_exit": false,
"ignored_packages":
[
"Vintage"
],
"remember_open_files": false,
"show_minimap": false,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"word_wrap": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment