Pragmatism in the real world

2022 in pictures

We've reached the end of 2022. We're a little bit further from the COVID-19 pandemic and I've travelled more this year too. A bitter-sweet year when a close friend died and I managed to catch COVID-19 again, but fortunately wasn't as affected as last year and recovered more quickly. I continued to take a photo every day though my Project 365 which allows me to appreciate what happened during this year of my life. January… continue reading.

Only display body on error with curl

Sometimes, I only want to display the response from a curl request if it errors – i.e. the status code is 400 or higher. With curl 7.76 or greater this is done using the –fail-with-body parameter: curl -s –fail-with-body \${id} \ -H "Content-Type: application/json" \ –data "@data.json" On success, the return code ($?) is 0 and on failure the body is output with the return code set to 22. Prior to 7.76, you can… continue reading.

Override Nginx media type for a URL

I followed Maarten Balliauw's article on setting up a pointer to my Mastodon account on my own domain at I'm not sure how useful it is and would prefer to have my own domain as the main account. Something to think about at least. When setting up, I realised that it was being served with a Content-Type of application/octet-stream, when it should be application/json. To fix this, I added this to my… continue reading.

Installing Xdebug on PHP 8.1 installed with Homebrew

I have recently set up a new M2 MacBook Air and as usual, installed Homebrew and then installed PHP. Homebrew is always up to date, so it installed PHP 8.1 for me. Again, as usual, I installed Xdebug using pecl install xdebug. This whirrs and clicks for a while downloading and compiling the and then fails with: rob@ardent ~ $ pecl install xdebug downloading xdebug-3.1.5.tgz … Starting to download xdebug-3.1.5.tgz (232,070 bytes) … Build… continue reading.

BBEdit Hosts File Syntax Highlighting

While editing my Hosts file in BBEdit, I wondered how hard it would be to create syntax highlighting for it. A quick google later, I discovered that I needed to create a Codeless Language Module and this is my first attempt: To install, download Hosts.plist and copy to your iCloud Drive's BBEdit/Application Support/Language Modules directory, restart BBEdit and you're done. I've kept it really simple and just highlight comments and the IP address, but it… continue reading.

Background images and multiple styles in rst2pdf

Over the weekend I released rst2pdf 0.99. The list of changes is quite long as it's been over a year since the last release. There are some key things in this release that I'm particularly pleased about including Python 3.9 and 3.10 & Sphinx 4 support, multiple styles in the class directive and the ability to specify background images in the raw:: pdf directive. There's also a number of bug fixes, particular to math rendering… continue reading.