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.

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