######################### # Akkana's .bashrc ######################### # User specific aliases and functions # Get noninteractive shells out of here # even though the bash documentation says noninteractive # shells aren't supposed to execute .bashrc according to # http://www.faqs.org/docs/bashman/bashref_63.html#SEC63 if tty -s then : else return fi # echo .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # Word erase only back to punctuation. # This also requires that .inputrc include: # set bind-tty-special-chars Off bind '\C-w:backward-kill-word' # Set path export PATH=$HOME/bin:$HOME/bin/linux:/usr/local/gimp-2.3/bin:/usr/local/gimp-2.0/bin:/u/local/j2sdk1.4.2_01/bin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/usr/bin/X11:.:/opt/kde/bin:/sbin:/usr/games # Prompt setting # Linux consoles don't colorize bold, so make it magenta to stand out # against the black background: # rxvt lets me set bold to be a different color that contrasts better # than any of the ANSI colors. So use that if possible: if [ $TERM == 'rxvt' ]; then export standout="\e[1;m" # On a linux console, use magenta because it contrasts with the black bg: elif [ $TERM == 'linux' ]; then export standout="\e[1;35m" # All others, use blue: else export standout="\e[0;34m" fi export standout_end="\e[m" export primes=${primes}\' PS1="\[$standout\][\h$primes]-\[$standout_end\] " # Bash defaults to a short idle timeout and keeps logging me out TMOUT=15000 # Environment export PAGER=less export LESS=-E export EDITOR=vim export LC_COLLATE=C # See http://www.linux-sxs.org/housekeeping/lscolors.html export LS_COLORS='ex=1;31:ln=1;35' export RSYNC_RSH=ssh export PHO_ARGS=-p # aliases alias ls='ls -AF --color' alias ll='ls -lAF --color' alias llt='ls -lASFHLt --color' alias llth='ls -lAFSHLt --color | head' alias j=jobs alias m=mutt alias pd=pushd alias s=suspend titlebar() { echo ']2;$*' } alias rl="telnet -r" alias screenshot="import -window root screenshot.jpg" alias thes="dict -h localhost -d moby-thesaurus" alias newbg='xsetbg -fullscreen -border black `find $HOME/Backgrounds -name "*.*" | randomline`' alias akk='play ~/.xchat2/sounds/akk.wav' ############################### # Recursive greps gr() { find . \( -type f -and -not -name '*.o' -and -not -name '*.so' -and -not -name '*.a' \) -print0 | xargs -0 grep $* /dev/null | fgrep -v .svn } cgr() { find . \( -name '*.[CchH]' -or -name '*.cpp' -or -name '*.cc' \) -print0 | xargs -0 grep $* /dev/null } hgr() { find . \( -name '*.h' -or -name '*.idl' \) -print0 | xargs -0 grep $* /dev/null } rgr() { find . \( -name '*.rb' -or -name '*.rhtml' \) -print0 | xargs -0 grep $* /dev/null | fgrep -v .svn } htgr() { find . -name '*.*htm*' -print0 | xargs -0 grep $* /dev/null } jgr() { find . -name '*.js' -print0 | xargs -0 grep $* /dev/null } xgr() { find . \( -name '*.cChH' -or -name '*.cpp' -or -name '*.xul' -or -name '*.html' -or -name '*.js' -or -name '*.css' \) -print0 | xargs -0 grep $* /dev/null } cssgr() { find . -name '*.css' -print0 | xargs -0 grep $* /dev/null } mgr() { find . -name '*akefile*' -print0 | xargs -0 grep $* /dev/null } agr() { find . -type f -print0 | xargs -0 grep $* /dev/null } zgr() { find . \( -type f -and -not -name '*.o' -and -not -name '*.so' -and -not -name '*.a' \) -print0 | xargs -0 zgrep $* /dev/null } # halt and reboot don't always work on the Vaio, # and can't be run suid. alias off="sudo shutdown -h now" alias halt="sudo shutdown -h now" alias reboot="sudo shutdown -r now" # Get ink status from Epson printers alias epsonink="escputil -r /dev/usblp0 -mC86 -u -i" alias epsonnozzle="escputil -r /dev/usblp0 -mC86 -u -n" alias epsonclean="escputil -r /dev/usblp0 -mC86 -u -c" # blog stuff alias blogupdate='cd ~/web/blogfiles && ./pyblosxom.cgi --static --incremental && ~/bin/blogtopics && mv ../blog/topics.html ../blog/oldtopics.html && mv ../blog/newtopics.html ../blog/topics.html && cd' # Palm stuff export PILOTPORT=/dev/ttyUSB1 scoop() { export LANG=C rm -f $HOME/.sitescooper/prc/*.pdb sitescooper $* | setsid tee $HOME/scoop.out 2>&1 cat /u/akkana/shallowsky/xtraurls.html >> $HOME/xtraurls.html rm /u/akkana/shallowsky/xtraurls.html ls $HOME/.sitescooper/prc } rscoop() { rm $HOME/.sitescooper/prc/* nohup sitescooper >& $HOME/scoop.out & } alias piscoop='pilot-xfer -i ~/.sitescooper/prc/*.pdb' alias pils='echo "In ~/.sitescooper/prc : "; ls ~/.sitescooper/prc' treobak() { rm -rf ~/Pilot/Treo.bak cp -a ~/Pilot/Treo ~/Pilot/Treo.bak pilot-xfer -s ~/Pilot/Treo pluckmemos cp ~/.plucker/html/xtraurls.html ~/web/xtraurls.html } getscoops() { rm -rf $HOME/bakscoops mv -f $HOME/scoops $HOME/bakscoops scp -r shallowsky.com:.sitescooper/prc $HOME/scoops } # mencoder options are black magic. # This works for converting Minolta quicktime .mov to mpeg: mov2mpg1() { mencoder $1 -oac pcm -ovc lavc -lavcopts vcodec=mpeg1video -o $2 } # -lavc is ffmpeg, and the default codec is divx: mov2divx() { mencoder $1 -oac pcm -ovc lavc -o $2 } # From drc on #gimp: mov2mpeg4() { mencoder $1 -oac pcm -ovc lavc -lavcopts vcodec=mpeg4:vqmin=2:vlelim=-4:vcelim=9:lumi_mask=0.05:dark_mask=0.01:vhq -o $2 } # Remove the line matching $1 from ~/.ssh/known_hosts. # Ssh refuses to operate if anything has changed about the host: # network card, distro it's running, etc. cleanssh() { mv $HOME/.ssh/known_hosts $HOME/.ssh/known_hosts.bak grep -v $1 $HOME/.ssh/known_hosts.bak >$HOME/.ssh/known_hosts } # Get the temperature from /proc/acpi/thermal_zone/THRM/temperature # and convert it to F alias temp="cat /proc/acpi/thermal_zone/ATF0/temperature" # Record a realaudio stream getreal() { mplayer -playlist $1 -ao pcm:file=$2 -vc dummy -vo null } # Then transcode it with: # lame --tg Other --ta artist -tl album file.wav file.mp3 alias ratings='links -dump "http://www.amazon.com/gp/product/1590595874" | grep "in Books" | grep -v Explore' # For presentations alias bigterm="rxvt -geometry 80x33 -fn '-*-lucidatypewriter-*-*-*-*-19-*-*-*-*-*-*-*'" # Starting system software: alias apache="sudo /etc/noinit.d/apache2" alias cups="sudo /etc/noinit.d/cupsys" alias mysql="sudo /etc/noinit.d/mysql" if [ $HOSTNAME != 'moon' ]; then alias rlm='ssh moon' alias xx=startx else alias rlm="telnet -r moon" alias ssm="ssh shallowsky.com" fi