Today I Learnt
A Hugo-built static site of Today-I-Learnt (TIL) posts, designed to make it as easy as possible to publish a new post.
This repo provides two Bash scripts for writing a TIL post and capturing screenshots to include in a post.
The theme for the site is a customised version of Etch.
The repo is structured to keep the TIL content separate from Hugo - all
Hugo-related content is in
Checkout the repo and create shell aliases for the two helper scripts:
# ~/.bashrc source /path/to/repo/install.sh
Consider adding this
sourceing to your Bash start-up script.
til_screenshot.sh script requires
imagemagick; both of
which can be installed from Homebrew:
brew install pngcrush imagemagick
Create a new post with:
til that cows cant look up
which will create a markdown file, named by slugifying the description (i.e.
that-cows-cant-look-up.md), pre-populated with Hugo front matter:
--- title: "TIL that cows can't look-up" date: "2020-07-24" tags:  ---
and open Vim in insert mode with the cursor in the appropriate place.
You then add the TIL text.
To add screenshots,
CTRL+Z to background Vim and use the screenshot helper:
til_screenshot Alfred preferences UI
which will trigger MacOS's
screencapture utility to capture a selected portion
of the screen. After selection, the resulting PNG image will be saved to
static/images/ using a filename based on a slugified
$description and the
markdown to include in the post will be added to the system clipboard.
After saving and exiting Vim, the markdown file and any new images will be committed to the repo.