RSSAmplifier

Blog

duncan­lock­.net

duncanlock.netRSS feed ↗67 posts

Latest posts

Sci-Fi Short Stories to Read Aloud with the Kids

I’ve been trying to read a Sci-Fi(ish) short story to the kids at bedtime, in between other longer books. This is how it’s been going. Really Successful Stories These are the stories they love, that they ask for and that we’ve read multiple times. The stories that have really worked generally get this kind of “mind blown” reaction from the kids at the end – which is very satisfying! These are…

Super Fast Reader Mode for the Entire Web, with Dillo Plus

Want Reader Mode for almost the entire web - and have every page load nearly instantly? Here s how. There are three main constellations of Web Browsers - ones based on Google s Blink rendering engine (used in Google Chrome, MS Edge, Vivaldi, Brave and others), ones based on WebKit (used in Safari on MacOS & iOS 7 iPadOS) - and on Mozilla s Geko engine (used by Firefox & Thunderbird). There are…

Thanks, David Peter (sharkdp)!

It s too easy to overlook the countless hours of dedication poured into the open source software that powers our digital lives. I want to take a moment to express my appreciation and admiration for one of the many unsung heroes of my digital world, who s software I use all the time. David Peter / sharkdp GitHub Profile GitHub Profile Location: Stuttgart, Germany Followers: 5684 Public Repositories…

Debugging with an existing browser instance, or Brave in VSCode

If you want to use an existing instance of a browser to debug in VSCode - instead of always launching a new one - you have to: Change the shortcut that you use to start the browser, to add --remote-debugging-port=9222 on the end of the command line, so that it always runs in debug ready mode. Use a wildcard for the url in your launch.js config file. To debug web apps in VSCode with Brave - add…

Thanks, Zachary Yedidia (zyedidia)!

Open source developers are often the unsung heroes of the technology world, creating & maintaining the software that powers our digital lives. Sadly, their contributions often go unnoticed, but without their dedication and expertise, much of the software & digital infrastructure what we take for granted today wouldn t exist. I want to recognize the brilliant work of one developer and express my…

Using git hashes in Vite & VueJS

To use a git hash in Vite, install git-rev-sync : $ pnpm install git-rev-sync --save then add this to your vite.config.ts file: // Make some git info available as env var - must start with VITE_ import git from ' git-rev-sync ' process . env . VITE_GIT_COMMIT_HASH = git . short () Then add this to your Vue component to use it: const gitHash = import . meta . env . VITE_GIT_COMMIT_HASH then you can…

Thanks, Andrew Gallant (burntsushi)!

Open source developers are often the unsung heroes of the technology world, creating & maintaining the software that powers our digital lives. Sadly, their contributions often go unnoticed, but without their dedication and expertise, much of the software & digital infrastructure what we take for granted today wouldn t exist. I want to recognize the awesome work of one developer and express my…

Fixing apt: Key is stored in legacy trusted.gpg keyring Warnings

If you see messages like this when running APT updated on Debian/Ubuntu systems: W: https://download.virtualbox.org/virtualbox/debian/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details. This is because using apt-key - particularly the mechanism where it dumps all its keys into one large file…

Automatically Publishing a Blogroll from an OPML File

I run a Miniflux instance on my desktop computer, which fetches all my feeds and makes the content available locally. Inspired by a discussion the other day on HackerNews , I wrote a little script that asks Miniflux for a list of my feeds in OPML format and turns it into an AsciiDoc page, which I publish on here, as my BlogRoll & Links page : import os import sys import urllib.request import…

Review: Morcheeba Blackest Blue Tour, Vancouver 2022

Music great, lighting great, encore fantastic. Loads of audience participation, singing and dancing throughout. Fun! I don t particularly like the Commodore Ballroom, as a venue. It s OK , but it s a bit of an echoey box. The sound for Loviet, the warm-up band, was a bit echoey and too loud, lyrics indistinct. They pulled it together though and the sound for Morcheeba was great . I was about four…

Review: Florence + the Machine Gig, Vancouver 2022

Just experienced the incredible, joyous, wonderful Florence + the Machine in Vancouver. Amazing. I m officially part of Miss Haversham s cult now! I ve been a fan for ages; their music just really lifts me up. This is the first time I ve seen them live, and they really blew me away - what a great show! This was their first tour post-covid, so included some emotional tales about how the pandemic…

