-
Notifications
You must be signed in to change notification settings - Fork 0
/
.myAlias
executable file
·3166 lines (2681 loc) · 125 KB
/
.myAlias
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#-------- Environment Variable {{{
#------------------------------------------------------
export HISTCONTROL=ignoreboth #Remove Extra Commands
export HISTCONTROL=erasedups #Erase duplicates across the whole history
HISTCONTROL=ignorespace #Space follow by a cmd,will not be saved in history
HISTCONTROL=ignoredups #Rm Dupes, the continuous repeated entry from history
HISTFILESIZE=3000 #Bash history size limit
HISTSIZE=1000
export HISTTIMEFORMAT="%d/%m/%y %T " #History list shows digital time and date
# Set 256 Colors
# http://blog.sanctum.geek.nz/256-colour-terminals/
if [ -e /usr/share/terminfo/x/xterm-256color ]; then
export TERM='xterm-256color'
fi
#}}}
#-------- Exports {{{
#------------------------------------------------------
# set display
export DISPLAY=:0
# find alternative apps if it is installed on your system
find_alt() { for i;do which "$i" >/dev/null && { echo "$i"; return 0;};done;return 1; }
# Use the first program that it detects in the array as the default app
export OPENER=$(find_alt xdg-open exo-open gnome-open )
export BROWSER=$(find_alt chromium chromium-browser google-chrome firefox $OPENER )
export BROWSERCLI=$(find_alt w3m links2 links lynx elinks $OPENER )
export COMICER=$(find_alt mcomix comix zathura $OPENER )
export EBOOKER=$(find_alt ebook-viewer $OPENER ) # epub
export EDITOR=$(find_alt vim emacs nano leafpad gedit pluma $OPENER )
export FILEMANAGER=$(find_alt pcmanfm thunar nautilus dolphin spacefm enlightenment_filemanager $OPENER )
export MUSICER=$(find_alt mpd mplayer mpg123 cvlc $OPENER )
export PAGER=$(find_alt less more most)
export PKMGR=$(find_alt yaourt pacman aptitude apt-get yum zypper emerge)
export PLAYER=$(find_alt vlc cvlc $OPENER )
export READER=$(find_alt mupdf zathura evince $OPENER )
export ROOTER=$(find_alt gksudo kdesudo )
export IMAGEVIEWER=$(find_alt feh display eog $OPENER )
# main path
export path_doc=~/Documents
export path_dl=~/Downloads
export path_pic=~/Pictures
export path_pub=~/Public
export path_storage=~/Storage
export path_vids=~/Videos
# secondary path
export PATH_SCREENCAST=$path_pub/screencast
export PATH_SOUNDFX=$path_pub/sound-effects
export PATH_SCREENSHOT=$path_pic/screenshots
# http://sourceforge.net/projects/lesspipe/
# tutorial video: https://www.youtube.com/watch?v=ZEHxG1OhIFo
#export LESSOPEN='|/usr/bin/lesspipe.sh %s'
#export LESS='-R'
# Source-Highlight
#export LESSOPEN='|/usr/bin/src-hilite-lesspipe.sh %s'
#export LESS='R'
# http://zameermanji.com/blog/2012/12/30/using-vim-as-manpager/
# export MANPAGER="/bin/sh -c \"col -b | vim -c 'set ft=man ts=8 nomod nolist nonu noma' -\""
# http://askubuntu.com/questions/49784/how-is-bin-added-to-my-path
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
#}}}
#-------- Color {{{
#------------------------------------------------------
# color the manpages
# tutorial video: http://www.youtube.com/watch?v=9BFaLAa428k
export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
export LESS_TERMCAP_md=$'\E[01;31m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode
export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
export LESS_TERMCAP_so=$'\E[01;44;33m' # begin standout-mode - info box
export LESS_TERMCAP_ue=$'\E[0m' # end underline
export LESS_TERMCAP_us=$'\E[01;32m' # begin underline
# color for common commands
# tutorial video: http://www.youtube.com/watch?v=RbVCzxnKJL4
if [ -x /usr/bin/dircolors ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# color for grep
# http://linuxaria.com/pills/coloring-grep-to-easier-research
export GREP_COLORS='0;31'
# Color Foreground Background
# Black 30 40
# Red 31 41
# Green 32 42
# Yellow 33 43
# Blue 34 44
# Magenta 35 45
# Cyan 36 46
# White 37 47
#}}}
#-------- Alias {{{
#------------------------------------------------------
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."
alias bc='bc -q -l' # dont show opening msg, use math library
alias cal='cal -3' # show 3 months
alias cp='cp -i' # cp interactive
# alias cmus='DISPLAY=:0 && cmus'
alias df='df -hT' # human readable, print filetype
alias du='du -d1 -h' # max depth, human readable
alias emacs='emacs -nw' # cli mode
alias feh='feh -B white -g 1360x768' # background, resolution
alias free='free -h' # human readable
alias fu='fu -a' # show all results
alias info='info --vi-keys' # GNU info act like man command
alias lsblk='lsblk -o "NAME,SIZE,FSTYPE,TYPE,LABEL,MOUNTPOINT,UUID"' # combo use lsblk or lsblk -f
alias mkdir='mkdir -p -v' # create if not exist, verbose
alias mount='mount | column -t' # align in column
alias mplayer='DISPLAY=:0 && mplayer'
alias mv='mv -i' # mv interactive
alias nano='nano -c -$' # word wrapping
alias nvlc='nvlc --no-color' # black/white color
alias pdfgrep='pdfgrep -in' # ignorecase, page number
alias rm='rm -i' # rm interactive
alias sshxforwarding='ssh -XCc blowfish-cbc,arcfour'
alias sshxtrusted='ssh -Y'
alias sr='sr -browser=$BROWSERCLI' # cli browser
alias surfraw='surfraw -browser=$BROWSER' # gui browser
alias srb='surfraw -browser=$BROWSER' # surfraw bookmarks
alias trash='trash-put'
alias wget='wget -c' # continues/resumes
alias weechat='weechat-curses'
alias youtube-viewer='youtube-viewer -C -f -4 --results=6' # color, fullscreen, 480p, number of results
alias lsd='ls -1d */' # ls folders only
alias l='ls -lah'
alias lst='ls -Ggthrc' # list by time and change, newest at bottom
alias lsa='ls -GghA'
# list and grep
lsg() {
keyword=$(echo "$@" | sed 's/ /.*/g')
ls -GgthrA | grep -iE $keyword
}
## }}}
#-------- Binary / Shell Scripts {{{
#------------------------------------------------------
# https://code.google.com/p/ass2srt
# convert ass/ssa to srt subtitle
ass2srt() { ~/.scripts/ass2srt.pl $@ ;}
# http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
# display avalible colors
color-avalible() { ~/.scripts/color-avalible.sh ;}
# http://madebynathan.com/2011/08/15/bash-color-index
# display color
color-index() { ~/.scripts/color-index.sh ;}
# https://bbs.archlinux.org/viewtopic.php?pid=658127#p658127
# show color for tput
color-tput() { ~/.scripts/color-tput.sh ;}
# lightweight image viewer
# tutorial video: https://www.youtube.com/watch?v=OMOIZlOEfb8
# https://wiki.archlinux.org/index.php/Feh#File_Browser_Image_Launcher
feh-browser() { ~/.scripts/feh-browser.sh $@ -B white -g 1280x800 & }
feh-slideshow() { ~/.scripts/feh-browser.sh $@ -B white -g 1280x800 -D 3 & }
# https://github.com/bagder/curl/blob/master/perl/contrib/formfind
# easy find web forms to use with curl
formfind() { ~/.scripts/formfind.pl ;}
# searches commandlinefu.com
# tutorial video: https://www.youtube.com/watch?v=Xeni7mHIVPE
# http://samirahmed.github.com/fu/
fu-dev() { python2.7 ~/.scripts/fu/src/fu.py -a $@ ;}
# d/l wallpapers from http://interfacelift.com
# tutorial video: https://www.youtube.com/watch?v=aK4mAAScnAo
# https://github.com/gotbletu/shownotes/blob/master/interfacelift.sh
get-interfacelift() { ~/.scripts/interfacelift.sh ;}
# backup dotfiles on to github
# http://linuxtidbits.wordpress.com/2012/05/30/managing-scripts-and-configurations-on-github-with-a-script/
ghsync() { ~/.scripts/ghsync-script.sh $@ ;}
# d/l music from http://grooveshark.com
# tutorial video: https://www.youtube.com/watch?v=QX4vyEmLhsE
# https://github.com/jacktheripper51/groove-dl
groove-dl-cli() { python2.7 /usr/share/groove-dl/groove.py "$@" ;}
# multiple text highlighter
# tutorial video: https://www.youtube.com/watch?v=KkGMOYoQx6A
# https://github.com/paoloantinori/hhighlighter
# requires: ack
if [ -e ~/.scripts/hhighlighter/h.sh ]; then
source ~/.scripts/hhighlighter/h.sh
fi
# http://code.google.com/p/imgur-cli
# imgur image uploader http://imgur.com
imgur() { python2 ~/.scripts/imgur-cli/imgur.py $@ ;}
# read apps reviews via cli (from ubuntu software center)
# tutorial video: https://www.youtube.com/watch?v=m6wfVxMTedY
# https://github.com/gotbletu/shownotes/blob/master/package_comments.py
package-comments() { python2.7 ~/.scripts/package_comments.py $@ ;}
# manual tiling (similar compiz grid plugin)
# tutorial video: https://www.youtube.com/watch?v=ZF76DELEpjM
# http://ssokolow.com/quicktile
quicktile() { python2.7 ~/.scripts/quicktile/quicktile.py $@ ;}
quicktile-daemonize() { nohup python2.7 ~/.scripts/quicktile/quicktile.py -d >/dev/null 2>&1& }
quicktile-kill () { kill $(ps -ef | grep '[q]uicktile.py' | awk '{print $2}') ;}
# http://bash.cyberciti.biz/multimedia/linux-rip-audio-cd/
rip-audio-cd() { ~/.scripts/rip_audio_cd.sh ;}
# swagbucks tv
sbtv() { ~/.scripts/sbtv_v1.sh $@ ;}
# screenshot gallery generator
# tutorial video: https://www.youtube.com/watch?v=_4G4nMUTzX8
# http://cli-apps.org/content/show.php/Movie+Thumbnailer?content=74676
shot() { ~/.scripts/shot.sh -n 30 -r 80% -s $@ ;}
# take screenshot fullscreen, window, area selection using import command
# http://en.gentoo-wiki.com/wiki/Screenshot
sshot() { ~/.scripts/screenshot.sh area ;}
# stream music from http://www.shoutcast.com
# tutorial video: https://www.youtube.com/watch?v=9T4VtC5Bhmo
# http://crunchbanglinux.org/forums/post/150615
shoutcast-tuner() { ~/.scripts/shoutcast_tuner.sh ;}
# catalog movies; generate html page
# tutorial video: https://www.youtube.com/watch?v=4J-ORBz7gjY
# http://smoviecat.sourceforge.net
simple-movie-catalog() { cd ~/.scripts/SimpleMovieCatalog; perl moviecat-pl -my -mf -origtitle -c config.txt ;}
# todo list manager
# tutorial video: https://www.youtube.com/watch?v=rm12kDVM1ps
# https://github.com/ginatrapani/todo.txt-cli
t() { ~/.scripts/todo.txt-cli/todo.sh $@ ;}
# search magnet links from thepiratebay
# tutorial video: https://www.youtube.com/watch?v=3lbLxx9Vlq8
# http://sourceforge.net/projects/torrtux
torrtux-dev() { ~/.scripts/torrtux-0.0.3/torrtux ;}
# Vim as a pager ( similar to the less command )
# tutorial video: https://www.youtube.com/watch?v=RefWl8I3nBg
# issue: gg hotkey does not jump to exact line
vlessold() { /usr/share/vim/vim73/macros/less.sh "$1" ;}
# http://technotales.wordpress.com/2009/05/24/using-vim-as-a-pager/
# vim readonly; to force write use :w!
vless() { vim -R "$@" ;}
# search thepiratebay and torrentz.eu
# tutorial video: https://www.youtube.com/watch?v=IY56U1L6FCI
# https://github.com/saironiq/shellscripts/blob/master/thepiratebay_se/tpb.sh
# https://github.com/saironiq/shellscripts/blob/master/torrentz_eu/torrentz_eu.sh
tpb() { ~/.scripts/shellscripts/thepiratebay_se/tpb.sh $@ ;}
trz() { ~/.scripts/shellscripts/torrentz_eu/torrentz_eu.sh $@ ;}
# https://bitbucket.org/antocuni/tty2gif
# convert ttyrec to gif files
tty2gif() { python3 ~/.scripts/tty2gif/tty2gif.py $@ ;}
# https://github.com/saironiq/shellscripts/blob/master/wolframalpha_com/wa.sh
# http://www.wolframalpha.com
wolframalpha() { ~/.scripts/shellscripts/wolframalpha_com/was.sh ;}
#}}}
#-------- Configurations {{{
#------------------------------------------------------
cfg-ag() { $EDITOR ~/.agignore ;}
cfg-aliases() { $EDITOR ~/.aliases_gotbletu ;}
cfg-amule() { $EDITOR ~/.aMule/amule.conf ;}
cfg-amuleweb() { $EDITOR ~/.aMule/remote.conf ;}
cfg-bashrc() { $EDITOR ~/.bashrc ;}
cfg-blocklist() { $EDITOR ~/.scripts/blocklist.sh ;}
cfg-centerim-binds() { $EDITOR ~/.centerim5/binds.xml ;}
# http://blog.dotsmart.net/2011/09/30/change-font-size-in-chrome-devtools/
cfg-chromium-devtoolsize() { $EDITOR ~/.config/chromium/Default/User\ StyleSheets/Custom.css ;}
cfg-chromium-noscript() { $EDITOR ~/.config/chromium/Default/Extensions/odjhifogjcknibkahlpidmdajjpkkcfn/*/CHANGE__PASSWORD__HERE.js ;}
# https://wiki.archlinux.org/index.php/Cursor_Themes#Choosing_and_Configuring_Cursor_Themes
cfg-cursor() { $EDITOR ~/.icons/default/index.theme ;}
cfg-cursor-list() { ls ~/.icons ;}
cfg-dircolors() { $EDITOR ~/.dircolors ;}
cfg-dmenu() { $EDITOR ~/.cache/dmenu_run ;}
cfg-emacs() { $EDITOR ~/.emacs ;}
cfg-emulationstation() { $EDITOR ~/.emulationstation/es_systems.cfg ;}
cfg-flexget() { $EDITOR ~/.flexget/config.yml ;}
cfg-fstab() { sudo $EDITOR /etc/fstab ;}
cfg-ghsync() { $EDITOR ~/.scripts/ghsync-script.sh ;}
cfg-gift-giftd() { $EDITOR ~/.giFT/giftd.conf ;}
cfg-gift-ui() { $EDITOR ~/.giFT/ui/ui.conf ;}
cfg-group() { sudo $EDITOR /etc/group ;}
cfg-hosts() { sudo $EDITOR /etc/hosts ;}
cfg-i3wm() { $EDITOR ~/.i3/config ;}
cfg-inputrc() { $EDITOR ~/.inputrc ;}
cfg-interfacelift() { $EDITOR ~/.scripts/interfacelift.sh ;}
cfg-lightdm() { sudo $EDITOR /etc/lightdm/lightdm.conf ;}
cfg-livestreamer() { $EDITOR ~/.livestreamerrc ;}
cfg-mcomix() { $EDITOR ~/.config/mcomix/keybindings.conf ;}
cfg-mediatomb() { $EDITOR ~/.mediatomb/config.xml ;}
cfg-mpd() { $EDITOR ~/.mpd/mpd.conf ;}
cfg-mplayer() { $EDITOR ~/.mplayer/config ;}
cfg-muttrc() { $EDITOR ~/.muttrc ;}
cfg-nanorc() { $EDITOR ~/.nanorc;}
cfg-ncmpcpp() { $EDITOR ~/.ncmpcpp/config ;}
cfg-newsbeuter() { $EDITOR ~/.newsbeuter/config ;}
cfg-newsbeuter-queue() { $EDITOR ~/.newsbeuter/queue ;}
cfg-newsbeuter-urls() { $EDITOR ~/.newsbeuter/urls ;}
cfg-pacman() { sudo $EDITOR /etc/pacman.conf ;}
cfg-pacman-mirrorlist() { sudo $EDITOR /etc/pacman.d/mirrorlist ;}
cfg-pastebinit() { $EDITOR ~/.pastebinit.xml ;}
cfg-percol() { $EDITOR ~/.percol.d/rc.py ;}
cfg-periscope() { $EDITOR ~/.config/periscope/config ;}
cfg-pianobar() { $EDITOR ~/.config/pianobar/config ;}
cfg-pianobar-libao() { sudo $EDITOR /etc/libao.conf ;}
cfg-plowshare-depositfiles() { $EDITOR ~/.config/plowshare/depositfiles.txt ;}
cfg-plowshare-netloadin() { $EDITOR ~/.config/plowshare/netloadin.txt ;}
cfg-plowshare-uploaded() { $EDITOR ~/.config/plowshare/uploaded.txt ;}
cfg-plowshare-rapidgator() { $EDITOR ~/.config/plowshare/rapidgator.txt ;}
cfg-plowshare-rapidshare() { $EDITOR ~/.config/plowshare/rapidshare.txt ;}
cfg-plowshare-random() { $EDITOR ~/.config/plowshare/random.txt ;}
cfg-pyload() { $EDITOR ~/.pyload/pyload.conf ;}
cfg-quicktile() { $EDITOR ~/.config/quicktile.cfg ;}
cfg-quicksynergy() { $EDITOR ~/.quicksynergy/synergy.conf ;}
cfg-ranger() { $EDITOR ~/.config/ranger/rc.conf ;}
cfg-ranger-rifle() { $EDITOR ~/.config/ranger/rifle.conf ;} # edit open_with extensions
cfg-ranger-commands() { $EDITOR ~/.config/ranger/commands.py ;} # scripts
cfg-samba() { sudo $EDITOR /etc/samba/smb.conf ;}
cfg-simple-movie-catalog() { $EDITOR ~/.scripts/SimpleMovieCatalog/config.txt ;}
cfg-skippyxd() { $EDITOR ~/.skippy-xd.rc ;}
cfg-sourcelist() { sudo $EDITOR /etc/apt/sources.list ;}
cfg-ssh-client() { sudo $EDITOR /etc/ssh/ssh_config ;}
cfg-ssh-daemon() { sudo $EDITOR /etc/ssh/sshd_config ;}
cfg-sudoers() { sudo $EDITOR /etc/sudoers ;}
cfg-surfraw() { $EDITOR ~/.config/surfraw/bookmarks ;}
cfg-surfraw-conf() { $EDITOR ~/.config/surfraw/conf ;}
cfg-timidity() { sudo $EDITOR /etc/timidity++/timidity.cfg ;}
cfg-tmuxrc() { $EDITOR ~/.tmux.conf ;}
cfg-tpb() { $EDITOR ~/.scripts/shellscripts/thepiratebay_se/tpb.sh ;}
cfg-transmission-daemon() { $EDITOR ~/.config/transmission-daemon/settings.json ;}
cfg-transmission-ncurse() { $EDITOR ~/.config/transmission-remote-cli/settings.cfg ;}
cfg-trz() { $EDITOR ~/.scripts/shellscripts/torrentz_eu/torrentz_eu.sh ;}
cfg-turses() { $EDITOR ~/.turses/config ;}
cfg-urlview() { $EDITOR ~/.urlview ;}
cfg-updatedb() { sudo $EDITOR /etc/updatedb.conf ;}
cfg-vifmrc() { $EDITOR ~/.vifm/vifmrc ;}
cfg-vimrc() { $EDITOR ~/.vimrc ;}
cfg-vlcrc() { $EDITOR ~/.config/vlc/vlcrc ;}
cfg-w3m() { $EDITOR ~/.w3m/config ;}
cfg-w3m-keymap() { $EDITOR ~/.w3m/keymap ;}
cfg-xdefaults() { $EDITOR ~/.Xdefaults ;}
cfg-xinitrc() { $EDITOR ~/.xinitrc ;}
cfg-xmodmap() { $EDITOR ~/.Xmodmap ;}
cfg-xrdp() { sudo $EDITOR /etc/xrdp/xrdp.ini ;}
cfg-xrdp-xsession() { $EDITOR ~/.xsession ;}
cfg-xresources() { $EDITOR ~/.Xresources ;}
cfg-zshrc() { $EDITOR ~/.zshrc ;}
#}}}
#-------- Configurations Reload {{{
#------------------------------------------------------
rld-bashrc() { source ~/.bashrc ;}
rld-screenlayout() { ~/.screenlayout/reload_monitor.sh ;}
rld-updatedb() { sudo updatedb ;}
rld-xdefaults() { xrdb ~/.Xdefaults ;}
rld-xmodmap() { xmodmap ~/.Xmodmap ;}
rld-xresources() { xrdb -load ~/.Xresources ;}
rld-zshrc() { source ~/.zshrc ;}
# }}}
#-------- Functions {{{
#------------------------------------------------------
# call vim help page from shell prompt
function :h { vim +":h $1" +'wincmd o' +'nnoremap q :q!<CR>' ;}
# searches for manual locally or online
manned() { for arg in "$@"; do man $arg 2> /dev/null \
|| $arg -H 2> /dev/null || $arg -h 2> /dev/null \
|| $arg --help-all 2> /dev/null || $arg --help 2> /dev/null \
|| help $arg 2> /dev/null \
|| $BROWSERCLI "http://manned.org/browse/search?q=$@" 2> /dev/null \
|| $BROWSER "http://manned.org/browse/search?q=$@" 2> /dev/null \
|| open "http://manned.org/browse/search?q=$@" 2> /dev/null \
|| xdg-open "http://manned.org/browse/search?q=$@" ; done ;}
# convert video to avi container
# usage: vid2avi file.mpg
vid2avi() { ffmpeg -i "$1" -vcodec mpeg4 -sameq "${1%.*}.vid2avi.avi" ;}
# quickly cd out of directories using numbers
up() { local x='';for i in $(seq ${1:-1});do x="$x../"; done;cd $x; }
# convert youtube to mp3
yt2mp3() { youtube-dl -c --restrict-filenames --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" $@ ;}
# python calculator
# press Ctrl+D to quit
# http://docs.python.org/library/math.html
# tutorial video: http://www.youtube.com/watch?v=JkyodHenTuc
calc() { python2 -ic "from __future__ import division; from math import *; from random import *" ;}
# change font size (guake terminal)
# tutorial video: http://www.youtube.com/watch?v=i9aKFgxOjwQ
chfontsize() {
# guake
gconftool-2 --set '/apps/guake/style/font/style' --type string "Monospace ${1:-14}"
#gnome-terminal
dconf write /org/gnome/terminal/legacy/profiles:/$(dconf list /org/gnome/terminal/legacy/profiles:/)font "'Monospace ${1:-14}'"
}
# search commandlinefu.com
cmdfu() { curl "http://www.commandlinefu.com/commands/matching/$(echo "$@" \
| sed 's/ /-/g')/$(echo -n $@ | base64)/plaintext" ;}
# display one random command from commandlinefu.com
cmdfu-random() { echo -e "`curl -sL http://www.commandlinefu.com/commands/random/json|sed -re 's/.*,"command":"(.*)","summary":"([^"]+).*/\\x1b[1;32m\2\\n\\n\\x1b[1;33m\1\\x1b[0m/g'`\n" ;}
# check if a website is down
# usage: down4me google.com
down4me() { curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g';}
# combine multiple pdf files into a single pdf file
# tutorial video: http://www.youtube.com/watch?v=eQoOk5Xbt3M
combine-pdf() { gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=combinedpdf_`date +'%F_%Hh%M'`.pdf -f "$@" ;}
# extract pdf pages
# http://www.linuxjournal.com/content/tech-tip-extract-pages-pdf
pdfpextr()
{
# this function uses 3 arguments:
# $1 is the first page of the range to extract
# $2 is the last page of the range to extract
# $3 is the input file
# output file will be named "inputfile_pXX-pYY.pdf"
# example: pdfpextr 22 36 inputfile.pdf
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \
-dFirstPage=${1} \
-dLastPage=${2} \
-sOutputFile=${3%.pdf}_p${1}-p${2}.pdf \
${3}
}
# combine multiple avi files into a single avi file
# tutorial video: https://www.youtube.com/watch?v=EAWGFJoZXAU
combine-avi() { avimerge -o combineavi_`date +'%F_%Hh%M'`.avi -i "$@" ;}
# convert doc/docx to pdf (dont upload sensitive data)
# tutorial video: http://www.youtube.com/watch?v=r90IdQwF-hs
doc2pdf() { curl -# -F inputDocument=@"$1" http://www.doc2pdf.net/convert/document.pdf > "${1%.*}.pdf" ;}
# get the chmod stats of the files
# https://bbs.archlinux.org/viewtopic.php?pid=1280296#p1280296
getmod () { stat --format "%n %a" $* | column -t; }
mkdircd() { mkdir -p -v $1; cd $1 ;} # create folder then cd into it
cpbak() { cp $1{,.bak} ;} # create backup copy
open() { xdg-open "$@" > /dev/null 2>&1 ;}
string-lowercase() { echo "$@" | tr '[:upper:]' '[:lower:]' ;} # converts string to lowercase
# w3m browser with inline images
# https://plus.google.com/102499719144563443986/posts/Vja8W69iHoi
# tutorial video: http://www.youtube.com/watch?v=R2bMUtCOGko
w3mimg() { w3m -o imgdisplay=/usr/lib/w3m/w3mimgdisplay $1 ;}
# mplayer to display webcam; hit 's' to take screenshot
# https://wiki.archlinux.org/index.php/Webcam_Setup#MPlayer
# http://www.amazon.com/Logitech-960-000581-C260-Webcam/dp/B003LVZO8I
# 16:9 ; 1280x720 ; 3MP picture;
webcam-mplayer() { mplayer tv:// -tv driver=v4l2:width=1280:height=720:device=/dev/video0 -fps 30 -vf screenshot ;}
single-to-doubles() {
# works in bash only
for i in ?.jpg; do mv $i 0$i; done
for i in ?.png; do mv $i 0$i; done
for i in ?.PNG; do mv $i 0$i; done
}
doubles-to-triples() {
for i in ??.jpg; do mv $i 0$i; done
for i in ??.png; do mv $i 0$i; done
}
#}}}
#-------- FFMPEG X11GRAB Screencasting {{{
#------------------------------------------------------
# tutorial video: http://www.youtube.com/watch?v=mNz5Lrc06_s
# compile ffmpeg: http://ubuntuforums.org/showthread.php?t=786095
# https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide
# proper screencast: http://ubuntuforums.org/showthread.php?t=1392026
# http://nowardev.wordpress.com/2011/05/23/how-to-screencast/
# https://github.com/gotbletu/shownotes/blob/master/ffmpeg_x11grab_screencast.txt
# https://dl.dropboxusercontent.com/u/28788188/cast.sh (Xpander69)
# https://support.google.com/youtube/answer/1722171?hl=en
# credit: verb3k, MocoPoloX, FakeOutdoorsman, Xpander69
# press q to quit
# Screencasting Variables# {{{
# package select (avconv or ffmpeg)
# FF_RECORDER=/usr/bin/ffmpeg
FF_RECORDER=~/Compile/ffmpeg/bin/ffmpeg
# SoundCard (pulse for pulseaudio; install pavucontrol to change pulse settings)
# hw:0,1 for directly communicating with your soundcard
# to get a list of sound device:
# arecord -l
# aplay -l
# cat /proc/asound/pcm
# alsamixer and hit F6
# FF_SOUNDCARD=pulse
# FF_SOUNDCARD=hw:0,1
FF_SOUNDCARD=hw:2,0
# FF_SOUNDCARD=hw:0,3
# How many threads used (0 for automatic)
FF_THREADS=0
# Resolution (use xrandr to find your resolution or use xwininfo to auto find your resolution)
#FF_RESO_MON1=1680x1050
#FF_RESO_MON2=1920x1080
#FF_RESO_FULL=$(xwininfo -root | grep 'geometry' |awk '{print $2;}' | cut -d\+ -f1)
#FF_RESO_ALL=$(xwininfo -root | grep 'geometry' |awk '{print $2;}') #older version
# Xserver Display number(:0.0 is default; use offset for other monitor :0.0+X,Y)
FF_XDISP=:0.0
FF_XDISP_MON2=:0.0+1680,0
# Audio Device
FF_AUDIO=alsa
# Channels (Mono = 1; Dual = 2 ; dual for most devices)
FF_CHANNELS=1
# FF_CHANNELS=2
# Frames per second
FF_FPS=30
# Constant Rate Factor(0 = highest quality; 50 = lowest)
# CRF=22
FF_CRF=0
# libx264 presets (slow, fast, superfast, ultrafast; run "x264 -h" and go to preset section for more)
# additionaly run "sudo find /usr -iname '*.ffpreset'" for others
FF_PRESET=ultrafast
# Video Codec
FF_VCODEC=libx264
# Compatibility ( yuv444p for H.264, yuv420p for compatibility with outdated media players )
FF_PIXFMT=yuv444p
# Audio Codec (libmp3lame, pcm_s16le or libvorbis are most common)
# ACODEC=libvorbis
# ACODEC=pcm_s16le
FF_ACODEC=libmp3lame
# Directory where your video is gonna be saved.(include / at the end)
# DIRECTORY=$HOME/Public/
FF_DIRECTORY=$PATH_SCREENCAST/
# File name
# FILENAME=videocast`$DATE +%d%m%Y_%H.%M.%S`.mkv
FF_FILENAME=aa_screencast_baking.mkv
# ======== OPTIONAL ========
# Scale Video on the fly
# I use this for youtube since my Monitor is 1680x1050 and Youtube 720p video is 1280x720; so i scale down the resolution
# This avoids black bars on left and right side (non-fullscreen); on "fullscreen" the black bars are on top and bottom
# orginal flag: -vf scale=1280:720
FF_SCALE="scale=1280:720"
# Overwrite Output File; ( -y = yes ; -n = no )
# This only works if you use the same filename
FF_OVERWRITE="-y"
# ==========================
# }}}
# Screencasting Commands# {{{
# Monitor 1 = Benq LCD with Scaling 1680x1050 --> 1280x720 Youtube 720p
ffcast_benq() { $FF_RECORDER -f $FF_AUDIO -ac $FF_CHANNELS -i $FF_SOUNDCARD -async 1 -f x11grab -r $FF_FPS -s $FF_RESO_MON1 -i $FF_XDISP -vcodec $FF_VCODEC -pix_fmt $FF_PIXFMT -preset $FF_PRESET -crf $FF_CRF -acodec $FF_ACODEC -ab 128k -threads $FF_THREADS -vf $FF_SCALE $FF_OVERWRITE $FF_DIRECTORY$FF_FILENAME ;}
# Monitor 2 = Proscan LED TV; 1080p - 1920x1080
ffcast_proscantv() { $FF_RECORDER -f $FF_AUDIO -ac $FF_CHANNELS -i $FF_SOUNDCARD -async 1 -f x11grab -r $FF_FPS -s $FF_RESO_MON2 -i $FF_XDISP_MON2 -vcodec $FF_VCODEC -pix_fmt $FF_PIXFMT -preset $FF_PRESET -crf $FF_CRF -acodec $FF_ACODEC -ab 128k -threads $FF_THREADS $FF_OVERWRITE $FF_DIRECTORY$FF_FILENAME ;}
# fullscreen
ffcast_full() { $FF_RECORDER -f $FF_AUDIO -ac $FF_CHANNELS -i $FF_SOUNDCARD -async 1 -f x11grab -r $FF_FPS -s $FF_RESO_FULL -i $FF_XDISP -vcodec $FF_VCODEC -pix_fmt $FF_PIXFMT -preset $FF_PRESET -crf $FF_CRF -acodec $FF_ACODEC -ab 128k -threads $FF_THREADS $FF_OVERWRITE $FF_DIRECTORY$FF_FILENAME ;}
# }}}
# ------ old examples ------# {{{
#E1: ffmpeg -f alsa -ac 2 -i hw:0,1 -f x11grab -r 30 -s 1280x1024 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 out.avi
#E2: avconv -f alsa -i pulse -f x11grab -r 25 -s 1920x1080 -i :0.0 -vcodec mpeg4 -b 12000k -g 300 -bf 2 -acodec libmp3lame -ab 256k out.avi
#E3: ffmpeg -threads 0 -f alsa -i pulse -f x11grab -s 1280x720 -r 30 -i :0.0+0,0 -vcodec libx264 -preset superfast -crf 16 -acodec libmp3lame -ab 256k -ar 44100 -f mp4 out.mp4
#E4: ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -i :0.0 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -crf 0 -threads 0 -y out.mkv
#E5: (select window); ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s $(xwininfo -frame | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+') -i :0.0+$(xwininfo -frame | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' | grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' ) -acodec pcm_s16le -vcodec libx264 -preset ultrafast -crf 0 -threads 0 -y out.mkv
#E6: ffmpeg -f alsa -ac 2 -i hw:3,0 -async 1 -f x11grab -r 30 -s 1280x1024 -i :0.0 -vcodec libx264 -pix_fmt yuv444p -preset ultrafast -crf 0 -acodec libmp3lame -ab 128k -threads 0 -vf 800x600 -y out.mkv ;}
# --------------------------# }}}
#}}}
#-------- Fasd {{{
#------------------------------------------------------
# jump/open recent files and folder quickly
# https://github.com/clvv/fasd
# tutorial video: http://www.youtube.com/watch?v=ur81Y-mV5Us
if which fasd >/dev/null; then
eval "$(fasd --init auto)" # get fasd working, initialization code
alias m='f -e $PLAYER' # open with video player
alias o='a -e $OPENER' # open any file
alias v='f -e $EDITOR' # open with text editor
fi
#}}}
#-------- Plowshare {{{
#------------------------------------------------------
# d/l cyberlocker files like rapidshare, mediafire ..etc
# tutorial video: http://www.youtube.com/watch?v=5AzFdX-EyeI
# http://code.google.com/p/plowshare/
# PPA: https://launchpad.net/~plowsharepackagers
plowdown-depositfiles() { plowdown -r 3 --max-rate 900K -m ~/.config/plowshare/depositfiles.txt ;}
plowdown-uploaded() { plowdown -r 3 --max-rate 900K -m ~/.config/plowshare/uploaded.txt ;}
plowdown-netloadin() { plowdown -r 3 --max-rate 900K -m ~/.config/plowshare/netloadin.txt ;}
plowdown-rapidgator() { plowdown -r 3 --max-rate 900K -m ~/.config/plowshare/rapidgator.txt ;}
plowdown-rapidshare() { plowdown -r 3 --max-rate 900K -m ~/.config/plowshare/rapidshare.txt ;}
plowdown-random() { plowdown -r 3 --max-rate 900K -m ~/.config/plowshare/random.txt ;}
#}}}
#-------- Simple HTTP Server {{{
#------------------------------------------------------
# python http server
# tutorial video: http://www.youtube.com/watch?v=FFIjMYzkHhc
# default port = 8000
alias SimpleHTTPServer2="python2 -m SimpleHTTPServer"
alias SimpleHTTPServer3="python3 -m http.server"
# http://ubuntuguide.net/http-server-support-uploading-files-from-windows-in-ubuntu
# wget http://bones7456.googlecode.com/svn/trunk/SimpleHTTPServerWithUpload.py
# tutorial video: http://www.youtube.com/watch?v=au8DlTAHx5o
SimpleHTTPServerWithUpload() { python2 ~/.scripts/SimpleHTTPServerWithUpload.py ;}
#}}}
#-------- Ubooquity Comic Server # {{{
#------------------------------------------------------
# tutorial Video: https://www.youtube.com/watch?v=qfLG9nKt3ew
# http://vaemendis.net/ubooquity/
PATH_UBOOQUITY=~/.scripts/ubooquity
ubooquity() { cd $PATH_UBOOQUITY && nohup java -jar $PATH_UBOOQUITY/Ubooquity.jar -webadmin -headless >/dev/null 2>&1& }
ubooquity-gui() { cd $PATH_UBOOQUITY && nohup java -jar $PATH_UBOOQUITY/Ubooquity.jar -webadmin >/dev/null 2>&1& }
ubooquity-quit() { kill $(ps -ef | grep '[U]booquity.jar' | awk '{print $2}') ;}
ubooquity-status() {
if ps -ef | grep '[U]booquity.jar' > /dev/null
then
echo "Ubooquity is running on http://localhost:2202"
echo "To change settings use http://localhost:2202/admin"
else
echo "Ubooquity has stopped"
fi
}
# }}}
#-------- Transmission CLI {{{
#------------------------------------------------------
# lightweight torrent daemon, has option for cli, webui, ncurses, and gui frontend
# tutorial video: http://www.youtube.com/watch?v=ee4XzWuapsE
# WebUI: http://localhost:9091/transmission/web/
# http://192.168.1.xxx:9091/transmission/web/
tsm-clearcompleted() {
transmission-remote -l | grep 100% | grep Done | \
awk '{print $1}' | xargs -n 1 -I % transmission-remote -t % -r ;}
tsm() { transmission-remote --list ;}
# numbers of ip being blocked by the blocklist
# credit: smw from irc #transmission
tsm-count() { echo "Blocklist rules:" $(curl -s --data \
'{"method": "session-get"}' localhost:9091/transmission/rpc -H \
"$(curl -s -D - localhost:9091/transmission/rpc | grep X-Transmission-Session-Id)" \
| cut -d: -f 11 | cut -d, -f1) ;}
# tutorial video: http://www.youtube.com/watch?v=TyDX50_dC0M
tsm-blocklist() { ~/.scripts/blocklist.sh ;} # update blocklist
tsm-daemon() { transmission-daemon ;}
tsm-quit() { killall transmission-daemon ;}
tsm-altdownloadspeed() { transmission-remote --downlimit "${@:-900}" ;} # upload default to 900K, else enter your own
tsm-altdownloadspeedunlimited() { transmission-remote --no-downlimit ;}
tsm-limitupload() { transmission-remote --uplimit "${@:-10}" ;} # upload default to 10kpbs, else enter your own
tsm-limituploadunlimited() { transmission-remote --no-uplimit ;}
tsm-add() { transmission-remote --add "$1" ;}
tsm-askmorepeers() { transmission-remote -t"$1" --reannounce ;}
tsm-pause() { transmission-remote -t"$1" --stop ;} # <id> or all
tsm-start() { transmission-remote -t"$1" --start ;} # <id> or all
tsm-purge() { transmission-remote -t"$1" --remove-and-delete ;} # delete data also
tsm-remove() { transmission-remote -t"$1" --remove ;} # leaves data alone
tsm-info() { transmission-remote -t"$1" --info ;}
tsm-speed() { while true;do clear; transmission-remote -t"$1" -i | grep Speed;sleep 1;done ;}
tsm-grep() { transmission-remote --list | grep -i "$1" ;}
# https://github.com/fagga/transmission-remote-cli
# tutorial video: http://www.youtube.com/watch?v=hLz7ditUwY8
tsm-ncurse() { transmission-remote-cli ;}
#}}}
#-------- iPod 5G Device {{{
#------------------------------------------------------
# convert to ipod 5g compatible video format
# tutorial video: http://www.youtube.com/watch?v=gVVeR9KizBk
ipod5g() { HandBrakeCLI -i "$1" -o "${1%.*}.ipod5g.mp4" --preset="iPod" ;}
ipod5g-tsp() { tsp HandBrakeCLI -i "$1" -o "${1%.*}.ipod5g.mp4" --preset="iPod" ;}
ipod5g-rsync() {
# https://gist.github.com/nekobato/5998548
# including trailing slashes on $SRC
# rsync $SRC/Music/ $DEST/media/Ipod
rsync -avrm --delete-excluded --modify-window=2 --include '*/' --include '*.mp3' --exclude '*' "$1" "$2"
}
tsp-handbrake-normal() { tsp HandBrakeCLI -i "$1" -o "${1%.*}.normal.mp4" --preset="Normal" ;}
tsp-handbrake-high() { tsp HandBrakeCLI -i "$1" -o "${1%.*}.high.mp4" --preset="High Profile" ;}
# }}}
#-------- Sopcast CLI {{{
#------------------------------------------------------
# tutorial Video: http://www.youtube.com/watch?v=Dm7cFjhzgHo
# http://forum.wiziwig.eu/forums/14-Sopcast
# http://www.sopcast.com/chlist.xml
# http://sopcast.ucoz.com
# http://streams.magazinmixt.ro
# google keyword: sop://broker.sopcast
# install sopcast commandline version
# Archlinux: sopcast ( x64 https://www.archlinux.org/packages/multilib/x86_64/sopcast/)
# Archlinux: sopcast ( x32 https://www.archlinux.org/packages/community/i686/sopcast/)
# Ubuntu/Debian: sp-auth (https://launchpad.net/~jason-scheunemann/+archive/ppa)
# choose a players (cvlc is default)
# SP_VIDPLAYER=cvlc
SP_VIDPLAYER=(cvlc --file-caching=10000)
# SP_VIDPLAYER=vlc
# SP_VIDPLAYER=(vlc --control=lirc)
# SP_VIDPLAYER=mplayer
# SP_VIDPLAYER=(mplayer -cache 1000)
# wait X seconds to stabilize channel (make it longer if u got slower connection)
SP_SLEEP=15
# sopcast port and player port
SP_LOCAL_PORT=55050
SP_PLAYER_PORT=55051
# manually kill sopcast (sometimes it doesnt exit properly and still uses bandwidth in the background)
sppc-kill() { killall sp-sc ;}
# kills existing connection, starts a new connection, sleep X sec to stabilize the stream, waits to player to exit and kill itself
sppc() {
killall sp-sc &>/dev/null
(sp-sc "$1" $SP_LOCAL_PORT $SP_PLAYER_PORT &>/dev/null &)
sleep $SP_SLEEP
($SP_VIDPLAYER http://localhost:$SP_PLAYER_PORT)
wait
killall sp-sc
}
#### eng = english, ro = romanian, esp = espanol/spanish
# added on February 06, 2014
spp-doc-explorer.eng,ro() { sppc "sop://broker.sopcast.com:3912/149269" ;}
spp-doc-history.eng,ro() { sppc "sop://broker.sopcast.com:3912/148253" ;}
spp-doc-history2.eng,ro() { sppc "sop://broker.sopcast.com:3912/149268" ;}
spp-doc-natgeo.eng,ro() { sppc "sop://broker.sopcast.com:3912/148248" ;}
spp-doc-natgeowild.eng,ro() { sppc "sop://broker.sopcast.com:3912/148259" ;}
spp-doc-nature.eng,ro() { sppc "sop://broker.sopcast.com:3912/149267" ;}
spp-movie-hbo.eng,ro() { sppc "sop://broker.sopcast.com:3912/148883" ;}
spp-movie-hbo2.eng,ro() { sppc "sop://broker.sopcast.com:3912/120702" ;}
spp-tv-universal.eng,ro() { sppc "sop://broker.sopcast.com:3912/148255" ;}
spp-tv-axn.eng,ro() { sppc "sop://broker.sopcast.com:3912/148257" ;}
spp-tv-axncrime.eng,ro() { sppc "sop://broker.sopcast.com:3912/149261" ;}
#}}}
#-------- Capture RTMP Streams {{{
#------------------------------------------------------
# tutorial video: http://www.youtube.com/watch?v=u1dQ81HT4AU
# https://github.com/gotbletu/shownotes/blob/master/rtmpdump_sniff_your_own_tutorial.txt
# http://pclosmag.com/html/Issues/201104/page19.html
sniff-begin() { sudo iptables -t nat -A OUTPUT -p tcp --dport 1935 -m owner \! --uid-owner root -j REDIRECT ;}
sniff-capture-rtmpsrv() { rtmpsrv ;}
sniff-capture-rtmpsuck() { rtmpsuck ;}
sniff-end() { sudo iptables -t nat -D OUTPUT -p tcp --dport 1935 -m owner \! --uid-owner root -j REDIRECT ;}
tsniff-begin() { sudo tcpdump -ieth0 -nn -A | grep -e"rtmp" -e"connect" -e"play" > /tmp/tcpoutput.txt ;}
tsniff-less() { less /tmp/tcpoutput.txt ;}
#}}}
#-------- Internet Videos - Porn {{{
#------------------------------------------------------
# requirements:
# 1. install mplayer vim youtube-dl
# 2. add this to your ~/.vimrc
# map <F8> :exec '!mplayer $(youtube-dl -g ' . shellescape(getline('.')) . ')' <CR><CR>
# how to use:
# 1. fap-youporn ashlynn brooke
# note: if it doesnt play, try hitting right arrow key
# 2. hit F8 on the link you want to play
# 3. q to quit mplayer
# 4. hit ZZ to quit vim
fap-youporn() {
grepmatch=$(echo "$@" | sed 's/ /.*/g')
keyword="$(echo "http://www.youporn.com/search?query=$@&type=straight" | sed 's/ /\+/g')"
pagenum=3
pagenum_to_url=$(for num in $(seq 1 "$pagenum"); do echo "$keyword&page=$num"; done )
videourl=$(echo "$pagenum_to_url" | while read line; do lynx -dump "$line" \
| awk '/watch/ {print $2}' | cut -d\/ -f1-6 | grep -iE $grepmatch | awk '!x[$0]++' ; done)
echo $videourl | sed 's/\ /\n/g' | awk '!x[$0]++' | vim -R -
}
fap-youjizz() {
keyword="$(echo "http://www.youjizz.com/search/$@" | sed 's/ /\-/g')"
pagenum=5
pagenum_to_url=$(for num in $(seq 1 "$pagenum"); do echo "$keyword-$num".html""; done )
videourl=$(echo "$pagenum_to_url" | while read line; do lynx -dump "$line" \
| awk '/\.com\/videos/ {print $2}' | awk '!x[$0]++' ; done)
echo $videourl | sed 's/\ /\n/g' | awk '!x[$0]++' | vim -R -
}
fap-pornotube() {
keyword="$(echo "http://www.pornotube.com/search.php?q=$@" | sed 's/ /\+/g')"
pagenum=3
pagenum_to_url=$(for num in $(seq 1 "$pagenum"); do echo "$keyword&page=$num"; done )
videourl=$(echo "$pagenum_to_url" | while read line; do curl -s "$line" \
| awk '/pornotube.com\/m/ && !/class/' | cut -d\" -f 2 | awk '!x[$0]++' ; done)
echo $videourl | sed 's/\ /\n/g' | awk '!x[$0]++' | vim -R -
}
fap-xvideos() {
keyword="$(echo "http://www.xvideos.com/?k=$@" | sed 's/ /\+/g')"
pagenum=5
pagenum_to_url=$(for num in $(seq 1 "$pagenum"); do echo "$keyword&p=$num"; done )
videourl=$(echo "$pagenum_to_url" | while read line; do lynx -dump "$line" \
| awk '/xvideos\.com\/video/ {print $2}' | awk '!x[$0]++' ; done)
echo $videourl | sed 's/\ /\n/g' | awk '!x[$0]++' | vim -R -
}
fap-jizzhut() {
keyword="$(echo "http://www.jizzhut.com/search/$@" | sed 's/ /\-/g')"
pagenum=3
pagenum_to_url=$(for num in $(seq 1 "$pagenum"); do echo "$keyword-$num.html"; done )
videourl=$(echo "$pagenum_to_url" | while read line; do lynx -dump "$line" \
| awk '/jizzhut\.com\/videos/ {print $2}' | awk '!x[$0]++' ; done)
echo $videourl | awk '!x[$0]++' | vim -R -
}
fap-redtube() {
keyword="$(echo "http://www.redtube.com/?search=$@" | sed 's/ /\+/g')"
pagenum=3
pagenum_to_url=$(for num in $(seq 1 "$pagenum"); do echo "$keyword&page=$num"; done )
videourl=$(echo "$pagenum_to_url" | while read line; do lynx -source "$line" \
| awk -F\" '/class="s"/ {print $4, "http://redtube.com"$2}' | awk '!x[$0]++' ; done)
echo $videourl | awk '!x[$0]++' | vim -R -
}
fap-spankwire() {
keyword="$(echo "http://www.spankwire.com/search/straight/keyword/$@" | sed 's/ /\%20/g')"
pagenum=5
pagenum_to_url=$(for num in $(seq 1 "$pagenum"); do echo "$keyword?Sort=Relevance&Page=$num"; done )
videourl=$(echo "$pagenum_to_url" | while read line; do lynx -dump "$line" \
| awk '/www\.spankwire\.com/ && /video/ {print $2}' | awk '!x[$0]++' ; done)
echo $videourl | sed 's/\ /\n/g' | vim -R -
}
# quvi not supported anymore
fap-tnaflix() {
keyword="$(echo "&what=$@&category=&sb=relevance&su=anytime&sd=all&dir=desc" | sed 's/ /\%20/g')"
pagenum=3
pagenum_to_url=$(for num in $(seq 1 "$pagenum"); do echo \
"http://www.tnaflix.com/search.php?page=$num$keyword"; done )
videourl=$(echo "$pagenum_to_url" | while read line; do lynx -dump "$line" \
| awk '/video[0-9]/ {print $2}' | awk '!x[$0]++' ; done)
echo $videourl | sed 's/\ /\n/g' | vim -R -
}
fap-empflix() {
keyword="$(echo "&what=$@&category=&sb=relevance&su=anytime&sd=all&dir=desc" | sed 's/ /\%20/g')"
pagenum=3
pagenum_to_url=$(for num in $(seq 1 "$pagenum"); do echo \
"http://www.empflix.com/search.php?page=$num$keyword"; done )
videourl=$(echo "$pagenum_to_url" | while read line; do lynx -dump "$line" \
| awk '/empflix\.com\/videos/ {print $2}' | awk '!x[$0]++' ; done)
echo $videourl | sed 's/\ /\n/g' | vim -R -
}
#}}}
#-------- Youtube Viewer {{{
#------------------------------------------------------
# tutorial video: http://www.youtube.com/watch?v=FnJ67oAxVQ4
# watch/login/comment/search/download...etc video on youtube, all from cli
# https://github.com/trizen/youtube-viewer
yt-listen() { youtube-viewer -n $@ ;} # no video, music/audio only
yt-music() { youtube-viewer -n --category=Music --top ;} # show top music list
yts-movie-movieclipstrailer() { youtube-viewer -u UCi8e0iOVk1fEOogdfu4YgfA ;}
yts-amcmovietalk() { youtube-viewer -p PLBFB97E5B9494EEBD ;}
yts-amcmovietalk-mailbag() { youtube-viewer -p PLYNW0PN4_jrqlBqzAVRv3rfpo6nhzJnKp ;}
yts-amctheatres() { youtube-viewer -u amctheatres ;}
yts-afterbuzz-arrowaftershow() { youtube-viewer -p PL6THzna6gLceNeZoXKUOoDeO7cwI57rJn ;}
yts-afterbuzz-gameofthrones() { youtube-viewer -p PL0404DAD1AD037666 ;}
yts-afterbuzz-revolution() { youtube-viewer -p PL6THzna6gLccSY_0Cmoy6DvfH0iC8fyLR ;}
yts-arrowaftershow-johncampea() { youtube-viewer -p PLGYmtexynt_Egz8kNR1HbA2kiRzhM0FKv ;}
yts-alwayson() { youtube-viewer "Always On" --author=CNETTV --orderby=published --duration=long ;}
yts-btt-beyondthetrailer() { youtube-viewer -u beyondthetrailer ;}
yts-btt-thinkabouttheink() { youtube-viewer -u thinkabouttheink ;}
yts-cannatajeff() { youtube-viewer -u cannatajeff ;}
yts-comic-watchmojo() { youtube-viewer -u watchmojo ;}
yts-game-cinemassacre() { youtube-viewer -u cinemassacre ;}
yts-game-craigslistgamefinds() { youtube-viewer -u craigslistgamefinds ;}
yts-game-happyconsolegamer() { youtube-viewer -u happyconsolegamer ;}
yts-game-jamesnintendonerd() { youtube-viewer -u jamesnintendonerd ;}
yts-game-metaljesusrocks() { youtube-viewer -u metaljesusrocks ;}
yts-game-mcfrosticles() { youtube-viewer -u mcfrosticles ;}
yts-game-retroliberty() { youtube-viewer -u retroliberty ;}
yts-greatmilitarybattles() { youtube-viewer -u greatmilitarybattles ;}
yts-greentvgreentv() { youtube-viewer -u greentvgreentv ;}
yts-homeorganizing() { youtube-viewer -u homeorganizing ;}
yts-lifehacker() { youtube-viewer -u lifehacker ;}
yts-linuxgamecast() { youtube-viewer -u linuxgamecast ;}
yts-jupiterbroadcasting() { youtube-viewer -u jupiterbroadcasting ;}
yts-minimalism-carriesimple() { youtube-viewer -u UCtauuxrTG1yon8CNsgqhDkg ;}
yts-minimalism-poetskinny() { youtube-viewer -u UC4O0Vd3UxFXGX-UQNelwTag ;}
yts-minimalism-ticoandtina() { youtube-viewer -u ticoandtina ;}
yts-minimalism-unconventionalliving() { youtube-viewer -u UC7uuFb0QztC-yC2CrcS-lJw ;}
yts-minimalism-zenminimalism() { youtube-viewer -u UCpD5Hqe60AJ79fupvuA6F1Q ;}
yts-midwaysimplicity() { youtube-viewer -u midwaysimplicity ;}
yts-midwaysimplicity-mtohami() { youtube-viewer -u mtohami ;}
yts-mma-arielhelwani() { youtube-viewer -u arielhelwani ;}
yts-mma-fueltv() { youtube-viewer -u fueltv ;}
yts-mma-gracieacademy() { youtube-viewer -u gracieacademy ;}
yts-mma-graciebreakdown() { youtube-viewer -u graciebreakdown ;}
yts-mma-karynbryant() { youtube-viewer -u karynbryant ;}
yts-mma-mmaheat() { youtube-viewer -u mmaheat ;}
yts-mma-mmafightingonsbn() { youtube-viewer -u mmafightingonsbn ;}
yts-mma-thefightnetwork() { youtube-viewer -u thefightnetwork ;}
yts-mma-themmanuts() { youtube-viewer -u themmanuts ;}
yts-mma-ufc() { youtube-viewer -u ufc ;}
yts-mma-uncutsports() { youtube-viewer -u uncutsports ;}
yts-peakmoment() { youtube-viewer -u peakmoment ;}
yts-poetskinny() { youtube-viewer -u poetskinny ;}
yts-PoetskinnyUnleashed() { youtube-viewer -u PoetskinnyUnleashed ;}
yts-tinyhouse-kirstendirksen() { youtube-viewer -u kirstendirksen ;}
yts-tinyhouse-livingbigtinyhouse() { youtube-viewer -u livingbigtinyhouse ;}
yts-tinyhouse-relaxshacksDOTcom() { youtube-viewer -u relaxshacksDOTcom ;}
yts-tinyhouse-tinyhousegj() { youtube-viewer -u tinyhousegj ;}
yts-tmw-askhodgetwins() { youtube-viewer -u askhodgetwins ;}
yts-tmw-fastingtwins() { youtube-viewer -u fastingtwins ;}
yts-tmw-getfit4women() { youtube-viewer -u getfit4women ;}
yts-tmw-hodgetwins() { youtube-viewer -u hodgetwins ;}
yts-tmw-hodgetwinsonsports() { youtube-viewer -u hodgetwinsonsports ;}
yts-tmw-twinmuscleworkout() { youtube-viewer -u twinmuscleworkout ;}
yts-walkingdead() { youtube-viewer -p PLC7EC9FB2E211A261 ;}
yts-walkingdead-talkingdead() { youtube-viewer -p PLP63B9XPsQt3H_5xGXifFxFJE7-RsKFb6 ;}
yts-walkingdead-webisodes() { youtube-viewer -p PLC09448134D906619 ;}
yts-wwefannation() { youtube-viewer -u wwefannation ;}
## }}}
#-------- i3 / Openbox {{{
#------------------------------------------------------
# wallpaper path
PATH_WALLPAPER=~/Pictures/Wallpapers
chwallpaper() {
# http://askubuntu.com/a/125066
# http://askubuntu.com/a/227669
CURRENT_WM="$(wmctrl -m | grep "Name:" | awk '{print $2}')"
# i3
if [ $DESKTOP_SESSION = i3 ]; then
feh --randomize --bg-fill "$PATH_WALLPAPER"/*