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: https://foosel.net becomes view-source:https://foosel.net.

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://net.dinglisch.android.taskerm.fileprovider/external_files/path/to/the/file (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 https://raspberrypi.stackexchange.com/a/108107 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

How to sync starred GitHub repos to Raindrop via NodeRED

The following flow syncs starred repos of a GitHub user to Raindrop.io every 10min and on trigger: “Every 10min” is a cron trigger node that fires every 10min. “timestamp” is an inject node for triggering the flow manually. “Starred repos for foosel” is an HTTP GET request against https://api.github.com/users/foosel/starred, set to return an object parsed from the response JSON. Change foosel to your own username. The “Preprocess” function node has this source:...

June 16, 2022 · 1 min
Mastodon