How I manage my notes25 Mar 2020
I’ve spent a great deal of time customizing my development environment to improve productivity. Git, dot files, IDE profiles, keyboard shortcuts and custom macros are extremely powerful and allow configuring everything exactly how I need them to be for my workflow. All these customizations can also be exported and saved somewhere so that if my machine dies, I can set up a new one in no time.
As a people lead, I take a lot of notes about projects, meetings, decisions and interviews which I haven’t been able to do manage as well as I can manage code. I set out to fix that by finding a solution that met these requirements -
- 🔓 Open format
- 📵 Works offline
- ☁️ Syncs to the cloud
- 📱 Works on mobile
- 🆓 No monthly fee
Armed with these, I started evaluating various options like -
- Google Docs
- Dropbox Paper
- Apple Notes
- Google Keep
Most of these either use proprietary formats or have a monthly subscription fee. Now, I don’t mind paying for products that provide good value, but my career (hopefully) will be longer than the lifetime of those products and I don’t want to deal with lock-ins caused by proprietary formats and spend time looking for alternatives every few years. In the end, I put together a simple solution using tools that every developer is already familiar with.
Markdown is a lightweight markup language with plain-text formatting syntax that I was already very familiar with. Created by John Gruber (of Daring Fireball fame), it is available under a BSD-style open source license thanks to which there are a tons of editors available on all platforms. Given how popular it is, I don’t expect it go away in my lifetime. It also generates simple text files which can be easily synced to the cloud.
While every single IDE/code editor I already have installed on my machine support Markdown, I wanted a simple and distractions-free editor to take my notes. I chose Typora since it is, in my opinion, the nicest Markdown editor available today. The best part about it is that it provides seamless live preview so I don’t have to switch between source and rendered modes. I can, however, easily switch to the source view to make syntactical changes if I need to. It also has really intuitive keyboard shortcuts which are very easy to remember. Typora is technically still in beta, but I haven’t run into any stability issues so far.
I could have easily put all my notes in a Google Drive / Dropbox folder and called it a day, but I’m not a fan of how these companies are approaching their users’ privacy. I’ve almostly completely eliminated Google from my personal life and didn’t want to get sucked back in.
Using Git, I can easily sync all my notes to one or more remote repositories. I created a simple private Git repo in my Github account and started pushing my notes to it. I get version history out of the box and if my computer dies, I just have to clone the repo on the new one.
Committing all new changes manually is tedius though, so I’ve automated it. I first created a simple bash script that commits and pushes my changes.
#!/bin/bash echo "------------------------------------------------------------------" date cd ~/Notes && git add . && git commit -m "Auto sync notes" && git push origin master
To run this script periodically, I created a timed job using
launchd. Since I wanted it to run only when I’m logged in, I created a
plist file in
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>net.mustafaali.syncnotes</string> <key>ProgramArguments</key> <array> <string>/Users/mustafaali/Notes/sync.sh</string> </array> <key>Nice</key> <integer>1</integer> <key>StartInterval</key> <integer>3600</integer> <!-- 1 hour --> <key>RunAtLoad</key> <true/> <key>StandardErrorPath</key> <string>/tmp/SyncNotes.err</string> <key>StandardOutPath</key> <string>/tmp/SyncNotes.out</string> </dict> </plist>
And then enabled it
launchctl load net.mustafaali.syncnotes.plist
This job gets run every hour and runs the script to commit and push all the changes. It also logs the result of the operation to
/tmp in case I need to debug something.
Github recently relaunched mobile apps, so I can access all my notes on the go without installing yet another app.
Github has unlimited free private repos, so I don’t have to pay anything to store my notes. I can also easily add another remote repo, say in Gitlab, to have multiple copies for redundancy.
I have this setup running for several months now and it’s working great! If you have any ideas/suggestions, feel free to leave them below!