Open message:// links with mu4e or fastmail

This is a small variation of the 2019 post on linking to emails from Org mode using Thunderbird, where instead we show how to open the message:// links with mu4e if active, or the fastmail web-app if it is not.

You might remember that message://msg-id-here links represent one of the better ways to link to emails from your PKM systems.

Code

Below is the code. Let me know in the comments if you have any questions.

ThreadPoolExecutor context manager with nested tasks

Introduction

Python’s ThreadPoolExecutor’s context manager is a really neat way to run a bunch of (I/O) work in a thread pool, and then clean everything up when the context is exited.

Something like this:

1
2
3
with ThreadPoolExecutor() as executor:
    for i in range(N):
        executor.submit(my_function, arg1, arg2)

Where did my tasks go, attempt 1

Recently at work however, I had to debug a case where it appeared that it would discard tasks that had been submitted later.

Unison file synchronization directly via the WSL bridge

Background

For years and years now, I keep all of my work, including my checked-out source code, in some form of file synchronization system.

The advantages of having all of your files always up to date on all of the comptuters you work on are considerable.

More practically, I often get up from my work computer, and then continue on my laptop, or on my home computer, without having to think about it, and especially without having to abuse git commits purely to be able to transfer to another machine.

Modify md-roam for frontmatter-less operation

Background

My notes database consists primarily of Emacs Org mode files, interspersed with a small number of markdown files, some of them from previous note-taking systems (for example, I went through a Gollum stage early in 2014, according to my notes then), and some of them for easier mobile consumption and production.

I recently discovered nobiot’s md-roam Emacs package which makes it possible for these markdown files to show up (in sheep’s clothes, as it were) amongst all of my usual org-roam nodes.

Conservative rendering and liberal parsing of ISO 8601 timestamps in Python

You’ll see in Python bug 37962 that datetime.isoformat() and datetime.fromisoformat() use a restricted subset of the ISO 8601 timestamp formatting standards.

This is similar to the subset followed by W3C.

Recently, we ran into the specific issue that fromisoformat() rejects inputs where the timezone is specified as +hhmm instead of +hh:mm.

Both are allowed by ISO 8601, but only the latter is part of the restricted subset.

Following the Robustness principle (also known as Postel’s law) in the design of our APIs, we would prefer to

TypeScript development with Emacs, tree-sitter and LSP in 2022

In this post, I show how to setup Emacs for TypeScript and React (tsx) development, with tree-sitter for syntax highlighting and indentation, and LSP with the TypeScript compiler (including a plugin for faster eslint), via eglot, for code intelligence.

Update on 2022-12-27: emacs 29 has tree-sitter built-in!

Tree-sitter was merged into Emacs core on November 23 of 2022.

The post below is for the situation BEFORE the merge.

If you’re running Emacs 29 or later (as I am at the end of 2022), you should be using the built-in tree-sitter. Let me know if you would like to see a new post dealing with the new merged situation.

Connecting the Shelly 1 to an ET Systems gate motor for Apple HomeKit control

This post shows how you can connect a Shelly 1 unit to an ET Systems gate motor so that you can open your driveway gate via internet.

In my case I opted to flash the Shelly 1 with the brilliant shelly-homekit firmware so that my whole family can control the gate via Apple’s HomeKit, but you could just as easily make use of the Google Assistant or the Home Assistant integrations.

The more important part of this post is how to wire up everything correctly.