Programming
Wednesday, June 4, 2025
When you run a script as a systemd
service, you have to define its environment variables in the service filem, e.g.
# Set your environment variables here
Environment="OJISAN_INCREMENTAL_UPLOAD_API_KEY=YOUR_ACTUAL_API_KEY_VALUE"
Environment="OJISAN_INCREMENTAL_UPLOAD_DB_USER=your_db_user"
Environment="OJISAN_INCREMENTAL_UPLOAD_DB_PW=your_db_password"
Environment="OJISAN_INCREMENTAL_UPLOAD_DB_NAME=your_db_name"
Environment="DB_HOST=your_db_host"
Tuesday, June 3, 2025
Show systemd
running services as a list
systemctl list-units --type=service --state=running --no-pager
Thursday, April 17, 2025
vim: Jump to specific character on a line
In Vim, to jump to a specific character on a line, you can use the following commands:
f{char}
- Jump to the next occurrence of{char}
on the current lineF{char}
- Jump to the previous occurrence of{char}
on the current linet{char}
- Jump until (one position before) the next occurrence of{char}
T{char}
- Jump until (one position after) the previous occurrence of{char}
For your specific example of “go to first #”:
Creating Obsidian tables of content
When viewing longer Markdown notes in Obsidian, tables of content (TOC) help a lot with navigation. There is a handful of community plugins to help with TOC generation, but I have two issues with them:
- It creates a dependency on code whose developer may lose interest and eventually abandon the project. At least one dynamic TOC plugin has suffered this fate.
- All of the TOC plugins have the same visual result. When you navigate to a note, Obsidian places the focus at the top of the note, beneath the frontmatter. That’s fine unless the content starts with a TOC markup block, in which case it’s not the TOC itself that is displayed, but the markup for the TOC plugin itself as depicted in the image below.
For me the solution was to write a script that scans the vault looking for this pair of markers:
Registering a custom collation to query Anki database
While working on a project that requires querying the Anki database directly outside of the Anki desktop application, I encountered an interesting issue with sqlite3
collations. This is is just a short post about how I went about registering a collation in order to execute SQL queries against the Anki db.
The problem
Let’s try a simple query. Open the Anki database:
An API (sort of) for adding links to ArchiveBox
POST
request. It takes advantage of the archivebox
command line interface. If you are impatient, you can skip to the full source code. Otherwise I’ll describe my setup to provide some context.
A Keyboard Maestro action to save bookmarks to Espial
So this is a little esoteric, but it meets a need I encountered; and it may meet yours if you use Espial, Keyboard Maestro and are on macOS.
For several years I’ve been using Espial a bookmark manager that looks and feels like Pinboard, but is both self-hosted and drama-free1. Espial is easy to setup, stores its data in a comprehensible sqlite database and has an API, which comes in handy when it came to solving the problem I encountered.
FreeRTOS stack size on ESP32 - words or bytes?
FreeRTOS
is accomplished by creating tasks with xTaskCreate()
or xTaskCreatePinnedToCore()
. In both of these calls, one of the parameters is uxStackDepth
which is the allocated stack size for the task. The FreeRTOS documentation on the subject is clear about the units for uxStackDepth
: