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.

218 lines
9.7 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. play_midi() { fluidsynth -a alsa -m alsa_seq -j -g 2 -l -i /usr/share/soundfonts/FluidR3_GM.sf2 "$*"; }
  88. say() { echo "$@" | festival --tts; }
  89. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  90. # More terminal whimsy
  91. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  92. alias weather="curl http://wttr.in/Nashville"
  93. alias ponysay='ponysay -b round'
  94. alias ponythink='ponythink -b ascii'
  95. if [[ "$TERM" == rxvt-unicode-256color || "$TERM" == xterm-256color ]]; then
  96. alias catimg='catimg -t'
  97. fi
  98. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  99. # Enable color support
  100. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  101. if [ -x /usr/bin/dircolors ]; then
  102. eval "`dircolors -b`"
  103. alias ls='ls --color=auto --literal'
  104. alias diff='diff --color=auto'
  105. alias grep='grep --color=auto'
  106. alias fgrep='fgrep --color=auto'
  107. alias egrep='egrep --color=auto'
  108. export -UT LS_COLORS=$LS_COLORS'ow=34;7:' ls_colors
  109. fi
  110. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  111. # Host-specific aliases
  112. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  113. case "$hostenv" in
  114. ( cluster )
  115. alias open='gnome-open'
  116. alias freenodes="pbsnodes | grep 'opteron' -A3 -B3 | grep 'state = free' -A2 -B1 | less"
  117. alias qm="qstat -a | grep $USER"
  118. 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"
  119. alias checkrun="showq | grep $USER | tail -n 1 | awk '{print $1}' | xargs qcat"
  120. alias usage='mmlsquota --block-size auto'
  121. ;;
  122. ( astro )
  123. alias open='kde-open'
  124. export VUSPACEHOST=`echo $USER | cut -b 1`
  125. alias mountvuspace="/sbin/mount.cifs //vuspace-$VUSPACEHOST/user ~/vuspace -o username=$USER"
  126. alias umountvuspace="/sbin/umount.cifs ~/vuspace"
  127. ;;
  128. ( linux )
  129. alias open='kde-open5'
  130. alias ssh='eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && ssh'
  131. alias scp='eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && scp'
  132. alias rsync='eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && rsync'
  133. my_git() {
  134. case $* in
  135. ( push* ) shift; eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && /usr/bin/git push "$@" ;;
  136. ( pull* ) shift; eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && /usr/bin/git pull "$@" ;;
  137. ( remote* ) shift; eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && /usr/bin/git remote "$@" ;;
  138. ( * ) /usr/bin/git "$@" ;;
  139. esac
  140. }
  141. alias git='my_git'
  142. alias usage='/home/djsissom/Local/src/comcast-bw/comcastBandwidth.py'
  143. ;;
  144. ( osx )
  145. #alias ls='ls -G'
  146. alias ls='ls --color=auto --literal'
  147. alias top='top -o cpu'
  148. alias ssh='if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && ssh'
  149. alias scp='if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && scp'
  150. alias rsync='if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && rsync'
  151. my_git() {
  152. case $* in
  153. ( push* ) shift; if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && /usr/local/bin/git push "$@" ;;
  154. ( pull* ) shift; if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && /usr/local/bin/git pull "$@" ;;
  155. ( remote* ) shift; if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && /usr/local/bin/git remote "$@" ;;
  156. ( * ) /usr/local/bin/git "$@" ;;
  157. esac
  158. }
  159. alias git='my_git'
  160. alias man='man -M /usr/local/opt/coreutils/libexec/gnuman:$MANPATH'
  161. alias pipes='pipes.sh -t 3 -f 60 -r 8000'
  162. ;;
  163. esac
  164. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  165. # End
  166. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  167. # vi:syntax=sh filetype=sh