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

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# .aliases
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Alias definitions for interactive shells. Should be able to be sourced from
# (at least) bash and zsh rc files.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Host-agnostic aliases
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Getting around
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
alias u='cd ..'
alias back='cd "$OLDPWD"'
alias ls='ls --literal'
alias ll='ls -lh'
alias la='ls -A'
alias list='ls -lhA'
alias tree='tree -Chug'
alias ds='du -hsc * | sort -h'
alias rs='rsync -avhP'
alias Grep='grep -i'
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Safety
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
alias mv='mv -i'
alias cp='cp -i'
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Avoid graphical environments when possible
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
alias truecrypt='truecrypt -t'
alias veracrypt='veracrypt -t'
if [[ "${DISPLAY}" == localhost:?*.0 ]]; then
alias vim='/usr/bin/vim -display localhost:0' # keep from launching X11 on OS X over SSH sessions
fi
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Quick setup and fixes
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#alias xtv='xrandr --output HDMI-0 --auto --same-as DVI-I-1'
alias xtv='xrandr --output HDMI-0 --mode 1920x1080 --rate 60 --same-as DVI-D-0'
alias alsa_mic='echo "Starting jack alsa mic input..." && alsa_in -j mic -d hw:USB -r 192000 -c 2 -p 1024 -n 3'
alias mic='echo "Starting jack mic input..." && jack_connect system:capture_1 system:playback_1 && jack_connect system:capture_1 system:playback_2'
alias mic_off='echo "Stopping jack mic input..." && jack_disconnect system:capture_1 system:playback_1 && jack_disconnect system:capture_1 system:playback_2'
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'
alias gamepad="xboxdrv --silent --detach-kernel-driver --mimic-xpad" # run as root
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Curses program settings
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
alias todo='vim ~/.todo.tp'
alias tclock='tty-clock -sctb -d 0 -a 10000000 -C 6 -f "%Y/%m/%d"'
alias netmon="bmon -p eth0,eth1 -b -o curses:'nocolors;bgchar= '"
alias kp="kpcli --kdb ~/Local/key/KeePass/master.kdbx --key ~/Local/key/master.key --histfile /dev/null"
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Bitcoin mining
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
alias mine='cudaminer --interactive=1 --algo=scrypt -o stratum+tcp://middlecoin.com:3333 -u 1HoqBstSjv5kZrEyyHCGjReRpLf3TWTLPS -p asdfgqwert'
alias mine-intense='cudaminer --interactive=0 --algo=scrypt -o stratum+tcp://middlecoin.com:3333 -u 1HoqBstSjv5kZrEyyHCGjReRpLf3TWTLPS -p asdfgqwert'
alias balance='curl http://www.middlecoin.com/allusers.html | grep -B 3 -A 3 1HoqBstSjv5kZrEyyHCGjReRpLf3TWTLPS'
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Utilities
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
alias batch-unzip='for i in *.zip; do newdir="$i:gs/.zip/"; mkdir "$newdir"; unzip -d "$newdir" "$i"; done'
#alias scanimage='scanimage --format=tiff --device pixma:04A91747_80650C --resolution 300'
alias scan-flatbed='scanimage --format=tiff --device "brother4:bus4;dev2" --resolution 600 --source FlatBed'
alias scan-tray='scanimage --format=tiff --device "brother4:bus4;dev1" --resolution 600'
alias merge_pdfs='gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=merged.pdf'
alias rm-if-no-screen='for i in *; do if [ ! -e screens/"$i".jpg -a $i != "screens" ]; then rm -Iv $i; fi; done'
alias rm-if-no-screen-alt='for i in *; do if [ ! -e "../screens/`basename $i .mp4` s.jpg" ]; then rm -Iv $i; fi; done'
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'
make_thumbs() { vcsi -g 5x4 -w 1920 -t --grid-spacing 0 "$*"; }
make_thumbs_big() { vcsi -g 5x20 -w 1920 -t --grid-spacing 0 "$*"; }
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Music info
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
alias fp='for i in *.flac; do ffprobe $i 2>&1; done'
alias fa='for i in *.flac; do ffprobe $i 2>&1 | grep -i artist; done'
alias fcomp='for i in *.flac; do ffprobe $i 2>&1 | grep -i composer; done'
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Visuals
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
alias blah='while true; do head -c8 /dev/urandom; sleep 0.02; done | hexdump -C'
alias matrix='unimatrix -afo -s 95 -l nssssSScCgGkkkkkkkk'
alias pipes='/usr/bin/pipes -t 3 -f 60 -r 8000'
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Sounds
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#alias engage='play -r 44100 -c2 -n synth whitenoise lowpass -1 120 lowpass -1 120 lowpass -1 120 gain +16'
#alias engage='play -c2 -n -t alsa synth whitenoise band -n 100 24 band -n 300 100 gain +20'
#alias waves='play -c2 -n -t alsa synth brownnoise mix synth 0 0 0 15 40 80 trapezium amod 0.1 30'
play_midi() { fluidsynth -a alsa -m alsa_seq -j -g 2 -l -i /usr/share/soundfonts/FluidR3_GM.sf2 "$*"; }
say() { echo "$@" | festival --tts; }
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# More terminal whimsy
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
alias weather="curl http://wttr.in/Nashville"
alias ponysay='ponysay -b round'
alias ponythink='ponythink -b ascii'
if [[ "$TERM" == rxvt-unicode-256color || "$TERM" == xterm-256color ]]; then
alias catimg='catimg -t'
fi
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Enable color support
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if [ -x /usr/bin/dircolors ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto --literal'
alias diff='diff --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
export -UT LS_COLORS=$LS_COLORS'ow=34;7:' ls_colors
fi
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Host-specific aliases
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
case "$hostenv" in
( cluster )
alias open='gnome-open'
alias freenodes="pbsnodes | grep 'opteron' -A3 -B3 | grep 'state = free' -A2 -B1 | less"
alias qm="qstat -a | grep $USER"
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"
alias checkrun="showq | grep $USER | tail -n 1 | awk '{print $1}' | xargs qcat"
alias usage='mmlsquota --block-size auto'
;;
( astro )
alias open='kde-open'
export VUSPACEHOST=`echo $USER | cut -b 1`
alias mountvuspace="/sbin/mount.cifs //vuspace-$VUSPACEHOST/user ~/vuspace -o username=$USER"
alias umountvuspace="/sbin/umount.cifs ~/vuspace"
;;
( linux )
alias open='kde-open5'
alias ssh='eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && ssh'
alias scp='eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && scp'
alias rsync='eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && rsync'
my_git() {
case $* in
( push* ) shift; eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && /usr/bin/git push "$@" ;;
( pull* ) shift; eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && /usr/bin/git pull "$@" ;;
( remote* ) shift; eval $(/usr/bin/keychain --eval --agents ssh --quick --quiet --timeout 480 ~/.ssh/id_rsa) && /usr/bin/git remote "$@" ;;
( * ) /usr/bin/git "$@" ;;
esac
}
alias git='my_git'
alias usage='/home/djsissom/Local/src/comcast-bw/comcastBandwidth.py'
;;
( osx )
#alias ls='ls -G'
alias ls='ls --color=auto --literal'
alias top='top -o cpu'
alias ssh='if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && ssh'
alias scp='if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && scp'
alias rsync='if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && rsync'
my_git() {
case $* in
( push* ) shift; if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && /usr/local/bin/git push "$@" ;;
( pull* ) shift; if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && /usr/local/bin/git pull "$@" ;;
( remote* ) shift; if [[ `ssh-add -l` == "The agent has no identities." ]]; then ssh-add -t 28800; fi && /usr/local/bin/git remote "$@" ;;
( * ) /usr/local/bin/git "$@" ;;
esac
}
alias git='my_git'
alias man='man -M /usr/local/opt/coreutils/libexec/gnuman:$MANPATH'
alias pipes='pipes.sh -t 3 -f 60 -r 8000'
;;
esac
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# End
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# vi:syntax=sh filetype=sh