-
Notifications
You must be signed in to change notification settings - Fork 0
/
deprecated-aliases.sh
164 lines (119 loc) · 3.48 KB
/
deprecated-aliases.sh
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/bash
# deprecated-aliases.sh: aliases/functions that are probably unused
# 2013 - 2024 David Ulrich
#
# CC0: This work has been marked as dedicated to the public domain.
#
# You may have received a copy of the Creative Commons Public Domain dedication
# along with this program. If not, see <https://creativecommons.org/publicdomain/zero/1.0/>.
# CONFIG VARIABLES
rd_res="1440x1080"
script_path="~/scripts"
web_path="~/code/web"
# Remote Desktop Shortcuts
alias rdesktop="rdesktop -g $rd_res"
alias xx="screen -x"
# cd aliases, eval style
cdnames=( scripts web )
cdpaths( "$script_paths" "$web_path" )
for i in {0..1}
do
aliascd ${cdnames[$i]} ${cdpaths[$i]}
done
alias life="$here/daylog.sh -f life"
alias food="$here/daylog.sh -f food"
alias my="mysql -A -u root -p"
alias mykill="pkill mysql-workbench" #lol
# what find should usually do
# quote name as necessary to avoid unexpected shell-expansions
ff () {
# the shell expansion resulted in 'unknown predicate' but the expanded command works manually
# find . -iname \""$1"\" -not\ -path\ \"*/{.git,node_modules,uploads}/*\"
find . -iname "$1" \
-not -path "*/.deps/*" \
-not -path "*/.git/*" \
-not -path "*/autom4te.cache/*" \
-not -path "*/html/scripts/*" \
-not -path "*/node_modules/*" \
-not -path "*/uploads/*" \
-not -path "*/src-min-noconflict/*"
}
alias subcount="find . -type f | wc -l"
# different approach to finding files
alias lg="ll | grep -iP"
alias lgr="ll -R | grep -iP"
alias lh="ls -ahlFB"
# What I want grep to do 99% of the time
gr () {
local path=$(defarg "$*" 1 './')
grep ${grep_options[@]} $1 $path
}
# Sometimes I just want an overview from grep
grc () {
local path=$(defarg "$*" 1 './')
grep -c ${grep_options[@]} $1 $path | grep -E ':[^0]'
}
# old gr / grc
ge () {
local path=$(defarg "$*" 1 './')
grep -E ${grep_options[@]} $1 $path
}
gec () {
local path=$(defarg "$*" 1 './')
grep -Ec ${grep_options[@]} $1 $path | grep -E ':[^0]'
}
pc () {
perlcritic $1 2>/dev/null
}
## assorted
alias clim="fortune /usr/share/games/fortunes/off/limerick | cowsay -n"
alias cvim="cb ; vim -c vs"
alias eject_fix="sudo eject -i off"
alias glver="glxinfo | grep 'OpenGL version'"
kt () {
eval `ssh-agent`
ssh-add
}
alias webstack="service apache2 restart && service nginx restart"
alias a2log="tail -n 50 -f /var/log/apache2/error.log"
alias phplog="tail -n 50 -f /var/log/php/php_errors.log"
alias tn="tail -n 100 -f"
alias tnn="tail -n 1000 -f"
alias myips="hostname -I"
n() {
local path=$(defarg "$*" 0 "server.js")
nodemon $path
}
# a totally irrelevant curiosities
hashalen () {
local len=$(defarg "$*" 0 4)
printf -- '%s\n' $(git log --pretty=format:'%H' | grep -i --color=always "[[:alpha:]]\{$len\}")
}
hashstr () {
local str=$(defarg "$*" 0 "dead")
printf -- '%s\n' $(git log --pretty=format:'%H' | grep -i --color=always "$str")
}
hashwords () {
len=$(defarg "$*" 0 4)
dwords=$(grep "^[a-fA-F]\{$len\}$" /etc/dictionaries-common/words)
echo "=============================="
echo "searching $len letter words..."
echo "=============================="
for w in $dwords; do
printf "\nword: $w"
printf -- '\n\t%s' $(git log --pretty=format:'%H' | grep -i --color=always "$w")
done
echo ""
echo "=============================="
echo "...done"
echo "=============================="
}
commits () {
local terms=$( ajoin "|" "$@" )
git log --pretty=format:"(%aN) %s" | grep -iE "($terms)"
}
# fix common typos
alias bim="vim"
alias clera="clear"
# load tmux helper
source $here/tmux.sh