Which day of March 2020 is today?

Today is March the 189th, 2020.

I like the COVID meme of counting the days since the beginning of March, the approximate beginning of the pandemic here in the US. Somehow it nicely expresses how frustratingly long and bizarre this year has been.

Here’s a quick shell one-liner to get the date:

echo "Today is March the $((($(date +%s)-$(date +%s --date "2020-02-29"))/(3600*24)))th"

oh my zsh

I’ve very recently switched to zsh with oh my zsh as my primary shell. I’d seen a colleague make the switch, and didn’t really understand why until I saw his prompt work magic in git repos. The oh my zsh git plugin is fantastic - aside from providing a stable of git-oriented aliases, when you cd into a git repo your prompt will change to reflect which branch you’re in and whether that branch has uncommitted changes.

Come for the git plugin, stay for the tab complete. Being new to zsh, I’m not sure if the tab complete experience I’m seeing is native to zsh or if it’s specific to the oh my zsh environment. Either way, I love it. Tab complete suddenly offers look-ahead completions I didn’t realize I was missing.

Two things that irked me right off the bat:

  • tab complete is case insensitive by default
  • the default robbyrussell theme’s prompt doesn’t show hostname… ssh much?

Changing the tab complete behavior was incredibly easy - simply uncomment the following line in .zshrc:

# Uncomment the following line to use case-sensitive completion.
CASE_SENSITIVE="true"

The second item required a little more research, but was easy enough to achieve. The trick was to add the following PROMPT variable extension at the bottom of my .zshrc:

PROMPT="%{$fg[cyan]%}%m%{$reset_color%}${PROMPT}"

”%m” is the variable for hostname. I made it cyan to match the default prompt’s color and avoid making the prompt any busier.

Now I’m happily typing away in my new shell. There’s so much more that’s available in oh my zsh, and I may get to some of it. I never exhausted bash’s capabilities either. For me it’s the little functional improvements in the things I use all the time that have made this switch so enjoyable.

Cheers!

Moved the site to AWS Amplify Console

For years I’ve hosted this site and a few others on a Linode VM running nginx, which was fine, but in the process of tidying up my monthly spending I decided to look for a cheaper alternative. I decided to go back and look at the hugo lambda project that I’d come across when I first started using Hugo to build my site. Somehow that led down a path to AWS Amplify Console for hosting static sites, and it seemed like just the sort of “serverless” web hosting I was looking for all bundled into a simple interface.

For my needs it was perfect. I just hooked it into the git repo I use for this Hugo site. It automatically detected the hugo build settings, and now every time I push to the master branch it triggers a build and deploys to Amazon’s Cloudfront CDN. Other neat features include the ability to specify alternate branches in git for test sites, etc. They can be configured to deploy to alternate URLs and the build system supports per-branch environment variables. This means for the ‘test’ branch, I can specify the HUGO_BASEURL as https://test.plain.cool and have a fully functional test site.

Older Posts: