Last active
August 29, 2015 14:25
-
-
Save QuinnyPig/359a7050e364d388f85d to your computer and use it in GitHub Desktop.
This file contains 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
# Alias hub to git if it's installed, otherwise don't blow up | |
if type "hub" > /dev/null; then | |
alias git=hub | |
fi | |
# Crappy OS X detection. This sets some Java and EC2 required nonsense. | |
if [[ -e /usr/local/Cellar ]]; then | |
export JAVA_HOME="$(/usr/libexec/java_home)" | |
export EC2_HOME="/usr/local/Library/LinkedKegs/ec2-api-tools/jars" | |
fi | |
# You ruby nuts will love this, spits out PID and process name, takes regexp. | |
alias psgrep="ps Ao pid,comm|ruby -e 'puts STDIN.read.gsub(/^ *(\d+) .*?([^\/]+?$)/,\"\\\1: \\\2\")'|grep -iE" | |
#edit without a trace | |
alias vim-noswap='vim -n -i NONE --cmd "setlocal noswapfile" --cmd "set nocompatible" --cmd "set tabstop=4" -u NONE' | |
# various stuff to make the commands more sane | |
# Note that this may be zsh specific. | |
alias mv='nocorrect mv -i' # prompt before overwriting files | |
alias mkdir='nocorrect mkdir' # don't correct mkdir | |
alias man='nocorrect man' | |
alias wget='noglob wget' | |
alias grep='grep --color=auto' | |
alias scp='noglob scp_wrap' | |
alias vimdiff='vimdiff -O2' | |
# useful to see what hogs your disk (this is so i can actually find this damn alias in here: find disk space) | |
alias sz='du -ahx | sort -n' | |
#ebg13 vf frpher | |
alias rot13='tr a-zA-Z n-za-mN-ZA-M <<<' | |
# base64 conversion | |
alias base64-encode='perl -MMIME::Base64 -e "print encode_base64(<>)" <<<' | |
alias base64-decode='perl -MMIME::Base64 -e "print decode_base64(<>)" <<<' | |
# global aliases. use with care! | |
alias -g C='| wc -l' | |
alias -g N='1>/dev/null 2>/dev/null' | |
alias -g E='| egrep' | |
alias -g G='| grep -i' | |
alias -g H='| head' | |
alias -g GV='| grep -iv' | |
alias -g L='| $PAGER' | |
alias -g T='| tail' | |
alias -g V='| vim -' | |
alias -g X='| xargs' | |
alias -g ...=../.. | |
alias -g ....=../../.. | |
alias -g .....=../../../.. | |
alias -g ......=../../../../.. | |
alias -g .......=../../../../../.. | |
alias -g ........=../../../../../../.. | |
alias -g S='| sort' | |
alias -g SN='| sort -n' | |
alias -g SNR='| sort -nr' | |
alias -g SHR='| sort -Hr' | |
alias -g A='| awk ' | |
alias -g A1="| awk '{print \$1}'" | |
alias -g A2="| awk '{print \$2}'" | |
alias -g A3="| awk '{print \$3}'" | |
alias -g A4="| awk '{print \$4}'" | |
alias -g A5="| awk '{print \$5}'" | |
# display the ten newest files | |
alias lsnew="ls -rl *(D.om[1,10])" | |
# display the ten oldest files | |
alias lsold="ls -rtlh *(D.om[1,10])" | |
# display the ten smallest files | |
alias lssmall="ls -Srl *(.oL[1,10])" | |
#ssh & scp without security checks | |
alias ssh-noverify='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"' | |
alias scp-noverify='scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"' | |
# serial console stuff | |
# You will thank me if you ever have to console into a Cisco router | |
alias serial_115200_7bit='screen /dev/ttyUSB0 115200,cs7' | |
alias serial_2400_8bit_noflow='screen /dev/ttyUSB0 2400,cs8,ixoff' | |
alias serial_9600_8bit='screen /dev/ttyUSB0 9600,cs8' | |
# Homebrew (and others) are using sha256 hashes rather than sha1 now | |
alias sha256sum='shasum -a 256' | |
# When you just don't care anymore | |
alias yolo='git commit -am "DEAL WITH IT" && git push -f origin master' | |
# Since I can never quite remember OpenSSL's s_client syntax, this makes it behave like | |
# unsecured telnet. | |
alias stelnet="openssl s_client -connect $1:$2" | |
# cd to the path of the front Finder window | |
cdf() { | |
target=`osascript -e 'tell application "Finder" to get POSIX path of (target of front Finder window as text)'` | |
cd "$target" | |
} | |
# Open a Finder window in your current directory; inverse to cdf() | |
alias f='open -a Finder ./' | |
# Enables: | |
#$ wow | |
#$ such commit | |
#$ very push | |
alias such=git | |
alias very=git | |
alias wow='git status' | |
# Make tmux happy | |
alias tmux="TERM=xterm-256color tmux" | |
# Colorized cat is useful at times. | |
alias ccat='pygmentize -g' | |
# This solves the bootstrapping problem for Vundle (vim plugin manager) | |
alias setupvim='git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim' | |
# iTerm2 Stuff | |
it2prof() { echo -en "\033]50;SetProfile=$1\a" } | |
alias Dark='it2prof Dark' | |
alias Light='it2prof Light' | |
# Great typo correction, presuming thefuck is installed. | |
alias fuck='$(thefuck $(fc -ln -1))' | |
# Stuff stolen from Originators | |
mkcd() { mkdir -p "$1"; cd "$1"; } | |
relpath(){ python -c "import os.path; print os.path.relpath('$1','${2:-$PWD}')" | |
alias highlight="ack --passthru" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment