How to use jq to extract new posts from a JSON Feed

I’m currently looking into ways to automate some stuff around new posts on this page (be it blog or TIL post) directly during the page build on GitHub Actions. For this, I first need to be able to reliably detect new posts, from a bash run step. So here’s how to do that with jq. The idea is to get the current feed.json prior to publishing the page, and then compare it to the one that was just generated during the build....

February 2, 2023 · 2 min

How to grep a log for multiline errors

I just found myself in the position to have to grep an OctoPrint log file for error log entries with attached Python stack traces. I wanted to not only get the starting line where the exception log output starts, but the full stack trace up until the next regular log line. The format of the lines in octoprint.log is a simple %(asctime)s - %(name)s - %(levelname)s - %(message)s, so a log with an error and attached exception looks like this:...

February 1, 2023 · 5 min

How to run Playwright on GitHub Actions

Running Playwright on GitHub Actions is fairly straightforward at first glance, however it becomes a bit more tricky when you don’t want to download the whole browser binary zoo on every single CI build. Looking around a bit on how to go about caching these, I came across various approaches listed in this GitHub issue on the Playwright repo. Below is the result of reading through most of them and figuring out what works best for me and my use case (OctoPrint’s E2E tests, npm based test project)....

January 31, 2023 · 2 min

How to add JSON Feed support to Hugo

In order to add JSON Feed 1.1 support to Hugo you need to first add a new jsonfeed output format in config.yaml: mediaTypes: application/feed+json: suffixes: - json outputFormats: jsonfeed: mediaType: application/feed+json baseName: feed rel: alternate isPlainText: true This adds a new media type application/feed+json with the extension json and creates a new output format jsonfeed rendering into that media type with a base name of feed (so feed.json as recommended by the JSON Feed spec)....

January 29, 2023 · 3 min

How to view the page source on Firefox and Chrome mobile

Viewing the page source on Firefox and Chrome mobile is as easy as prepending view-source: to the URL. Example: becomes view-source:

January 28, 2023 · 1 min

How to detect Termux in a script

If you need to detect whether you are running in Termux from a bash script, check if $PREFIX contains the string com.termux: echo $PREFIX | grep -o "com.termux" This can also be used to set a variable in a Taskfile: vars: TERMUX: '{{and .PREFIX (contains "com.termux" .PREFIX)}}' Source

January 23, 2023 · 1 min

How to open a file from Tasker in Markor

In order to open a file from Tasker in Markor (e.g. to edit a newly created blog post), create a “Send Intent” step with: Action: android.intent.action.SEND Cat: None Mime Type: text/plain Data: content:// (be sure to replace /path/to/the/file with the absolute path to the file you want to open) Package: net.gsantner.markor Class: net.gsantner.markor.activity.DocumentActivity Source

January 21, 2023 · 1 min

How to edit an STL file in FreeCAD

Create a new file “File” > “Import”, import the STL Select the Part workbench Select the imported model “Part” > “Create shape from mesh”. A tesselation distance of 0.10 should work. Delete or hide import. “Part” > “Convert to solid” Source

September 30, 2022 · 1 min

How to add an audio delay for video conferencing on Windows

Situation OBS used for video conferences through the virtual camera. Audio virtualized and with active OBS filters applied (limiter, noise suppression) through means of setting the monitor device to a sink created with VirtualCable and using its source in the video conferences tools. Problem The camera feed has a slight delay of 300-400ms. The audio is thus ahead. Adding a delay through OBS doesn’t get applied to the monitor device (Source):...

September 29, 2022 · 2 min

How to determine an RPi kernel version and build without booting it

To figure out the kernel version and build without booting it, e.g. to install matching device drivers during an automated image build in something like CustoPiZer, use something like this: function version_and_build_for_kernelimg() { kernelimg=$1 # uncompressed kernel? output=$(strings $kernelimg | grep 'Linux version' || echo) if [ -z "$output" ]; then # compressed kernel, needs more work, see pos=$(LC_ALL=C grep -P -a -b -m 1 --only-matching '\x1f\x8b\x08' $kernelimg | cut -f 1 -d :) dd if=$kernelimg of=kernel....

June 16, 2022 · 1 min