#!/bin/bash if [ -e ~/.mute-notifications ]; then exit fi # my-life.sh -- Manage your life # # Description: Life's complex. This script makes it less complex. # # Author: Mark Triggs # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This file is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Emacs; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. PATH=$PATH:/bin:/usr/bin:/usr/local/bin last_modified=$(stat -c %y ~/.life | awk '{print $1}') today=$(date +%F) cmp <(cat ~/.diary ~/.google.diary ~/.beth.diary ~/.diary.todo) ~/.diary.last > /dev/null 2> /dev/null if [ $? -ne 0 ] || [ "$NOFILTER" = "1" ] || [ "$last_modified" != "$today" ]; then # update the diary config="(save-window-excursion (load-file \"/home/mst/.elisp/homebrew/diary-countdown.el\") (require 'calendar) (mst-show-your-life) (with-current-buffer \"*Your Life*\" (write-region (point-min) (point-max) \"~/.life.new\") (kill-buffer nil)))" emacsclient -e "$config" >/dev/null 2>&1 mv ~/.life.new ~/.life cat ~/.diary ~/.google.diary ~/.beth.diary ~/.diary.todo > ~/.diary.last fi # Pretty colours! grep '^* TODO' ~/.todo | cut -d' ' -f2- | sed 's/ *:[a-zA-Z0-9:]\+$//g'; echo function dofilter() { if [ "$NOFILTER" = "1" ]; then cat else egrep -v '( in [0-9][0-9] days|Dev Call|Conversation Tool Check-In|Sakai Core Team|\[Beth\] (Orchestra rehearsal|Violin lesson|Worm the cats))' fi } (cat ~/.life | dofilter | tac ; echo; cat ~/.thoughts.org | egrep -v '^ *$' 2>/dev/null | sed 's/^/THOUGHT /' | sed 's/ *\[[^]]\+\]//') | sed "s|\(.*credit card today\)|$(echo -e '\e[;31;01m\\1\e[m')|g" \ | grep -v 'Two bin day' \ | grep -v 'Fighting something off' \ | sed "s|\(.*check.*today\)|$(echo -e '\e[;31;01m\\1\e[m')|gi" \ | sed "s|\(.*days late.*today\)|$(echo -e '\e[;31;01m\\1\e[m')|gi" \ | sed "s|\(.*anniversary today\)|$(echo -e '\e[;32;01m\\1\e[m')|g" \ | sed "s|\(birthday\)|$(echo -e '\e[;33;01m\\1\e[m')|g" \ | sed "s|\(.*THOUGHT\)|$(echo -e '\e[;34;01m>>\e[m')|g" \ | sed "s|\(.*today\)|$(echo -e '\e[;32;01m\\1\e[m')|g" \ | sed "s|\(tomorrow\)|$(echo -e '\e[;34;01m\\1\e[m')|g" \ | sed "s^\(Sunday\|Monday\|Tuesday\|Wednesday\|Thursday\|Friday\|Saturday\)^$(echo -e '\e[;33;01m\\1\e[m')^g" \ | sed "s|\(.*meeting.*today\)|$(echo -e '\e[;31;01m\\1\e[m')|g" \ | sed "s|\(HALLOWEEN\)|$(echo -e '\e[;32;01m\\1\e[m')|g" \ | uniq