Skip to content

Instantly share code, notes, and snippets.

View ansemjo's full-sized avatar

ansemjo

View GitHub Profile

Si4706 RDS Scanner

This is a Python script for a CircuitPython device (QtPy S3 in this case) connected to an Si4706-D50 over I2C to configure reception of FM radio stations with RDS signals and get somewhat accurate time information without any internet connection.

I've experimented with DCF77 before and found its signal strength to be wholly insufficient. Then at some point I bought a new radio with DAB+ support and was surprised when it suddenly set the correct time itself. And then it dawned on me: there's time information in FM radio signals as well!

PXL_20250721_211728505 NIGHT

The code will probably work for other Si470X chips as well. But most of the Arduino libraries with register-based operations did not work for me. Instead I followed Skyworks' AN332: "Si47xx Programming Guide" directly.

@ansemjo
ansemjo / forgejo-borgmatic.yml
Last active January 15, 2025 07:11
a borgmatic configuration, which uses extra options to create archives from forgejo dumps on stdin
# List of source directories and files to back up. Globs and tildes
# are expanded. Do not backslash spaces in path names.
source_directories:
# Actually, this is interpreted as a command due to extra options below.
- /usr/local/bin/forgejo-dump-stdout
# If true, then source directories must exist, otherwise an error is
# raised. Defaults to false.
source_directories_must_exist: false # source is a command
@ansemjo
ansemjo / .00_webtransport_quic_issue.txt
Last active April 10, 2024 17:03
WebTransport error reproducer
This is a reproducer for https://github.com/quic-go/webtransport-go/issues/84
USAGE
git clone https://gist.github.com/72e1fc95a8c6e19cabfa750e45eae185.git
cd 72e1fc95a8c6e19cabfa750e45eae185/
bash gencerts.sh
go run main.go
Now open https://localhost:7443/ in Firefox.
open the developer console with ctrl-shift-K
@ansemjo
ansemjo / dcpsqldump.sh
Last active November 15, 2022 08:52
Create external backup of artfiles.de databases via phpMyAdmin panel behind DCP login.
#!/usr/bin/env bash
# Script to backup an artfiles database via phpMyAdmin behind DCP.
# This is mainly useful for their "Private Web medium" plan because the
# next larger plan includes SSH access, so you can just use mysqldump directly.
# The exported SQL is piped to stdout and must be saved to a file or
# piped further for compression, encryption, etc.
# $ ./dcpsqldump.sh > database_$(date +%F).sql
set -eu -o pipefail
# -------- <TODO> --------
@ansemjo
ansemjo / systemd_service_hardening.md
Created May 20, 2022 14:36 — forked from ageis/systemd_service_hardening.md
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@ansemjo
ansemjo / complete.py
Created May 3, 2022 16:37
generate complete graphs where all nodes are connected with each other using graph-tool
#!/usr/bin/env -S docker run --rm -it -v "${PWD}:/host" -w /host tiagopeixoto/graph-tool python complete.py
# https://graph-tool.skewed.de/static/doc/generation.html#graph_tool.generation.complete_graph
# usage: $ ./complete.py 64 && convert -density 300 complete-64.{pdf,png}
from sys import argv
n = int(argv.pop())
print(f"Generate complete-{n} ...")
from graph_tool import generation, draw
gr = generation.complete_graph(n)
@ansemjo
ansemjo / corefuse.py
Last active January 29, 2022 11:36
FUSE driver to interface with Jussi Kilpelainen's core memory shield. This gives you a four byte file to store all your precious memories in.
#!/usr/bin/env python3
"""
FUSE driver to interface with Jussi Kilpelainen's core memory shield [0].
This gives you a four byte file to store all your precious memories in.
Get the Arduino code on his homepage [1]. I used the 2019-10-31 version.
0: https://www.tindie.com/products/kilpelaj/core-memory-shield-for-arduino/
1: https://jussikilpelainen.kapsi.fi/wordpress/?p=213
"""
@ansemjo
ansemjo / taskgathering.py
Last active July 31, 2021 19:31
print progress information while waiting for a number of async tasks to finish
#!/usr/bin/env python3
# This is free and unencumbered software released into the public domain.
# Please refer to the terms of the "Unlicense" at https://spdx.org/licenses/Unlicense.html
# demo: https://asciinema.org/a/FubNfdJELHAL80xcAJl0RA7OW
import asyncio, random
# random time with some gauss distribution
@ansemjo
ansemjo / singlevue.html
Created January 29, 2021 15:56
an absolutely minimal vue app example with everything in one file (except for vue itself)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>SingleVue</title>
</head>
<body>
<noscript>
@ansemjo
ansemjo / ubuntu-cleaner.sh
Last active December 8, 2024 00:56
Clean up unwanted packages on a fresh installation of Ubuntu 20.04 LTS
#!/usr/bin/env bash
set -eu
# mark a few packages as explicitly installed
mark-wanted() {
apt install -y \
bash git tmux vim htop \
unattended-upgrades \
software-properties-common;
}