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.

219 lines
9.8 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 alsa_mic='echo "Starting jack alsa mic input..." && alsa_in -j mic -d hw:USB -r 192000 -c 2 -p 1024 -n 3'
  41. alias mic='echo "Starting jack mic input..." && jack_connect system:capture_1 system:playback_1 && jack_connect system:capture_1 system:playback_2'
  42. alias mic_off='echo "Stopping jack mic input..." && jack_disconnect system:capture_1 system:playback_1 && jack_disconnect system:capture_1 system:playback_2'
  43. 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'
  44. alias gamepad="xboxdrv --silent --detach-kernel-driver --mimic-xpad" # run as root
  45. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  46. # Curses program settings
  47. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  48. alias todo='vim ~/.todo.tp'
  49. alias tclock='tty-clock -sctb -d 0 -a 10000000 -C 6 -f "%Y/%m/%d"'
  50. alias netmon="bmon -p eth1,eth0 -b -o curses:'nocolors;bgchar= '"
  51. alias kp="kpcli --kdb ~/Local/key/KeePass/master.kdbx --key ~/Local/key/master.key --histfile /dev/null"
  52. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  53. # Bitcoin mining
  54. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  55. alias mine='cudaminer --interactive=1 --algo=scrypt -o stratum+tcp://middlecoin.com:3333 -u 1HoqBstSjv5kZrEyyHCGjReRpLf3TWTLPS -p asdfgqwert'
  56. alias mine-intense='cudaminer --interactive=0 --algo=scrypt -o stratum+tcp://middlecoin.com:3333 -u 1HoqBstSjv5kZrEyyHCGjReRpLf3TWTLPS -p asdfgqwert'
  57. alias balance='curl http://www.middlecoin.com/allusers.html | grep -B 3 -A 3 1HoqBstSjv5kZrEyyHCGjReRpLf3TWTLPS'
  58. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  59. # Utilities
  60. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  61. alias batch-unzip='for i in *.zip; do newdir="$i:gs/.zip/"; mkdir "$newdir"; unzip -d "$newdir" "$i"; done'
  62. #alias scanimage='scanimage --format=tiff --device pixma:04A91747_80650C --resolution 300'
  63. alias scan-flatbed='scanimage --format=tiff --device "brother4:bus4;dev2" --resolution 600 --source FlatBed'
  64. alias scan-tray='scanimage --format=tiff --device "brother4:bus4;dev1" --resolution 600'
  65. alias merge_pdfs='gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=merged.pdf'
  66. alias rm-if-no-screen='for i in *; do if [ ! -e screens/"$i".jpg -a $i != "screens" ]; then rm -Iv $i; fi; done'
  67. 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'
  68. make_thumbs() { vcsi -g 5x4 -w 1920 -t --grid-spacing 0 "$*"; }
  69. make_thumbs_big() { vcsi -g 5x20 -w 1920 -t --grid-spacing 0 "$*"; }
  70. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  71. # Music info
  72. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  73. alias fp='for i in *.flac; do ffprobe $i 2>&1; done'
  74. alias fa='for i in *.flac; do ffprobe $i 2>&1 | grep -i artist; done'
  75. alias fcomp='for i in *.flac; do ffprobe $i 2>&1 | grep -i composer; done'
  76. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  77. # Visuals
  78. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  79. alias blah='while true; do head -c8 /dev/urandom; sleep 0.02; done | hexdump -C'
  80. alias matrix='unimatrix -afo -s 95 -l nssssSScCgGkkkkkkkk'
  81. alias pipes='/usr/bin/pipes -t 3 -f 60 -r 8000'
  82. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  83. # Sounds
  84. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  85. #alias engage='play -r 44100 -c2 -n synth whitenoise lowpass -1 120 lowpass -1 120 lowpass -1 120 gain +16'
  86. alias engage='play -c2 -n -t alsa synth whitenoise band -n 100 24 band -n 300 100 gain +20'
  87. alias waves='play -c2 -n -t alsa synth brownnoise mix synth 0 0 0 15 40 80 trapezium amod 0.1 30'
  88. play_midi() { fluidsynth -a alsa -m alsa_seq -j -g 2 -l -i /usr/share/soundfonts/FluidR3_GM.sf2 "$*"; }
  89. say() { echo "$@" | festival --tts; }
  90. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  91. # More terminal whimsy
  92. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  93. alias weather="curl http://wttr.in/Nashville"
  94. alias ponysay='ponysay -b round'
  95. alias ponythink='ponythink -b ascii'
  96. if [[ "$TERM" == rxvt-unicode-256color || "$TERM" == xterm-256color ]]; then
  97. alias catimg='catimg -t'
  98. fi
  99. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  100. # Enable color support
  101. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  102. if [ -x /usr/bin/dircolors ]; then
  103. eval "`dircolors -b`"
  104. alias ls='ls --color=auto --literal'
  105. alias diff='diff --color=auto'
  106. alias grep='grep --color=auto'
  107. alias fgrep='fgrep --color=auto'
  108. alias egrep='egrep --color=auto'
  109. export -UT LS_COLORS=$LS_COLORS'ow=34;7:' ls_colors
  110. fi
  111. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  112. # Host-specific aliases
  113. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  114. case "$hostenv" in
  115. ( cluster )
  116. alias open='gnome-open'
  117. alias freenodes="pbsnodes | grep 'opteron' -A3 -B3 | grep 'state = free' -A2 -B1 | less"
  118. alias qm="qstat -a | grep $USER"
  119. 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"
  120. alias checkrun="showq | grep $USER | tail -n 1 | awk '{print $1}' | xargs qcat"
  121. alias usage='mmlsquota --block-size auto'
  122. ;;
  123. ( astro )
  124. alias open='kde-open'
  125. export VUSPACEHOST=`echo $USER | cut -b 1`
  126. alias mountvuspace="/sbin/mount.cifs //vuspace-$VUSPACEHOST/user ~/vuspace -o username=$USER"
  127. alias umountvuspace="/sbin/umount.cifs ~/vuspace"
  128. ;;
  129. ( linux )
  130. alias open='kde-open5'
  131. alias ssh='eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && ssh'
  132. alias scp='eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && scp'
  133. alias rsync='eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && rsync'
  134. my_git() {
  135. case $* in
  136. ( push* ) shift; eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && /usr/bin/git push "$@" ;;
  137. ( pull* ) shift; eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && /usr/bin/git pull "$@" ;;
  138. ( remote* ) shift; eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && /usr/bin/git remote "$@" ;;
  139. ( * ) /usr/bin/git "$@" ;;
  140. esac
  141. }
  142. alias git='my_git'
  143. alias usage='/home/djsissom/Local/src/comcast-bw/comcastBandwidth.py'
  144. ;;
  145. ( osx )
  146. #alias ls='ls -G'
  147. alias ls='ls --color=auto --literal'
  148. alias top='top -o cpu'
  149. alias ssh='if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && ssh'
  150. alias scp='if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && scp'
  151. alias rsync='if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && rsync'
  152. my_git() {
  153. case $* in
  154. ( push* ) shift; if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && /usr/local/bin/git push "$@" ;;
  155. ( pull* ) shift; if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && /usr/local/bin/git pull "$@" ;;
  156. ( remote* ) shift; if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && /usr/local/bin/git remote "$@" ;;
  157. ( * ) /usr/local/bin/git "$@" ;;
  158. esac
  159. }
  160. alias git='my_git'
  161. alias man='man -M /usr/local/opt/coreutils/libexec/gnuman:$MANPATH'
  162. alias pipes='pipes.sh -t 3 -f 60 -r 8000'
  163. ;;
  164. esac
  165. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  166. # End
  167. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  168. # vi:syntax=sh filetype=sh