laughing-hipster/.bash_aliases

118 lines
3.9 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# vim: set ft=sh
alias cdp="cd -"
alias ..='cd ..'
alias pd="pushd $1"
# list files
alias ll='ls --color=always -l'
#rake
alias bake='bundle exec rake'
alias fbake='bundle exec rake clobber default test:xunit'
alias bakeserver='bundle exec rake clobber localci build_env=dev'
alias uberbake='~/uberbake.txt'
#tools
alias s='start Source/*.sln'
alias resrc='source ~/.bash_aliases && source ~/.bashrc && source ~/.profile'
alias role='whoami -groups -fo list | grep -i'
alias fu='find ./ -type f -print0 | xargs -0 grep -n $1'
#git
alias gs='git status'
alias diff='git difftool'
alias diffc='git difftool --cached'
alias gpr='git pull --rebase'
alias gmt='git mergetool'
alias grc='git rebase --continue'
alias gk='git fetch origin; git remote prune origin; gitk --all &'
alias dlb='dml'
alias gl='git log --pretty=format:"%h %ar by %an: %s"'
# Get week number
alias week='date +%V'
# Stopwatch
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
# Get OS X Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages
alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update'
# IP addresses
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en0"
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
# Empty the Trash on all mounted volumes and the main HDD
# Also, clear Apples System Logs to improve shell startup speed
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl"
# Show/hide hidden files in Finder
alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
# Recursively delete `.DS_Store` files
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"
# Hide/show all desktop icons (useful when presenting)
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"
# Stuff I never really use but cannot delete either because of http://xkcd.com/530/
alias stfu="osascript -e 'set volume output muted true'"
alias pumpitup="osascript -e 'set volume 7'"
# Kill all the tabs in Chrome to free up memory
# [C] explained: http://www.commandlinefu.com/commands/view/402/exclude-grep-from-your-grepped-output-of-ps-alias-included-in-description
alias chromekill="ps ux | grep '[C]hrome Helper --type=renderer' | grep -v extension-process | tr -s ' ' | cut -d ' ' -f2 | xargs kill"
# Lock the screen (when going AFK)
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
alias mongodps="mongod --config /usr/local/etc/mongod.conf --fork --logpath ~/.docs/mongo.log"
# delete merged local branches
function dml(){
for b in `git branch --merged | grep -v \*`; do git branch -D $b; done
}
function clone()
{
if [ -z "$1" ]
then
echo "Missing git repository url ending"
echo "usage: clone 'git repository ending' ['target directory name']"
else
giturl="git@github.com:$1.git"
if [ -z "$2" ]
then
# we DON'T HAVE a target directory
git clone $giturl
else
# we HAVE a target directory
git clone $giturl $2
fi
fi
}
# runs vim in the terminal without forking, great for tmux on my mac
function vimt(){
if [[ $# -eq 0 ]]; then
vim
else
vim --remote-tab-silent "$@"
fi
}
# runs vim outside of the term by forking the command and gvim, great for my windows box
function vimd(){
if [[ $# -eq 0 ]]; then
gvim &
else
gvim --remote-tab-silent "$@" &
fi
}