forked from matthewmccullough/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshellaliases
executable file
·163 lines (128 loc) · 6.15 KB
/
shellaliases
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/bin/sh
#########################################
# Load Custom Alias
for file_alias in $HOME/.shellaliases.d/*; do
echo $file_alias
. $file_alias
done
#########################################
# Commands to run apps
#alias run.clojure.repl='java -cp ${CLOJURE_HOME}/clojure.jar clojure.lang.Repl'
#alias run.jlineclojure.repl='java -cp ${CLOJURE_HOME}/jline-0.9.91.jar:${CLOJURE_HOME}/clojure.jar jline.ConsoleRunner clojure.lang.Repl'
#alias run.clojure.script='java -cp ${CLOJURE_HOME}/clojure.jar clojure.main'
#########################################
# Commands to change dirs
alias to.dotfiles='cd ~/.dotfiles'
alias to.temp='cd ${MYTEMP}'
alias to.downloads='cd ${MYDOWNLOADS}'
#alias to.dropbox='cd ~/Dropbox'
alias to.desktop='cd ~/Desktop'
alias to.process='cd ${MYPROCESS}'
alias to.docs='cd ${MYDOCUMENTS}'
alias to.code='cd ${MYCODE}'
alias to.scratch='cd ${MYSCRATCH}'
alias to.teach='cd ${MYTEACH}'
alias to.github='cd ~/Documents/Code/GitHub'
alias to.homebrew='cd /usr/local/Library'
alias to.courses='cd ${MYCOURSES}'
alias to.devapps='cd ${MYDEVAPPS}'
#################################
# Simple Program Name Shortening
alias aq=aquamacs
alias g=git
#############################
# Utilities
alias zipall='for D in *; do zip -r "$D" "$D"; done; unset D'
alias pram.reset='sudo nvram boot-args=”-p -r”'
alias macports.cleansource='sudo port -f uninstall inactive'
alias macports.cleanold='sudo port clean --all installed'
#alias rubygems.update='sudo gem update --system'
alias macports.update='sudo port selfupdate && sudo port upgrade outdated'
alias brew.update='brew update && brew upgrade'
#alias timemachine.enablelocalversions='sudo tmutil enablelocal'
#alias timemachine.disablelocalversions='sudo tmutil disablelocal'
alias hexdumpfile='od -h'
# Flush the DNS on Mac
alias network.dnsflush='dscacheutil -flushcache'
# Copy and paste and prune the usless newline
alias pbcopynn='tr -d "\n" | pbcopy'
# Set the extended MacOS attributes on a file such that Quicklook will open it as text
alias finder.astext='xattr -wx com.apple.FinderInfo "54 45 58 54 21 52 63 68 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" $1'
#alias finder.qltext2='osascript -e tell application "Finder" to set file type of ((POSIX file "$1") as alias) to "TEXT"'
# Git Scribe Commands
#alias gitscribe.gp='git scribe gen pdf && open output/book.pdf'
#alias gitscribe.gh='git scribe gen html && open output/book.html'
# Show network connections
# Often useful to prefix with SUDO to see more system level network usage
alias network.connections='lsof -l -i +L -R -V'
alias network.established='lsof -l -i +L -R -V | grep ESTABLISHED'
alias network.internalip="ifconfig en0 | egrep -o '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)'"
alias network.externalip='curl -s http://checkip.dyndns.org/ | sed "s/[a-zA-Z<>/ :]//g"'
# Files used, anywhere on the filesystem
alias files.usage='sudo fs_usage -e -f filesystem|grep -v CACHE_HIT|grep -v grep'
# Files being opened
alias files.open='sudo fs_usage -e -f filesystem|grep -v CACHE_HIT|grep -v grep|grep open'
# Files in use in the Users directory
alias files.usage.user='sudo fs_usage -e -f filesystem|grep -v CACHE_HIT|grep -v grep|grep Users'
# Directory listings
# LS_COLORS='no=01;37:fi=01;37:di=07;96:ln=01;36:pi=01;32:so=01;35:do=01;35:bd=01;33:cd=01;33:ex=01;31:mi=00;05;37:or=00;05;37:'
# -G Add colors to ls
# -l Long format
# -h Short size suffixes (B, K, M, G, P)
# -p Postpend slash to folders
alias ls='ls -G -h -p '
alias ll='ls -l -G -h -p '
#########################################
# Utility Functions
# Restart Apache on Mac
#alias apacherestart="sudo /usr/sbin/apachectl restart"
# Do a Matrix movie effect of falling characters
function matrix1() {
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|gawk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
}
function matrix2() {
echo -e "\e[1;40m" ; clear ; characters=$( jot -c 94 33 | tr -d '\n' ) ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) $characters ;sleep 0.05; done|gawk '{ letters=$5; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
}
function matrix3() {
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $( printf "\U$(( $RANDOM % 500 ))" ) ;sleep 0.05; done|gawk '{c=$4; letter=$4;a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
}
# Use Mac OSX Preview to open a man page in a more handsome format
function manp() {
man -t $1 | open -f -a /Applications/Preview.app
}
# Show normally hidden system and dotfile types of files
# in Mac OSX Finder
function finder.showhiddenfiles() {
defaults write com.apple.Finder AppleShowAllFiles YES
osascript -e 'tell application "Finder" to quit'
sleep 0.25
osascript -e 'tell application "Finder" to activate'
}
# Hide (back to defaults) normally hidden system and dotfile types of files
# in Mac OSX Finder
function finder.hidehiddenfiles() {
defaults write com.apple.Finder AppleShowAllFiles NO
osascript -e 'tell application "Finder" to quit'
sleep 0.25
osascript -e 'tell application "Finder" to activate'
}
# Get (cache) all Cheat sheets
function cheat.getall() {
cheat sheets | grep '^ ' | xargs -n 1 -I {} bash -c 'cheat {} | :'
}
function find.name() {
wild=\'\*$1\*\'
sh -c "find . -iname $wild"
}
alias lessc='less -R' # Lets color escape sequences carry through to less
alias morec='more -R'
alias lesscolor='less -R'
alias morecolor='more -R'
function screenshot.setjpg() {
defaults write com.apple.screencapture type jpg
killall SystemUIServer
}
function screenshot.setpng() {
defaults write com.apple.screencapture type png
killall SystemUIServer
}