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.
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.
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
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 …
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 cavalierly, to upgrade all the packages in the
virtualenv to their latest versions while I was at it. To do this, I upgraded
pip, then used pip-review. To upgrade
pip & install
pip-review system wide, run this on the command line:
$ sudo -H pip install --upgrade pip $ sudo -H pip install pip-review
Then upgrade eveything in the sites
$ sudo apt-get install libjpeg-dev $ workon duncanlock.net $ pip-review …
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 kernel-headers dkms make bzip2 perl
Make sure that you’ve only got the current set of kernel headers installed - the one for the kernel you’re actually running. Having more than one set installed prevents this working properly. Running this should show you one version of each kernel package:
$ rpm -qa | grep kernel | sort
It should look something like this: