Repository navigation
Expand file tree
/
Copy pathaliases.txt
More file actions
281 lines (197 loc) · 12.6 KB
/
Copy pathaliases.txt
File metadata and controls
281 lines (197 loc) · 12.6 KB
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# useful aliases
# when network connection goes down, many procs hang; this kills them in a single blow (because typing on the keyboard can be hard + remembering which processes to kill can be difficult as well)
# both killed 25 Aug 2017, not needed on saopaulo
# alias diedie "sudo pkill convert; sudo pkill xwd; sudo pkill curl; sudo pkill grep; sudo pkill sshfs; sudo pkill find; sudo pkill bc-xwd.pl; sudo pkill bc-elec-snap.pl"
# alias diediedie "sudo pkill -9 convert; sudo pkill -9 xwd; sudo pkill -9 curl; sudo pkill -9 grep; sudo pkill -9 sshfs; sudo pkill -9 find; sudo pkill -9 bc-xwd.pl; sudo pkill -9 bc-elec-snap.pl"
# nagios status from status.dat (very kludgey)
alias nagstat "egrep 'host_name|plugin_output|current_state|(host|service)status|service_description|check_command' /var/nagios/status.dat | grep -v 'long_plugin_output'"
# cleanup nagios status files that are older than last nagios invocation
# TODO: this should really be done automatically at nagios restart
alias nagclean "find /home/barrycarter/ERR -iname 'nagios.*.err' ! -newer /var/nagios/rw/nagios.cmd | xargs rm"
# check all nagios services
# <h>but mostly show off my insane shell alias</h>
# TODO: make nagios do this at startup somehow?
# the "date +%s" that was below hardcoded to when aliases.txt was
# loaded, so just replacing it with 0 which must work as well
alias nagcheck "grep host_name /var/nagios/status.dat | sort | uniq | cut -d= -f 2 | xargs -I'{}' sudo echo '[0] SCHEDULE_FORCED_HOST_SVC_CHECKS;{};0' >> /var/nagios/rw/nagios.cmd"
# start nagios "my way" (sleep sadly needed since nagios doesn't die instantly)
# <h>who needs /etc/init.d anyway!</h>
# this fails if nagios isn't running already; pkill nagios && nagios
# would've been a better option
alias nagstart "echo restarting nagios...; sudo rm /home/barrycarter/ERR/nagios.*.err; sudo pkill nagios; sudo nice -19 nagios -d /home/barrycarter/BCGIT/NAGIOS/nagios.cfg; sleep 5; nagcheck"
# volume
alias volume "amixer set 'Master Front' \!*"
# how many watts (joules/second) of electricity you're using, if it
# takes your meter n+-1 seconds to go around (assuming you have
# standard 7.2 electric meter)
alias watts 'echo "25920/\!*\n25920/(\!* -1)\n25920/(\!* +1)" | bc'
# just a silly way to do a quick plot
alias qplot 'echo plot \"/tmp/gnuplot.txt\" with linespoints | gnuplot -persist'
# makes locate case-insensitive and stores result in file (I often do
# 'locate', expecting minimal results, but there are lots and they
# scroll off-screen)
alias locate 'locate -i \!* | tee /var/tmp/bc-cmd-locate.txt'
# useful to confirm pkill works
# <h>NOTE: -v does NOT mean verbose!</h>
alias pkill "pkill \!*; pgrep -l \!*"
# I do NOT want "which" aliases to "alias | which...", since that
# breaks "which cd"
unalias which
# pull weather from my site (must use dots in name)
alias weather "curl \!*.weather.94y.info"
# run a single nagios test
alias nagtest "sudo /home/barrycarter/BCGIT/bc-call-func.pl run_nagios_test \!*"
alias nagiostest "echo 'this is obsolete; use nagtest instead'"
# logs me into bcinfo3 into a new local screen and starts remote screen
alias bcinfo3 "screen -t BC3 ssh -i /home/barrycarter/.ssh/id_rsa.bc -tt root@bcinfo3 screen -d -R"
alias bcpc "screen -t BCPC ssh -tt Owner@bcpc"
# after old bcinfo machine broke, this is new one (defined as bcinfo4
# in /etc/hosts) (shared hosting)
# later, they disinstalled screen (bastards)
alias bcinfo4 "screen -t BC4 ssh -i /home/barrycarter/.ssh/id_rsa.bc barrycar@bcinfo4"
# rsyncs to bcinfo3 (my new plugin is so awesome,I even sync it to my old site)
# alias bcinfo3sync "cd /home/barrycarter/BCGIT; \rsync -e 'ssh -i /home/barrycarter/.ssh/id_rsa.bc' -Pvzrlpt *.pl */*.pl root@bcinfo3:/usr/local/bin/; \rsync -Pvzrlpt -e 'ssh -i /home/barrycarter/.ssh/id_rsa.bc' /home/barrycarter/BCGIT/BCINFO3/ root@bcinfo3:/; \rsync -Pvzrlpt -e 'ssh -i /home/barrycarter/.ssh/id_rsa.bc' /home/barrycarter/BCGIT/BCINFO3/sites/wordpress/wp-content/plugins/ root@bcinfo:/usr/share/wordpress/wp-content/plugins/"
# testing replacement using bc-mirror-server
# some data on bcinfo3 has to be private (eg, auth keys), so must also
# mirror from private directory
# 22 Feb 2016: created/added special id for this
alias bcinfo3sync "bc-mirror-server.pl --ssh='ssh -i /home/barrycarter/.ssh/id_rsa.bc' /home/barrycarter/BCGIT/BCINFO3/ bcinfo3; bc-mirror-server.pl --ssh='ssh -i /home/barrycarter/.ssh/id_rsa.bc' /home/barrycarter/BCINFO3-PRIV bcinfo3"
# chmods all Perl scripts to +x (something I tend to be bad about)
alias perlfix "find /home/barrycarter/PERL/ /home/barrycarter/BCGIT/ -iname '*.pl' | xargs chmod +x"
# easier access to datediff subroutine
alias datediff "bc-call-func.pl datediff"
# check if word is in WWF dictionary
alias wwf "bzfgrep -ix \!* /home/barrycarter/BCGIT/WWF/wwf.txt.bz2"
# brings up electric meter camera in vlc (which I've configured to
# take screenshots every minute
# it took quite a bit of work to get the nice's below working properly
# pkill -9 added since the somagic-capture process sometimes lingers
# (and so can the vlc process sometimes)
# dropped 25 Aug 2017: stopped using this ages ago
# alias elecstart "sudo pkill -9 vlc; sudo pkill -9 somagic-capture; sudo /bin/nice -n 19 somagic-capture | /bin/nice -n 19 vlc --config /home/barrycarter/.config/vlc/vlcrc-elecstart --demux rawvideo --rawvid-fps 15 --rawvid-width 720 --rawvid-height 576 --rawvid-chroma=UYVY file:///dev/stdin &"
# recollq output tends to scroll by
# 8 Oct 2014: added old "bad" index (that recollindex can no longer
# use) that still seems to work for searching
# 20 Dec 2015: reset index
# 26 Sep 2017: new config dir, and just use "recoll -t"
# alias recollq "recollq \!* | tee /var/tmp/bc-cmd-recollq.txt"
alias recollq "recoll -t -c /root/.recoll/ \!* | tee /var/tmp/bc-cmd-recollq.txt"
# seeing date to nanosecond isnt superuseful except when 'time' fails
# can't really alias date as it breaks things like +%s and -d
alias daten 'date \!* +"%a %b %d %H:%M:%S.%N %Z %Y"'
# quick vnc to my Mac
alias vnc-bcmac "\vncviewer -passwd /home/barrycarter/.vnc/passwd-bcmac -geometry 1024x768+3072+768 bcmac&"
# no install script for ccextractor?
alias ccextractor "/root/build/ccextractor.0.67/linux/ccextractor"
# show me my "at" jobs with some details
# TODO: this doesnt match up jobs to events
# on saopaulo, "at -c <job>" does this + below fails, so replacing
# alias atsee "atq; sudo find /var/spool/at -maxdepth 1 -type f | fgrep -v '/.SEQ' | sudo xargs tail -n 1"
alias atsee "echo 'use at -c <job number>' instead"
# in theory, xephem should work regardless of where it's started; in
# reality, this:
alias xephem "pushd .; cd /usr/local/xephem; \xephem & popd"
# update git stuff (I should really pull before commit, but this lets
# me push quickly, while the pull and new push can occur in the
# background)
alias bcgit "pushd .; cd ~/BCGIT; git add .; git commit; git pull -v; git push remotes master; popd"
# running stuff from non-home-dir can do weird things, so..
# unaliased 14 Aug 2017, causes problems with path issues
# alias gnumeric "pushd .; cd ~; \gnumeric \!* & popd"
# unaliased 21 Aug 2017, not needed on saopaulo
# alias skype "pushd .; cd ~; /root/build/skype-4.3.0.37/skype \!*& popd"
# Microsoft fucks up skype and the name change is the least of my problems
alias skype skypeforlinux
# hex2dec often needed
alias hex2dec "bc-call-func.pl hex \!*"
# find most frequently used tags in my todo list (not everything in
# brackets is a tag, but the top most used ones will be)
# not working due to shell use of $
# fixed to not use shell
# alias todotags "perl -nle 'while (s/\[(.*?)\]//) {print \"$1\"}' /home/barrycarter/bc-todo-list.txt|sort|uniq -c|sort -nr"
alias todotags "bc-todotags.pl '\[(.*?)\]' < ~/bc-todo-list.txt | sort | uniq -c | sort -nr | less"
# hideously ugly and applicable only to me, this resets my USB bus
alias usbreset "echo 0000:00:1d.0 >! /sys/bus/pci/drivers/ehci_hcd/unbind; echo 0000:00:1a.0 >! /sys/bus/pci/drivers/ehci_hcd/unbind; echo 0000:00:1a.0 >! /sys/bus/pci/drivers/ehci_hcd/bind; echo 0000:00:1d.0 >! /sys/bus/pci/drivers/ehci_hcd/bind;"
# makes feh draw darker (more readable) captions and other
# modifications specific to me (-p below slows things down too much?)
# alias feh "feh -p -. -x --draw-tinted -K . -G \!*"
alias feh "feh -. -x --draw-tinted -K . -G \!*"
alias waitpid bc-waitpid.pl
# can add --realsies to below when desired
# alias mirror-referata "bc-mirror-mw.pl --debug --dir=pbs-referata --api=http://pearlsbeforeswine.referata.com/w/api.php \!*"
# below requires file list and --dryrun=0
alias mirror-referata "bc-mirror-mw-attr.pl --debug --api=http://pbs3.referata.com/w/api.php \!*"
# as of 6 jan 2018 (probably WAY before), this is dead
# alias mirror-wikia "bc-mirror-mw.pl --debug --dir=pbs --api=http://pearls-before-swine-bc.wikia.com/api.php \!*"
# for peanuts
alias mirror-peanuts "bc-mirror-mw-attr.pl --debug --api=http://peanuts.referata.com/w/api.php \!*"
# record chat-avenue chats (the quikbak just in case tcpflow
# overwrites the "same" packet from an older session)
# alias chatrecord "cd /home/barrycarter/TRANSCRIPTS/CHATAVENUE; bc-quikbak.pl *; sudo tcpflow 'net 199.59.161.0/24||net 100.42.219.208/29||net 199.59.160.0/24'&"
# chatavenue.com changes IP addresses later (and possibly encrypts, which would make this quite less useful)
alias chatrecord "cd /home/barrycarter/TRANSCRIPTS/CHATAVENUE; bc-quikbak.pl *; sudo tcpflow 'net 45.34.0.0/15'&"
# easier for bc-doing.pl
alias doing "bc-doing.pl \!*"
# probably will never need this again, but using it a lot when
# cleaning up directories
# sha1 of every file in this directory (no symlinks/etc)
alias sha1dir "find . -type f -print0 | xargs -0 sha1sum"
# strip sha1s from stdin, and return in sorted order
alias sha1sort "(sed 's/ .*//' | \sort | \uniq)"
# to use my special magic file
alias file "file -m /usr/share/magic:/home/barrycarter/BCGIT/bc-magic.dot \!*"
# really bad
# later unaliases as it works fine regularly on saopaulo
# alias zpaq "/root/build/ZPAQ71/zpaq \!*"
# run make in parallel
alias make "make -j \!*"
# quickly check that a file is sorted by extracting a few lines
alias quiksortcheck "bc-fastrand.pl --n=100 \!* | sort -c"
# short name for bc-alarm.pl (alarm2 is because I used to have two
# different alarm systems); the cd is not avoid running xmessage from
# an odd dir (removed cd later, since bc-alarm.pl does this now anyway
alias alarm "/home/barrycarter/BCGIT/bc-alarm.pl \!*"
alias alarm2 "pushd .; cd ; /home/barrycarter/BCGIT/bc-alarm.pl \!*; popd"
# long form of ps that provides more info, as used by bc-daemon-checker2.pl
alias pslong "ps -wwweo 'pid ppid etime rss vsz stat args' \!*"
# open a file in firefox directly from cmd line (fail, will need prog?)
# TODO: only works for one file
alias firefoxfile "readlink -f \!* | bc-open-urls2.pl"
# works for phrases (even without quotes) though it shouldnt
alias firefoxgoogle "echo 'http://google.com/search?q=\!*' | bc-open-urls.pl"
# brings up file in currently running *terminal* version of xemacs
# (which must be running "gnuserv-start"); should rewrite this to use
# gnuclient, but how?
alias emacsfile 'readlink -f \!* | xargs -I : gnudoit \(find-file \":\"\)'
alias date+ "/home/barrycarter/BCGIT/bc-date-plus.pl"
# as part of my plan to never install anything
alias node "/root/build/node-v6.0.0-linux-x86/bin/node"
# lets me play C64/128 games (probably better ways to do this)
alias commodoreplay "\rm ~/temp.zip; \cp \!* ~/temp.zip; x64 ~/temp.zip&"
# opens a window with a given name
alias window "xterm -geometry 80x53 +sb -bg gray45 -bd gray45 -T \!* -n \!* &"
# scans into current directory
# TODO: maybe rename this for saopaulo?
alias scanit "bc-scan-pic-brighton.pl"
# stops processes that slow down machine (even a fast one like
# saopaulo) to point where keyboard itself is slow
# may add more procs later, currently only these two
# qbittorrent is more of a network suck than a CPU suck, but useful to
# stop it when things are going haywire
# 16 Jan 2018: changed mind about qbittorrent
alias stopit "sudo killall -STOP recollindex zpaq rcltar tesseract"
# stopnet stops network intensive processes
alias stopnet "sudo killall -STOP qbittorrent wget curl"
# start mathematica with the <formula(s)> section of given file; useful
# for reloads (note careful avoidance of $)
alias math2 "perl -0777 -ple 's%^(.*?)<formulas>%%s; s%</formulas>.*%%s' \!* | tee /tmp/mathstart.m; math -initfile /tmp/mathstart.m"
# the -i is probably a bad idea (but at least I'm not tweaking the now
# deprecated GREP_OPTIONS); also, it overrides aliases in
# /etc/profile.d/colorgrep.csh
alias grep "grep -ia"
alias fgrep "fgrep -ia"
alias egrep "egrep -ia"
# I don't want these aliase from /etc/profile.d/colorgrep.csh
unalias ls
unalias ll
unalias l.