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

Sure thing.

It's a script called "d" (for diary) that I keep in my home folder. I try minimise mouse usage, so I've got a keyboard shortcut for opening a terminal, and then in the terminal I run ./d

=== start of script ===

#!/bin/bash

y=`date +%Y`;

ym=`date +%Y-%m`;

ymd=`date +%Y-%m-%d`;

if [ ! -d "Dropbox/diary/$y" ]; then

    mkdir Dropbox/diary/$y
fi

if [ ! -d "Dropbox/diary/$y/$ym" ]; then

    mkdir Dropbox/diary/$y/$ym
fi

vim Dropbox/diary/$y/$ym/$ymd.txt

=== end script ===

I could probably refactor the hell out of this. But I'm an old beard that prefers explicit readability. For example I don't need to use YYYY-MM for the month sub-folders (I could just use MM), and similarly I don't need the full YYYY-MM-DD.txt for the day files (I could just use DD.txt) - so your preference may vary.

And yeah I use .txt files because I can edit those natively in the Dropbox app on my phone too. Don't need any special apps installed to manage my notes on the go.

In terms of the contents of the files, I've kept the searchability really simple by using hashtags, example:

=== Dropbox/diary/2020/12/04.txt ===

## #keyword1 #keyword2

Here be notes on keyword1 and keyword2.

## #keyword3

Here be notes captured later on the same day on keyword3.

These can span multiple lines if I want.

## #keyword4

Here be notes on keyword4 captured even later in the day.

===

I use the single hashtag keyword system for quick grepping (and future indexing if I want to build a searchable database out of this one day), and the double hashtag ## at the start of each note snippet so that I can parse individual snippets more easily.

Hope that helps! :)



Thank you so much! I really appreciate it! (And sorry for the way delayed response... I went to bed shortly after posting.)


Quick tip, you could replace the ifs with

mkdir -p Dropbox/diary/$y/$ym


Neat, thanks!




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: