Skip to content

Instantly share code, notes, and snippets.

@gregretkowski
Created July 15, 2024 18:40
Show Gist options
  • Select an option

  • Save gregretkowski/6e02a3f7ed4b72f80311315ad9684249 to your computer and use it in GitHub Desktop.

Select an option

Save gregretkowski/6e02a3f7ed4b72f80311315ad9684249 to your computer and use it in GitHub Desktop.
The day logit and todo scripts
#########
# The 'day' script
#########
#!/bin/bash
TIMELOG=$HOME/timelog.txt
# Fix out-of-sync VM clock first
ps -aux|grep -v grep|grep VBox >/dev/null && sudo rdate -s time.stanford.edu
if [ x$1 == 'xstart' ];then
echo 'START ' `date` >> $TIMELOG
elif [ x$1 == 'xend' ];then
echo ' END ' `date` >> $TIMELOG
else
echo 'bad argument'
exit 1
fi
#########
# The 'logit' script
#########
#!/bin/bash
echo `date +%H:%m` $* >>~/timelog.txt
################
# The 'todo' script
################
#!/bin/bash
# A script to maintain a todo file, stored in git so it is
# easy to report on it.
# To report history:
#
# cd ~/.todo;git log -p --oneline --since=@{1.weeks.ago}
#
# To initialize
# mkdir .todo; git init .todo
if [ ! -d ~/.todo ]; then
mkdir -p ~/.todo
cd ~/.todo
git init
touch todo
fi
cd ~/.todo
if [ "x$1" == "xlog" ]; then
git log -p
exit
fi
EDITOR=${EDITOR:-vim}
$EDITOR todo
git add todo
git commit -m 'Updated using todo script'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment