Terminal's every developer's best friend; I use mine terminal for almost everything, writing/executing custom scripts, restarting Spotify, opening different IDEs/Editors and what not.
When a new session pops up, my main focus is make minimal efforts and optimise productivity, which, for me is driven by streamlining my priorites and deliverables.
Thus, I had to find a way to combine my terminal and notes/TODOs, and here we are.
First, you have to install and signup on the Simplenote app on your mobile. This will act as the end client for saving your notes.
Our script makes calls to the simplenote API, so we have to install this:
sudo pip install simplenote # using python's package manager since we'll be using this in a python script
or
sudo easy_install simplenote
Both of these need root permissions, so don't shy from providing your device's password on prompt 🤔 🤭
For MacOS, you'd have to create an executable file in /usr/local/bin/
Open a new terminal session and change directory to /usr/local/bin/
using your relative path.
For me this was
cd ../../ # going back 2 levels
cd /usr/local/bin
# this could be shortened to cd ../../usr/local/bin
Now, you must create a file to execute the script in:
touch note
This will create a file called note
in the current directory.
To edit this, you can open it in an editor of your choice.
For me, this was VSCode:
code note
Now paste the script below into your file. Remember to replace the email and password parameters with your credentials from the app.
Now, let's make this script executable:
chmod +x /usr/local/bin/note
This script runs using 3 types of parameters:
This only contains the note's content:
note 'this is the note content'
Note, if you've named your file something else, replace note
with your filename (the script would only run if the filename is met).
This contains a custom tag wherewithal the note's content:
note github 'remember to upload this gist'
Simplenote can also tag certain notes; this would help you organize and find your notes through tagging. If there are 3 arguments, the second argument is parsed as a tag.
If a tag is not provided, the default tag is 'terminal'. You can change this in Lines 15 and 37.
note github Terminal_Notes "I need to upload everything about the notes from terminal thing from the setup to use"
Simplenote saves the first content as a header. If the script call is provided with 4 arguments, it parses the second as the tag, third as header and the fourth as content.
The default header is 'TODOs'
All headers are prefixed with the date.
Simplenote saves the header on top with the date, tags your note with the day and the tag provided. Each note is stamped with the time of submission.
The original code and method was described by Matt Dziuban in his BOSTINNO post I've only made small additions to their script and the original idea is to be accredited to them.