Supply Chain Attacks & Package Managers - a Solution?

In this When Will We Learn post, Drew DeVault talks about supply chain attacks against language package managers (npm, PyPI, cargo, etc ) - and compares them to official Linux distribution repositories (deb, rpm, etc ). The conclusion drawn was: The correct way to ship packages is with your distribution s package manager. These have a separate review step, completely side-stepping typo-squatting,…

Review: Sigur Rós World Tour, Vancouver 2022

Good, but I didn t feel very engaged with the music. I was in the Lower Orchestra section, in the 16th row - and pretty tired, that Monday evening. I like their music, but I found myself drifting off, thinking about other things. Thinking much at all is a bad sign for me when I m watching live music. I usually find it very engrossing & uplifting - ideally, I get carried away by the music and exist…

Using Windows after 15 years on Linux

I ve been using Linux exclusively for ~15 yrs. I ve recently started a fantastic new job the only wrinkle was that it came with a Windows 10 laptop. This is my first time using Windows after a 15-year break. This is how it s been going. First Impressions Windows is such a mess ! It s sort of shocking how much of a mess it is. Desktop Linux is often criticized for this, but Windows is much worse,…

Write to Minister Guilbeault Opposing Bay Du Nord Offshore Oil Development

The last thing we need right now is new fossil fuel projects. Send a message to Minister Steven Guilbeault and key cabinet ministers, calling on them to reject the Bay Du Nord project and investing in a just transition instead: https://act.leadnow.ca/bay-du-nord-ett/ This is what I wrote, if anyone wants some ideas: To Minister Guilbeault and cabinet, I m writing to you to urge you to reject the…

Review: Nick Cave & Warren Ellis Gig, Vancouver 2022

A spellbinding & breathtaking evening, with a couple of surprising jewels, in a night full of riches. Just got back from seeing Nick Cave and Warren Ellis in Vancouver. What a joy and a privilege! I ve missed live music so much - what an incredible night! This is a video from that night in Vancouver, of their cover of Cosmic Dancer, which was a fantastic surprise for me. That video was taken by…

The Python Black formatter outputs to stderr, not stdout

Which is fine - it s reporting errors, after all. So, if you want to capture the output to a file in Linux/Bash, you need to do it like this: $ black --check . 2> black-report.txt or like this to also output to the console, so you can see it: $ black --check . 2> >( tee -a black-report.txt > &2 ) Bash has a shortcut for this, but you lose the return code from black: $ black --check . |& tee…

Windows PowerShell aliases can’t have parameters, you need to write a function.

On linux, you can create aliases for commonly used commands. These can be pretty much anything you like. Here s an example, which creates a command called ports , which runs the stuff in quotes: # List all the ports that are currently open, with the processes that are listening alias ports = "sudo netstat -tulpn | grep '^tcp' | awk '{print \$ 1, \$ 4, \$ 7}' | sort -n | uniq | column -t" On…

Templating JSON data into a Variable, in Bash

Building a JSON string in Bash can be pretty fiddly and annoying, with quoting and formatting and variable substitution, etc If you only have a little JSON , using a printf template works well, like this: #!/usr/bin/env bash # Your printf template string template = '{ "state": "%s", "key": "%s", "description": "%s", "url": "%s" }' # Variable to store your rendered template JSON string data = "" #…

Three Editor Use Cases

I have three different text editors, that I use for three distinct use cases. I m a software developer, so I basically edit text files for a living, and the editing software that I use for this is fairly important to me. Projects For any substantial editing, either for work, or for personal projects, I currently use Visual Studio Code - generally known as vscode . It s good enough: it s extremely…

Styleable Inline SVG Icons, with Caching & Fallback

Figure 1. This pages tag list is using this tag icon from FontAwesome . This is a 550 byte SVG file, 346 bytes gzipped. If you want to use SVG icons on a website and style them with CSS - then the SVG needs to be inline - i.e. the SVG markup needs to be included with the rest of the pages HTML markup. Unfortunately putting things inline means that they can’t be cached. In this article I’ll show…

You Should Write to Your UK MP about Corruption Now

