Skip to content

Instantly share code, notes, and snippets.

@jimrybarski
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimrybarski/543a0b1cce1453916c8f to your computer and use it in GitHub Desktop.
Save jimrybarski/543a0b1cce1453916c8f to your computer and use it in GitHub Desktop.
Accomplishments log
# I use this to keep track of things I've done during the day. It's mostly a motivational tool.
# I find that the fear of a sparse log at the end of the day drives me to look for things I can
# accomplish in a short period of time.
# Creating an alias for the script is recommended.
# Usage:
# $ ./accomplish.sh refactored the robot-targeting code
# $ ./accomplish.sh
# Fri Aug 27 | refactored the robot-targeting code
# $ ./accomplish.sh smelted three robots
# $ ./accomplish.sh
# Fri Aug 27 | refactored the robot-targeting code
# Fri Aug 27 | smelted three robots
logfile="${HOME}/.accomplishments.log"
# ensure the accomplishments log file exists
touch $logfile
# everything after the invocation of the script is considered part of the log message
entry="${@:1}"
# formats timestamps like Fri Aug 27
timestamp=$(date +"%a %b %d")
if [ -z "$entry" ]
then
# if no message is provided, just print the 35 most-recent log entries
echo ""
tail -n 35 $logfile
echo ""
else
# add the entry to the log
echo "$timestamp | $entry" >> "$logfile"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment