CLI config/dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

221 lines
10 KiB

  1. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. # .aliases
  3. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. # Alias definitions for interactive shells. Should be able to be sourced from
  5. # (at least) bash and zsh rc files.
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  8. # Host-agnostic aliases
  9. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  10. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11. # Getting around
  12. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13. alias u='cd ..'
  14. alias back='cd "$OLDPWD"'
  15. alias ls='ls --literal'
  16. alias ll='ls -lh'
  17. alias la='ls -A'
  18. alias list='ls -lhA'
  19. alias tree='tree -Chug'
  20. alias ds='du -hsc * | sort -h'
  21. alias rs='rsync -avhP'
  22. alias Grep='grep -i'
  23. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24. # Safety
  25. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26. alias mv='mv -i'
  27. alias cp='cp -i'
  28. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  29. # Avoid graphical environments when possible
  30. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  31. alias truecrypt='truecrypt -t'
  32. alias veracrypt='veracrypt -t'
  33. if [[ "${DISPLAY}" == localhost:?*.0 ]]; then
  34. alias vim='/usr/bin/vim -display localhost:0' # keep from launching X11 on OS X over SSH sessions
  35. fi
  36. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  37. # Quick setup and fixes
  38. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  39. #alias xtv='xrandr --output HDMI-0 --auto --same-as DVI-I-1'
  40. alias xtv='xrandr --output HDMI-0 --mode 1920x1080 --rate 60 --same-as DVI-D-0'
  41. alias alsa_mic='echo "Starting jack alsa mic input..." && alsa_in -j mic -d hw:USB -r 192000 -c 2 -p 1024 -n 3'
  42. alias mic='echo "Starting jack mic input..." && jack_connect system:capture_1 system:playback_1 && jack_connect system:capture_1 system:playback_2'
  43. alias mic_off='echo "Stopping jack mic input..." && jack_disconnect system:capture_1 system:playback_1 && jack_disconnect system:capture_1 system:playback_2'
  44. alias uber_out='echo "Routing pulse to Schiit..." && $( sleep 2 && jack_connect "PulseAudio JACK Sink:front-left" uber:playback_1 && jack_connect "PulseAudio JACK Sink:front-right" uber:playback_2 ) & alsa_out -j uber -d hw:Uber -r 192000 -c 2 -p 1024 -n 3'
  45. alias gamepad="xboxdrv --silent --detach-kernel-driver --mimic-xpad" # run as root
  46. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  47. # Curses program settings
  48. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  49. alias todo='vim ~/.todo.tp'
  50. alias tclock='tty-clock -sctb -d 0 -a 10000000 -C 6 -f "%Y/%m/%d"'
  51. alias netmon="bmon -p eth0,eth1 -b -o curses:'nocolors;bgchar= '"
  52. alias kp="kpcli --kdb ~/Local/key/KeePass/master.kdbx --key ~/Local/key/master.key --histfile /dev/null"
  53. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  54. # Bitcoin mining
  55. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  56. alias mine='cudaminer --interactive=1 --algo=scrypt -o stratum+tcp://middlecoin.com:3333 -u 1HoqBstSjv5kZrEyyHCGjReRpLf3TWTLPS -p asdfgqwert'
  57. alias mine-intense='cudaminer --interactive=0 --algo=scrypt -o stratum+tcp://middlecoin.com:3333 -u 1HoqBstSjv5kZrEyyHCGjReRpLf3TWTLPS -p asdfgqwert'
  58. alias balance='curl http://www.middlecoin.com/allusers.html | grep -B 3 -A 3 1HoqBstSjv5kZrEyyHCGjReRpLf3TWTLPS'
  59. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  60. # Utilities
  61. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  62. alias batch-unzip='for i in *.zip; do newdir="$i:gs/.zip/"; mkdir "$newdir"; unzip -d "$newdir" "$i"; done'
  63. #alias scanimage='scanimage --format=tiff --device pixma:04A91747_80650C --resolution 300'
  64. alias scan-flatbed='scanimage --format=tiff --device "brother4:bus4;dev2" --resolution 600 --source FlatBed'
  65. alias scan-tray='scanimage --format=tiff --device "brother4:bus4;dev1" --resolution 600'
  66. alias merge_pdfs='gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=merged.pdf'
  67. alias rm-if-no-screen='for i in *; do if [ ! -e screens/"$i".jpg -a $i != "screens" ]; then rm -Iv $i; fi; done'
  68. alias rm-if-no-screen-alt='for i in *; do if [ ! -e "../screens/`basename $i .mp4` s.jpg" ]; then rm -Iv $i; fi; done'
  69. alias pic-dirs-by-date='for i in *.NEF; do dirname=`ll --time-style=full-iso $i | awk '\''{ print $6 }'\''`; mkdir -p $dirname; mv -v $i $dirname; done'
  70. make_thumbs() { vcsi -g 5x4 -w 1920 -t --grid-spacing 0 "$*"; }
  71. make_thumbs_big() { vcsi -g 5x20 -w 1920 -t --grid-spacing 0 "$*"; }
  72. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  73. # Music info
  74. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  75. alias fp='for i in *.flac; do ffprobe $i 2>&1; done'
  76. alias fa='for i in *.flac; do ffprobe $i 2>&1 | grep -i artist; done'
  77. alias fcomp='for i in *.flac; do ffprobe $i 2>&1 | grep -i composer; done'
  78. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  79. # Visuals
  80. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  81. alias blah='while true; do head -c8 /dev/urandom; sleep 0.02; done | hexdump -C'
  82. alias matrix='unimatrix -afo -s 95 -l nssssSScCgGkkkkkkkk'
  83. alias pipes='/usr/bin/pipes -t 3 -f 60 -r 8000'
  84. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  85. # Sounds
  86. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  87. #alias engage='play -r 44100 -c2 -n synth whitenoise lowpass -1 120 lowpass -1 120 lowpass -1 120 gain +16'
  88. #alias engage='play -c2 -n -t alsa synth whitenoise band -n 100 24 band -n 300 100 gain +20'
  89. #alias waves='play -c2 -n -t alsa synth brownnoise mix synth 0 0 0 15 40 80 trapezium amod 0.1 30'
  90. play_midi() { fluidsynth -a alsa -m alsa_seq -j -g 2 -l -i /usr/share/soundfonts/FluidR3_GM.sf2 "$*"; }
  91. say() { echo "$@" | festival --tts; }
  92. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  93. # More terminal whimsy
  94. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  95. alias weather="curl http://wttr.in/Nashville"
  96. alias ponysay='ponysay -b round'
  97. alias ponythink='ponythink -b ascii'
  98. if [[ "$TERM" == rxvt-unicode-256color || "$TERM" == xterm-256color ]]; then
  99. alias catimg='catimg -t'
  100. fi
  101. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  102. # Enable color support
  103. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  104. if [ -x /usr/bin/dircolors ]; then
  105. eval "`dircolors -b`"
  106. alias ls='ls --color=auto --literal'
  107. alias diff='diff --color=auto'
  108. alias grep='grep --color=auto'
  109. alias fgrep='fgrep --color=auto'
  110. alias egrep='egrep --color=auto'
  111. export -UT LS_COLORS=$LS_COLORS'ow=34;7:' ls_colors
  112. fi
  113. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  114. # Host-specific aliases
  115. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  116. case "$hostenv" in
  117. ( cluster )
  118. alias open='gnome-open'
  119. alias freenodes="pbsnodes | grep 'opteron' -A3 -B3 | grep 'state = free' -A2 -B1 | less"
  120. alias qm="qstat -a | grep $USER"
  121. alias get_gpu_node="qsub -I -W group_list=nbody_gpu -l nodes=1:ppn=1:gpus=1 -l pmem=1000mb -l mem=1000mb -l walltime=3:00:00"
  122. alias checkrun="showq | grep $USER | tail -n 1 | awk '{print $1}' | xargs qcat"
  123. alias usage='mmlsquota --block-size auto'
  124. ;;
  125. ( astro )
  126. alias open='kde-open'
  127. export VUSPACEHOST=`echo $USER | cut -b 1`
  128. alias mountvuspace="/sbin/mount.cifs //vuspace-$VUSPACEHOST/user ~/vuspace -o username=$USER"
  129. alias umountvuspace="/sbin/umount.cifs ~/vuspace"
  130. ;;
  131. ( linux )
  132. alias open='kde-open5'
  133. alias ssh='eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && ssh'
  134. alias scp='eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && scp'
  135. alias rsync='eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && rsync'
  136. my_git() {
  137. case $* in
  138. ( push* ) shift; eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && /usr/bin/git push "$@" ;;
  139. ( pull* ) shift; eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && /usr/bin/git pull "$@" ;;
  140. ( remote* ) shift; eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && /usr/bin/git remote "$@" ;;
  141. ( * ) /usr/bin/git "$@" ;;
  142. esac
  143. }
  144. alias git='my_git'
  145. alias usage='/home/djsissom/Local/src/comcast-bw/comcastBandwidth.py'
  146. ;;
  147. ( osx )
  148. #alias ls='ls -G'
  149. alias ls='ls --color=auto --literal'
  150. alias top='top -o cpu'
  151. alias ssh='if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && ssh'
  152. alias scp='if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && scp'
  153. alias rsync='if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && rsync'
  154. my_git() {
  155. case $* in
  156. ( push* ) shift; if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && /usr/local/bin/git push "$@" ;;
  157. ( pull* ) shift; if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && /usr/local/bin/git pull "$@" ;;
  158. ( remote* ) shift; if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && /usr/local/bin/git remote "$@" ;;
  159. ( * ) /usr/local/bin/git "$@" ;;
  160. esac
  161. }
  162. alias git='my_git'
  163. alias man='man -M /usr/local/opt/coreutils/libexec/gnuman:$MANPATH'
  164. alias pipes='pipes.sh -t 3 -f 60 -r 8000'
  165. ;;
  166. esac
  167. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  168. # End
  169. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  170. # vi:syntax=sh filetype=sh