I ve just emailed my UK MP to complain about government corruption & Owen Patterson . You should do the same. As always, we need as many people as possible to speak out. This is what I wrote, if anyone wants some ideas: <My Name> <My Address> <My Email Address> Dear < MP Name>, Like many others, I am angered - but not very surprised - by the latest revelations of government corruption, revealed by…

A ‘git up’ alias that works for any default branch

Traditionally, git s default branch was called master - but this isn t always true, it s just a default - and one that s currently undergoing change. GitHub & GitLab have changed their defaults to main and the git project itself is in the process of doing the same. I have a longstanding git alias - git up - that I use to pull my local checkout up to date with the remote. It s a shorthand for the…

Speedrunning Computer Games History with a 6yr Old - Part 4

Figure 1. Our hand-drawn map of the Kingdom of Hyrule. I drew a 2x1 grid in Inkscape and printed it out, then we filled it in as we went along. It s been about six months since the last update. We ve mostly been camping, playing outside and generally enjoying the summer - although we have also squeezed in some gaming, here and there. Favourite Games So Far We spent almost all of our game time…

How to Contribute a Change to Nginx

Figure 1. The nginx “Welcome” page, before & after my intended change. I wanted to add dark mode support to the default nginx “Welcome to nginx” page. This is about the simplest change I could choose to make - it’s a simple, backwards compatible, small additive change to one single index.html file. My initial version of this change looks like this, and is added to the files <style> element, in the…

Cssmin is Unmaintained & has a Bug with Complex :is Selectors

I was using cssmin to compress the CSS on this site during publishing. This has been working fine since April 2013, when I created this new iteration of the site using Pelican . Unbeknownst to me, cssmin has been unmaintained since October 2013. This didn t cause any problems until recently, when I revamped the CSS and started using the new-ish :is selector . So a selector like this: .content :is…

Custom Per Page CSS With Pelican

Sometimes I want to have a just a tiny bit of CSS that’s unique, just for one page or post. I don’t want a whole stylesheet, or to have to add this to my site-wide theme, just for one post – I want a simple way to add it in the post itself. This is how I did it:

The CSS :is selector is pretty neat

I found out about the CSS :is selector today, via this Things I Learned Reading Webkit s UA Stylesheet article. It takes a selector list as its argument, and selects any element that can be selected by one of the selectors in that list. This is useful for writing large selectors in a more compact form: /* Instead of this: */ .content p > code , .content td > code , .content li > code { /* ... */ }…

Don’t Put Eggs Under Your Tomatoes, if you have Raccoons

They will dig up your garden to get them. I ve seen various recommendations for breaking an egg into the bottom of the hole when you plant out tomatoes. Apparently, this works and increases yield: It s just a form of fertilizer, so this isn t too surprising. I ve tried this in previous years and it seems to work. Sadly when I did it again this year, the raccoons decided they wanted the eggs and…

Running python webservers on port 80 without root

If you want to have a python webserver running locally and listening on port 80 or any other port < 1024, you can do it like this: $ sudo setcap 'cap_net_bind_service=+ep' /usr/bin/python3.8 This gives the /usr/bin/python3.8 binary the ability to bind to privileged ports without being root. Note that this only works for real files, not symlinks, so this will probably not work, as python is…

Ninja is a surprisingly nice build system for tiny projects

Ninja is a surprisingly nice build system for tiny projects. That s more or less the opposite of what it s designed for, but it works really well for tiny things things that are small enough that you can just create the little build file by hand. You just need to install it (you can just put the binary on the $ PATH somewhere) , then create a ninja.build file in your folder. Here s an example that…

Better content-type guessing in AWS CLI

