View difference between Paste ID: jwCurUBJ and N1WJCJcF
SHOW: | | - or go back to the newest paste.
1
# Easier navigation: .., ..., ...., ....., ~ and -
2
alias ..="cd .."
3
alias ...="cd ../.."
4
alias ....="cd ../../.."
5
alias .....="cd ../../../.."
6
alias ~="cd ~" # `cd` is probably faster to type though
7
alias -- -="cd -"
8
9-
alias snapchat="cd ~/snaphax/examples/ && php fetch_all_new_photos.php && open ~/Dropbox/Snapchat/"
9+
10
alias d="cd ~/Documents/Dropbox"
11
alias dl="cd ~/Downloads"
12
alias dt="cd ~/Desktop"
13
alias p="cd ~/Projects"
14
alias g="git"
15
alias h="history"
16
alias j="jobs"
17
alias pi="ssh [email protected]"
18
alias tv="php ~/.scripts/yousee.php"
19
20
# Detect which `ls` flavor is in use
21
if ls --color > /dev/null 2>&1; then # GNU `ls`
22
	colorflag="--color"
23
else # OS X `ls`
24
	colorflag="-G"
25
fi
26
27
# List all files colorized in long format
28
alias l="ls -lF ${colorflag}"
29
30
# List all files colorized in long format, including dot files
31
alias la="ls -laF ${colorflag}"
32
33
# List only directories
34
alias lsd='ls -lF ${colorflag} | grep "^d"'
35
36
# Always use color output for `ls`
37
alias ls="command ls ${colorflag}"
38
export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'
39
40
# Enable aliases to be sudo’ed
41
alias sudo='sudo '
42
43
# Gzip-enabled `curl`
44
alias gurl='curl --compressed'
45
46
# Get week number
47
alias week='date +%V'
48
49
# Stopwatch
50
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
51
52
# Get OS X Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages
53
alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm update npm -g; npm update -g; sudo gem update'
54
55
# IP addresses
56
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
57-
alias localip="ipconfig getifaddr en1"
57+
alias localip="ipconfig getifaddr en0"
58
alias ips="ifconfig -a | grep -o 'inet6\? \(\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)\|[a-fA-F0-9:]\+\)' | sed -e 's/inet6* //'"
59
60
# Enhanced WHOIS lookups
61-
alias whois="whois -h whois-servers.net"
61+
#alias whois="whois -h whois-servers.net"
62
63
# Flush Directory Service cache
64
alias flush="dscacheutil -flushcache && killall -HUP mDNSResponder"
65
66
# Clean up LaunchServices to remove duplicates in the “Open With” menu
67
alias lscleanup="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder"
68
69
# View HTTP traffic
70-
alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'"
70+
alias sniff="sudo ngrep -d 'en0' -t '^(GET|POST) ' 'tcp and port 80'"
71-
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\""
71+
alias httpdump="sudo tcpdump -i en0 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\""
72
73
# Canonical hex dump; some systems have this symlinked
74
command -v hd > /dev/null || alias hd="hexdump -C"
75
76
# OS X has no `md5sum`, so use `md5` as a fallback
77
command -v md5sum > /dev/null || alias md5sum="md5"
78
79
# OS X has no `sha1sum`, so use `shasum` as a fallback
80
command -v sha1sum > /dev/null || alias sha1sum="shasum"
81
82
# Trim new lines and copy to clipboard
83
alias c="tr -d '\n' | pbcopy"
84
85
# Recursively delete `.DS_Store` files
86
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"
87
88
# ROT13-encode text. Works for decoding, too! ;)
89
alias rot13='tr a-zA-Z n-za-mN-ZA-M'
90
91
# Empty the Trash on all mounted volumes and the main HDD
92
# Also, clear Apple’s System Logs to improve shell startup speed
93
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl"
94
95
# Show/hide hidden files in Finder
96
alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
97
alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
98
99
# Hide/show all desktop icons (useful when presenting)
100
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"
101
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"
102
103
# URL-encode strings
104
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'
105
106
# Merge PDF files
107
# Usage: `mergepdf -o output.pdf input{1,2,3}.pdf`
108
alias mergepdf='/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py'
109
110
# Disable Spotlight
111
alias spotoff="sudo mdutil -a -i off"
112
# Enable Spotlight
113
alias spoton="sudo mdutil -a -i on"
114
115
# PlistBuddy alias, because sometimes `defaults` just doesn’t cut it
116
alias plistbuddy="/usr/libexec/PlistBuddy"
117
118
# Ring the terminal bell, and put a badge on Terminal.app’s Dock icon
119
# (useful when executing time-consuming commands)
120
alias badge="tput bel"
121
122
# Intuitive map function
123
# For example, to list all directories that contain a certain file:
124
# find . -name .gitattributes | map dirname
125
alias map="xargs -n1"
126
127
# One of @janmoesen’s ProTip™s
128
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
129
	alias "$method"="lwp-request -m '$method'"
130
done
131
132
# Make Grunt print stack traces by default
133
command -v grunt > /dev/null && alias grunt="grunt --stack"
134
135
# Stuff I never really use but cannot delete either because of http://xkcd.com/530/
136
alias stfu="osascript -e 'set volume output muted true'"
137
alias pumpitup="osascript -e 'set volume 7'"
138-
alias hax="growlnotify -a 'Activity Monitor' 'System error' -m 'WTF R U DOIN'"
138+
alias hax="terminal-notifier -title 'Activity Monitor' -subtitle 'System error' -message 'WTF R U DOIN'"
139
140
# Kill all the tabs in Chrome to free up memory
141
# [C] explained: http://www.commandlinefu.com/commands/view/402/exclude-grep-from-your-grepped-output-of-ps-alias-included-in-description
142
alias chromekill="ps ux | grep '[C]hrome Helper --type=renderer' | grep -v extension-process | tr -s ' ' | cut -d ' ' -f2 | xargs kill"