duncanlock.net

How to slugify strings in bash, using a fairly simple function.


Sometimes I want to resolve several promises at once, then do something when they're all done. For example, make several API calls, then do something with all the results. Promise.allSettled is a better way to do this.


My new favourite thing in JS is Nullish coalescing: The nullish coalescing operator (??) is a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined, and otherwise returns its left-hand side operand.


Time for another update on the Retro Gaming project. It’s been roughly a month since the last update and we’ve been playing a bit more often this time.

Favourite Games So Far

Roughly in order of playtime:

Gauntlet is far and away the kids favourite game so far. Almost nothing else got a look in since I put it on. Even Super Mario Bros is a pretty distant second place, and the other games have barely been played at all.

I think there are two reasons for this. Firstly, Gauntlet is a 4 player co-operative game. So far we’ve only played with two players, but even then, co-op games are just really fun. I think the other reason is that Gauntlet is an arcade game and Super Mario Bros isn’t …

Read More

Time for an update on the Retro Gaming project. It’s been almost four months since we started and it’s been, predictably, lots of fun. What with work and school and everything else, we have very little time for playing computer games. That, combined with a fairly dry winter & spring letting us get outside more, means that even with the Covid-19 pandemic curtailing activities, we haven’t clocked very many hours of playtime.

Favourite Games So Far

Roughly in order of playtime:

In the end, we didn’t actually play any ZX Spectrum or C64 games at all, sadly. I played a lot of these when I was a kid, so I was secretly disappointed …

Read More

Asciidoc
Figure 1. Asciidoc.

I’ve been using reStructuredText for writing on this blog, because it has lots of built-in features that markdown doesn’t.

However, reStructuredText’s actual syntax is a bit…​ fiddly - particularly its non-atx headings, too many things relying on lining up white space, etc…​ If I don’t use it for a bit, I have to look up or copy & paste all the advanced syntax.

I’d prefer to use AsciiDoc, as it has all the extra features, and if you use Asciidoctor, all the simple stuff is the same as markdown - which isn’t (currently) standard AsciiDoc, but is a nice simplification.

The subset of features from reStructuredText (or Asciidoc) that Markdown doesn’t have – and that I’m actually using on this blog, are:

  • Figure/Images with captions
  • Admonitions
  • Front-matter/Metadata
  • Footnotes
Read More

Galaxians vector
Figure 1. Galaxians.

As a family gift for Christmas 2020, I set up a Raspberry Pi 400 with Retropie. The plan is to load a selection of the “best of the best” games from computer game history, starting with games up to, roughly, 1985.

The kid doesn’t really know any better, so we can play Space Invaders unsullied by time and expectations and enjoy a speedrun through gaming history, playing just the highlights.

I’ll add more games as we go along, progressing through gaming history, one classic game at a time.

Read More

Spiralized carrots & daikon radish, with halved Jalapeno, in the brine ready to ferment.
Figure 1. Spiralized carrots & daikon radish, with halved Jalapeno, in the brine ready to ferment.

This is a rather loose adaptation of a traditional Vietnamese recipe, often used as a filling in Bánh Mì. You can google for lots of variations. Đồ Chua is often made as a vinegar pickle, with added sugar – this recipe is a keto/paleo & sugar-free lacto-fermented version.

The basic idea is to spiralize (or grate) & mix everything, except the chilies. Then pack all the spiralized vegetables into jars, with the halved chilies slid down the side, topped up with brine.

Start by making the basic brine and leave to dissolve while you prepare the vegetables.

Basic Brine

Important to measure carefully. This is the brine I use for most simple ferments, unless I find a recipe that has a good reason for using something different …

Read More

Two mason jars, full of fermenting cucumbers.
Figure 1. Two mason jars, full of cucumbers, just gone in. Both using this recipe, one with added chilli flakes, one with added Sichuan pepper.

Here’s my lacto-fermented cucumbers recipe. This is adapted from the great Wild Fermentation book. I’ve honed this recipe to perfection over many trials – but you’ll need to try it a few times and adjust it to your particular cucumbers, climate & tastes, I expect.

Although mini-cucumbers are the archetypal “pickle”, this recipe is not limited to just cucumbers. Pretty much any crunchy vegetable can be fermented like this. Basically, any vegetable that’s crunchy will ferment well this way.

This is essentially two recipes: one for making the “basic brine” – which I use for lots of similar ferments – and one for making the fermented cucumbers, using the brine. Both recipes are very simple …

Read More

Blueprint style diagram showing a Teapot.
Figure 1. A teapot, cut in half. Sort of. Original clipart Kitchen Utensils Silhouette, by GDJ, Public Domain. More on Teapots.

I’ve had a mysterious broken page on this site for a while - but been too busy to look into it. My Comprehensive Linux Backups with etckeeper & backupninja article has been refusing to load, and returning a weird HTTP 418 Unused status code instead. I finally made the time to figure out the cause.

It turned out that this was being caused by the Apache/PHP mod_security module. This is a static website - there’s no PHP anywhere - so why would that be a problem? Well, so far I’ve been very happily hosting the site on my old DreamHost shared hosting account - which comes with Apache & PHP installed whether you want it or not. At some point I …

Read More