Thursday, 24. July 2025 Week 30

Taking screenshots with GNU Screen

In the tmux and gist and trying to make students happier article, Jan-Piet Mens explains how to take screenshots with tmux.

As I still haven't migrated from Screen to tmux, I was wondering if this is also possible in Screen.
And turns out that there is indeed a similar mechanism that can be used in Screen.

By using the hardcopy command, Screen can write the current scrollback buffer to a file.
This can also be done for a detached session:

screen -X hardcopy -h /tmp/myscreenshot.txt

It's also possible to specify an explicit session and pane to use:

screen -p 0 -S 12345.pts-0.rocky -X hardcopy -h /tmp/myscreenshot.txt
Wednesday, 23. July 2025 Week 30

Poor man's docker autoheal

Turns out docker only restarts unhealthy containers when running in a Docker Swarm setup.

For other setups, the following crontab entry provides a quick and dirty alternative that checks for unhealthy containers and restarts them.

*/15 * * * * /usr/bin/docker ps -q -f health=unhealthy | /usr/bin/xargs --no-run-if-empty -L 1 /usr/bin/docker restart
Saturday, 19. July 2025 Week 29

List past docker events

By providing the --since parameter, we can list the past docker events:

docker events --since=60m

This can be further combined with --filter parameters to drill down to specific events of a specific container:

docker events --filter event=restart --since=24h --filter container=<containername>
Tuesday, 15. July 2025 Week 29
Monday, 14. July 2025 Week 29

Classic Web

Classic Web – Screenshots of classic websites and blogs from Dot-Com, Web 2.0 and the 2010s.

Classic Web is a fun account to follow on Mastodon. Curator Richard MacManus posts half a dozen or so screenshots per day of, well, classic websites from the late 1990s and 2000s. Makes me feel old and young at the same time.

(via)

Saturday, 12. July 2025 Week 28
Thursday, 10. July 2025 Week 28

New Style

The slides from the Agentic Coding presentation inspired my inner frontend developer and I created a new style for the blog. ✨

Things are still a bit rough, not everything is fitting nicely yet.
General functionality should work, but please let me know if you encounter something that is broken.

I researched various CSS tricks to achieve the design change without changing any HTML.
After recreating the PDF style in CSS, I double-checked the origin of the presentation layout.
And turns out that it is based on the unnamed community theme created by Elio Struyf for Slidev. πŸ˜ƒ

Monday, 7. July 2025 Week 28

Purple Links

In spirit of the More Purple Links, Please article, I've added some purple color to the visited link style on the blog.
To blend in with the existing text color, I've used the color-mix() CSS function:

:root {
	--body-text-color: #454545;
	--body-visited-link-color: color-mix(in srgb, var(--body-text-color), #518 75%);
}
a:visited {
	color: var(--body-visited-link-color);
	text-decoration-color: var(--body-visited-link-color);
}
Sunday, 6. July 2025 Week 27

Syntax highlighting with the new CSS Custom Highlight API

Inspired by the post from David Bushell, I spent some time to add syntax highlighting to the blog.
It has been an item on my todolist for a long time.
I've always hesitated as I wanted to avoid having server-side rendering that generates a big amount of HTML tags just to add some color.
But now with the approach of using the new CSS Custom Highlight API, this is no longer an issue, as no additional HTML tags are injected.

To make things easy I built my solution on top of the custom <syntax-highlight> element.
This makes it very smooth to add syntax highlighting in a post.
For example the following is the source code for the helloworld.c post:

<pre><syntax-highlight language="c">void main(){puts("Hello World.\n");}</syntax-highlight></pre>

The custom element uses Prism to tokenize the text, which brings support for over 250 different languagues.
This is great, as I've accumulated quite a collection of different code snippets over the years.
There is some Terraform, Python, Perl, PHP, Bash, CSS, Javascript, HTML, Nginx and plenty of others 😎

Friday, 4. July 2025 Week 27