The content-type guessing done by AWS CLI is based on the mimetype definitions available on your system. You can improve the mimetype guessing by updating these definitions. It uses the python mimetypes lib to do this and accumulates its list of mimetyoes from the following files : knownfiles = [ "/etc/mime.types" , "/etc/httpd/mime.types" , # Mac OS X "/etc/httpd/conf/mime.types" , # Apache…

Fixing content types in s3 using the AWS CLI

I had an issue where the AWS CLI wasn t guessing the content-type of SVG files correctly on sync and was setting them to application/octet-stream - the default I don t know mimetype. There s a proper fix to make the mimetype guessing work here . This is a quick fix for stuff that s already been uploaded to s3: $ aws s3 cp --exclude "*" --include "*.svg" --content-type = "image/svg+xml"…

Lessons from Two Years of Fermenting

Figure 1. Three mason jars, full of fermenting vegetables. Two Bánh Mì(ish) and one eggs. I ve been fermenting vegetables of various kinds (and occasionally other things) at home for a little over two years. It s a fun, interesting & nutritious hobby. On the whole it s pretty easy and low stakes the worst thing that happens is a few cucumbers go mouldy. Because it doesn t involve any heat but does…

Good, simple, Bash slugify function

# Slugify # Transliterate everything to ASCII # Strip out apostrophes # Anything that's not a letter or number to a dash # Strip leading & trailing dashes # Everything to lowercase function slugify () { iconv -t ascii//TRANSLIT \ | tr -d "'" \ | sed -E 's/[^a-zA-Z0-9]+/-/g' \ | sed -E 's/^-+|-+$//g' \ | tr "[:upper:]" "[:lower:]" } This is point-free style so, once you ve declared it, you can use…

Promise.allSettled in JavaScript

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.

Nullish coalescing in JavaScript (??)

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. Nullish Coalescing Operator return this . thing1 ?? this . thing2 ?? ' default ' Also works well with the Optional Chaining Operator , which…

Speedrunning Computer Games History with a 6yr Old - Part 3

Figure 1. Gauntlet, by far and away the kids favourite game so far. 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 (1985) Super Mario Bros. (1985) Gauntlet is far and away the kids favourite game so far. Almost nothing else got a…

Speedrunning Computer Games History with a 6yr Old - Part 2

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…

Using AsciiDoc & Asciidoctor for blogging

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…

Speedrunning Computer Games History with a 6yr Old - Part 1

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…

Fermented Bánh Mì/Đồ Chua(ish) Recipe

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…

Basic Pickles or Fermented Cucumbers Recipe

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…

I finally figured out my mysterious 418/Unused HTTP Status Code

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…

How I upgraded this website to Pelican 3.6

This site has been generated using Pelican 3.3 for over two years - and I finally found some time to upgrade to the current version of Pelican, 3.6.3. This is how I did the upgrade. I decided to be lazy and do the upgrade in-place, instead of creating a new virtualenv and copying the content & settings over. Luckily, this worked out OK , after a bit of fiddling around. I also decided, rather…

Reliably Building VirtualBox Guest Additions on CentOS 6.x

We use CentOS VMs at work to emulate our production environment - and it took me a while to figure out how to get the VirtualBox Guest Additions to build reliably on CentOS 6.4/5. This is what I ve currently settled on as a reliable method. First, make sure that you ve got the kernel headers and tools installed that you need to build stuff: $ sudo yum update -y $ sudo yum install gcc kernel-devel…

It was a Good Week

Figure 1. Taken from my Wife s office window, around 10am. The weather was great this week - crisp and autumnal, with beautiful sunshine all week. It snowed a little on the local mountains and Cypress Mountain has opened for (limited) Skiing already, using the lower temperatures to make lots of extra snow. Whistler also opened this week, along with Grouse. Figure 2. Taken from my Wife s office…

How to create thumbnails for PDFs with ImageMagick on Linux

To create image thumbnails from a PDF document, run this in a terminal window: $ convert -thumbnail x300 -background white -alpha remove input_file.pdf[0] output_thumbnail.png The parameters to convert do the following things: Parameter Effect -thumbnail Similar to -resize, but optimized for speed and strips metadata. x300 Make the thumbnail 300px tall, and whatever width maintains the aspect…

The Better Figures & Images Pelican plugin now supports Figure Numbering

Figure 1. This figure has automatic figure numbering. I had a feature request for automatic figure numbering, like latex. I was revamping this plugin for Pelican 3.3 anyway - and this didn t seem too hard - so I decided to add it. So, the Better Figures & Images plugin now supports automatic figure numbering. To enable this for all posts, just add this to your config file: FIGURE_NUMBERS = True If…

How I upgraded this website to Pelican 3.3

There are quite a few changes in Pelican 3.3 - most of them minor, but a few which might mean making some changes to your site in order to upgrade. This is what I did to move my site from Pelican 3.2 to 3.3. The change that had the biggest impact and took the most work was around image linking - caused by a combination of things. I think I was doing it wrong before and things changed in a way that…