Mercurial > index.cgi > dotfiles
changeset 33:f59f847377d7
* Added toodledo interfacing
* Moved some logic from .bash_profile to .bash_aliases for exporting to
subshells
* Disowned backgrounded processes
author | huston@80426f53-59d1-405d-934b-f07cd76f4a1a |
---|---|
date | Fri, 05 Mar 2010 19:07:47 +0000 |
parents | 29dfb30b069c |
children | 82fde4c9245c |
files | .bash_aliases .bash_profile .bashrc |
diffstat | 3 files changed, 56 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/.bash_aliases Wed Mar 03 01:49:33 2010 +0000 +++ b/.bash_aliases Fri Mar 05 19:07:47 2010 +0000 @@ -3,18 +3,43 @@ # Aliases are read from this file; no real reason to separate them out except # for readability. +# Some settings which are architecture dependent case `uname` in Darwin) # DARWIN is used for the SSHFS mounts below DARWIN="yes" + + # The 'stat' and 'date' commands are here since the syntax of the commands + # is different between Linux and Mac OS X. If this is run elsewhere, the + # eval will be false and the test not done below, so it's safe to not + # bother checking for zero-length variables on the test - it just won't + # run the svn status, so you won't be prompted if there's newer files + # available in your repository. These are safe to export since they're + # the commands to be evaulated, not the output - you're storing how to get + # the answer, not the answer itself. + + DFSTAT="stat -f %m -t %s $HOME/.dotfilets" + MDATE="date -v -1m +%s" + TDSTAT="stat -f %m -t %s $HOME/.todo" + HDATE="date -v -1h +%s" + alias ls='ls -FG' ;; Linux) + # See above for a description of these four + DFSTAT="stat -c %Y $HOME/.dotfilets" + MDATE="date -d \"1 month ago\" +%s" + TDSTAT="stat -c %Y $HOME/.todo" + HDATE="date -d \"1 hour ago\" +%s" + alias ls='ls --color=auto -F' ;; esac +# Export some of those above for the benefit of future shells +export DFSTAT MDATE TDSTAT HDATE + # SSH aliases alias dh='ssh srhuston.net' alias dvra='ssh dvra@laurel.dreamhost.com' @@ -52,4 +77,26 @@ # Other alias condor_check="ls -lat /u/condor/hosts/*/log/MasterLog /scr/chimera0/condor/hosts/*/log/MasterLog" +# Functions +update_toodledo() { + case `hostname -s` in + xanadu|rapture) + TOODLEDO_CMDS="toodledo tasks *Work; toodledo tasks *Personal" + ;; + + milton) + TOODLEDO_CMDS="toodledo tasks *Personal" + ;; + esac + + [[ -e $HOME/.todo.$$ ]] && return + + echo "To-do list as of `date`" > $HOME/.todo + echo "---------------------------------------------" >> $HOME/.todo + eval $TOODLEDO_CMDS | egrep -v ' -- !negative' >> $HOME/.todo.$$ + egrep '^<[0-9]+>' $HOME/.todo.$$ | egrep '#\[[0-9]+/[0-9]+/[0-9]+' | sort -k 4.3 >> $HOME/.todo + egrep '^<[0-9]+>' $HOME/.todo.$$ | egrep -v '#\[[0-9]+/[0-9]+/[0-9]+' >> $HOME/.todo + rm $HOME/.todo.$$ +} + # vim: set filetype=sh :
--- a/.bash_profile Wed Mar 03 01:49:33 2010 +0000 +++ b/.bash_profile Fri Mar 05 19:07:47 2010 +0000 @@ -32,28 +32,6 @@ # If it's older than a month, run a 'svn st -u' and touch it; this way we # check once per month to see if we forgot to pull down an updated version. -# First set $STAT and $DATE since the syntax of the commands is different -# between Linux and Mac OS X. If this is run elsewhere, the eval will be -# false and the test not done below, so it's safe to not bother checking for -# zero-length variables on the test - it just won't run the svn status, so you -# won't be prompted if there's newer files available in your repository. - -case `uname` in - Darwin) - DFSTAT="stat -f %m -t %s $HOME/.dotfilets" - MDATE="date -v -1m +%s" - TDSTAT="stat -f %m -t %s $HOME/.todo" - HDATE="date -v -1h +%s" - ;; - - Linux) - DFSTAT="stat -c %Y $HOME/.dotfilets" - MDATE="date -d \"1 month ago\" +%s" - TDSTAT="stat -c %Y $HOME/.todo" - HDATE="date -d \"1 hour ago\" +%s" - ;; -esac - [[ ! -f $HOME/.dotfilets || \ `eval $DFSTAT` -lt `eval $MDATE` ]] && { echo -n Dotfiles last checked over a month ago @@ -68,26 +46,6 @@ *) echo , running a status test. svn st -u && touch $HOME/.dotfilets & + disown %+ esac } - -# Work in progress - toodledo to ~/.todo -#[[ -f $HOME/.todo ]] && cat $HOME/.todo -# -#case `hostname -s` in -# xanadu|rapture) -# TOODLEDO_CMD="hotlist" -# ;; - -# milton) -# TOODLEDO_CMD="tasks *Personal" -# ;; -#esac -# -#[[ ! -f $HOME/.todo || \ -# `eval $TDSTAT` -lt `eval $HDATE` ]] && { -# echo "To-do list as of `date`" > $HOME/.todo -# echo "---------------------------------------------" >> $HOME/.todo -# toodledo tasks >> $HOME/.todo & -#} -
--- a/.bashrc Wed Mar 03 01:49:33 2010 +0000 +++ b/.bashrc Fri Mar 05 19:07:47 2010 +0000 @@ -136,3 +136,11 @@ [[ "$MIBDIRS" =~ "^\+" ]] || export MIBDIRS=+$MIBDIRS export MIBS=ALL fi + +# Display todo list +[[ "$PS1" && -f $HOME/.todo ]] && cat $HOME/.todo + +[[ "$PS1" && -f $HOME/.todo && `eval $TDSTAT` -lt `eval $HDATE` ]] && { + update_toodledo & + disown %+ +}