Discover more from hrbrmstr's Daily Drop
Drop #273 (2023-06-01): Getting The Gist Of Git
gist-reveal; bash blog; GitHoot
Back in the day, Mike Bostock figured out a cool way to abuse GitHub’s, er, “generosity” to host D3 scripts and associated resources as self-documenting visualizations. While the launch of ObservableHQ caused the eventual death of those
bl.ocks, there are other ways to also abuse this free service from Microsoft to publish other types of content
Today, we’ll look at three of them. (Also: TIL — accidentally — that Substack supports embedding Gists, which means future source code embeds will be far less icky. It’s also why the one Gist link is not an actual link.)
I confess to using Keynote to craft most of my presentations, but also use Quarto Reveal.js slides for code-driven decks that usually contain some interactive data visualizations. Reveal.js is great! And, if you’re keen to use it directly, you can now abuse GitHub Gists — which are full git repos — as a hosting platform for them via gist-reveal.
You can create your own deck by forking a copy of this GitHub Gist:
https://gist.github.com/ryanj/af84d40e58c5c2a908dd; or, by placing any valid Reveal.js
<section> tag content into a fresh gist. Then your clever creation will be at http://gist-reveal.it/YOUR_GIST_ID_HERE.
There are instructions on how to use Kubernetes (ugh) to host your own version of the service, plus information on how to host an index of all your creations via Docker.
If you’ve ever hit the GitHub rate limit when tapping raw GitHub URLs, you’ll be glad to know that the Docker setup supports using your GitHub application token to avoid this. For folks who use Google Analytics, you can also embed your GA-code if you go the Docker route.
There’s even a way to use the neat socket.io service (which I really need to cover) to network broadcast your slideshow to other browsers.
Those in the “roll up your sleeves” crowd can head on over to gist-reveal’s GH repo to see how the magic is made.
As noted, GitHub Gists are full git repos. They are also part of GitHub’s API, and have some basic attributes — such as visibility controls and the ability to ⭐️ a Gist.
hits the GitHub API to look for Noel’s public, ⭐️’d Gists
jqto filter down to Gists where Noel is the owner, it’s newer than a given date, and has a
iterates over the Gists & extracts several properties
writes out some Hugo front matter to a file per Gist / post
READMEas the post content
uses a Hugo template to add embed script tags for each interesting file (remember, Gists are full git repos).
On the backend, Noel currently hosts the blog on Azure Storage and uses an Azure Function proxy as the frontend. The Hugo site gets built in Azure DevOps per-commit to master for regular posts. And there is a daily build trigger to pick up new starred gists.
It’s pretty clever! And, pretty straightforward to mimic.
I learned about GitHoot through monitoring posts about Tailscale. That link is a long, technical, ranty read (so, ofc I 💙 it), and not necessary to pore over before continuing here.
The GitHoot service is kind-of a combination of what’s going on in the previous two sections, and enables you to use GitHub Gists as a blogging platform that’s front-ended by GitHoot.
To start, er, “hooting” pick a subdomain — say,
hrbrmstr.git.ht — and claim it by going to that URL and logging in with GitHub. NOTE: you do give GitHoot some gist write permissions by doing so, and you'll see why in a bit.
Subsequently, any public gist with a
hoot.md will become part of your GitHoot blog. Here's my
You can always link to your most recent most via a special /latest path.
Every gist you publish becomes a “hoot”, which means it gets its own nicely rendered page enriched with Twitter and OpenGraph tags. This way your readers get to enjoy a fancy preview of your post with image, title and description as well as its content.
Remember: Gists support comments, so you get reader interaction for free as well.
For freeloaders (my $WORK affectionate term for folks who do not pay for services), the subdomain remains active for a week. While it can be reclaimed after said 7-day expiry, someone else could claim it on you. Subscribe for at least a month (subs are $3.99/mo) to keep the subdomain forever and all its links forever. Even if you cancel your subscription. (As usual, I get nothing for linking to a paid service.)
This is also super-clever, and the tech behind it (which is in the first link in this section) is pretty neat.
The only real “downside” from my PoV is that the post URLs aren't SEO friendly.
Finally, getting back to that "writeable” NOTE: if you've already logged in but use a different system or browser to go back to the service, it will post a short-lived URL in a seekrit Gist in your account to let you easily log back in. More evidence of how super-clever the site is.
Full disclosure: I'm paying the $3.99 primarily to ensure that my handle stays claimed and to support the development. You can file issues for feature requests/bug reports, and keep an eye on these folks since they seem to have something fun cooking in the “online identity” space.
Folks who see my 🐘 posts already have a hint at tomorrow's WPE. For the rest of y'all: stay tuned! ☮
If you’re OK with them eventually pulling the plug on it, as
$BIGCORPs are wont to do)