Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've had pretty decent luck with `todo.txt` style tracking, but also tend to run into issues with tasks or notes "going stale" so came up with this system. `today` basically opens `~/Desktop/$YYYY_MM_DD-todo.txt`, but it'll start you off with a copy of the most recent (previous) file.

This lets me have "durable" files (I can grep for pretty much anything and get a date-specific hit for it, similar to doing a `git log -S`), and also lets me declare "task-bankruptcy" without any worry (I can always "rewind" to any particular point in time).

The addition of `report` (aka: `diff $YESTERDAY $TODAY`) is helpful to see what I've added/removed. Yeah, there's better ways to do things, but the degenerate simplicity of `open ~/Desktop/todo.txt` is fantastic. Having the equivalent of `open ~/Desktop/$TODAY.txt` (with no ceremony) has been very valuable to me!

   $ cat ~/bin/today
   #!/bin/bash
   TODO_HOME="$HOME/Desktop"
   TODAY="$( date "+%Y-%m-%d" )"
   TODAY_FILE="$TODO_HOME/todo-$TODAY-todo.txt"
   PREVIOUS_FILE="$( ~/bin/previous )"
   if [[ ! -f "$TODAY_FILE" ]]; then
     cp "$PREVIOUS_FILE" "$TODAY_FILE"
   fi
   report "$TODAY_FILE"
   printf "Press Enter to Continue, Ctrl-C to exit." && read -r PROMPT
   open "$TODAY_FILE"
   echo "$TODAY"

   $ cat ~/bin/previous
   #!/bin/bash
   TODO_HOME="$HOME/Desktop/"
   TODAYS_DATE="$( date "+%Y-%m-%d" )"
   MOST_RECENT="$( ls "$TODO_HOME"/todo-*-todo.txt | sed 's/^.*todo-//g' | sed 's/-todo.txt//g' ; echo "$TODAYS_DATE" | sort )"
   PREVIOUS="$( echo "$MOST_RECENT" | awk -- "BEGIN { YET=0 } /^$TODAYS_DATE/ { YET=1 } { if ( !YET ) PREV=\$0 } END { print( PREV ) }" )"
   PREVIOUS_FILE="$( echo "$TODO_HOME/todo-$PREVIOUS-todo.txt" )"
   echo "$( realpath "$PREVIOUS_FILE" )"

   $ cat ~/bin/report
   #!/bin/bash
   TODO_HOME="$HOME/Desktop"
   TODAY_FILE="$TODO_HOME/todo-$( date "+%Y-%m-%d" )-todo.txt"
   PREVIOUS_FILE="$( ~/bin/previous )"
   echo "${PREVIOUS_FILE}...${TODAY_FILE}"
   diff -U0 "$PREVIOUS_FILE" "$TODAY_FILE" | grep -v ^@@


I've been doing something similar for 20+ years at: https://github.com/nickjj/notes

    - Running `notes` will open this month's notes for YYYY_MM.txt in your default $EDITOR
    - Running `notes hello world` will append `hello world` to YYYY_MM.txt
    - Running `$stdout | notes` will append another program's output to YYYY_MM.txt (useful for piping your clipboard)
I find this offers the least amount of resistance for quickly adding notes. Every method of input is 2 seconds away on the terminal and grep makes things searchable enough where I can still pull things out from files 5-10 years ago without issues.

I tried YYYY_MM_DD.txt for a while but I found it to be too fragmented. Oftentimes I want to look at a few day's worth of notes at a glance.


You might want to try iso week numbers. Every week starts on Monday and is always 7 days.

Gives you quite a granular time reference but not too fine like days.


I made something similar for myself. It even has the same name!

https://github.com/alabhyajindal/today


This is brilliant - thanks for the great idea




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: