2 minute read

Originally published on Substack.

I’ve always wanted to document my life and have been doing a very inconsistent job of writing a journal once every 6 months.

Recently, I was reading The Unabridged Journals of Sylvia Plath and realised journals don’t have to be a page long, they could just be a couple lines about the day.

I wanted to make it easier to write my journals and store it in a place. To incentivise writing more journal entries, I had to make it easier first. I thought, if I could write my journal anywhere and it would magically get stored somewhere relatively permanent, I’d write it more often.

Journaling is the easiest on your phone because you can write about anything and anywhere! I had just come across the wonders of Apple Shortcuts (super late, I know!) and realized I could do something with it to fetch the data from the notes app on my phone.

I wrote this shortcut with AppleScript (new language to add to my resume!) that fetches the text from the note. It looks for the note with a particular keyword, the title (e.g. ‘Entry’) in this case and finally, erases the content such that new entry can be added for when I feel like writing another journal entry.

Now that we have extracted the text, since the output is HTML, we need to process the text a bit more after which we can save it to a file.

Now that we have the file, we need to store it somewhere. I decided to store it in my private github repository. But I don’t want to do it manually because then I’d never write a journal entry.

Let’s create a shell script which pushes the file but how would we get it to run automatically?

Here come cron jobs. Crons are shell scripts that run at scheduled times.

We can set the script to run every end of the day. Actually, we need two cron jobs, one to ask the data extraction shortcut, and one to run the shell script which pushes to GitHub.

But wait, cron jobs won’t work if the computer is asleep. What if my laptop is asleep during the scheduled time? My journal wouldn’t be saved, what’s even the point of writing one then :/

Well, we can just programmatically wake up the laptop by some power management commands.

sudo pmset repeat wake MTWRFSU HH:MM:SS

This command tells your computer to wake up around the scheduled time throughout the week. Fun fact, day code for Thursday is R and for Sunday is U.

If you got all this working, you have no reason to not journal everyday!

Anyway, thank you for reading! I have a midterm in a couple days and I spent an embarrassing amount of time doing this.

Updated: