Skip to content

Instantly share code, notes, and snippets.

@tomdavidson
tomdavidson / CODE_PREF_TS.md
Created December 23, 2025 08:53
Code Preferences | TypeScript

Code Preferences for TypeScript

Goal: readable, maintainable, robust, testable code using strategic functional programming in TypeScript/JavaScript, with clean-code and clean-architecture principles baked in.


1. High-level principles

  • Code must be boring to read: clear and explicit avoiding overly “clever”.
  • Prefer functional programming patterns over OOP: pure functions, immutability, explicit inputs/outputs.
@tomdavidson
tomdavidson / WINDMILL_GUIDE.md
Last active December 23, 2025 08:44
Windmill Guide

Windmill Guide

This document describes how to write and debug Windmill scripts, flows, schedules, triggers, and apps. It is tool-agnostic and intended for use with any AI coding assistant.

Combine these rules with the user's global code style preferences (FP patterns, naming, TypeScript conventions, etc.).

OSS-first disclaimer
Prefer solutions that work with Windmill open-source by default.
When a suggestion relies on an explicitly Enterprise-only feature (for example: Node.js runtime, //nodejs / //npm modes, SSO-only features, or managed-cloud-only features), label it as Enterprise-only and, when possible, suggest an OSS-compatible alternative.

@tomdavidson
tomdavidson / qemu-devenv.nix
Created April 10, 2025 04:49
qemu-devenv.nix
{ pkgs, lib, config, ... }: {
inputs.microvm.url = "github:astro/microvm.nix";
packages = [
pkgs.qemu
pkgs.microvm
pkgs.utillinux # For kvm-ok check
];
env = {
@tomdavidson
tomdavidson / nspawn-devenv.nix
Created April 10, 2025 01:52
devenv.nix with systemd-nspawn container backed shell
{ pkgs, lib, config, ... }: {
# Basic devenv configuration - add your project packages here
packages = [
pkgs.systemd
pkgs.debootstrap
# Add other packages your project needs
];
# Define container settings with automatic unique naming
env = {
@tomdavidson
tomdavidson / qemu-run.sh
Created April 8, 2025 02:11
Run a vm kata style but with a full kernel.
#!/bin/bash
# qemu-run - A Podman-like interface for QEMU
#
# podman run --rm \
# --runtime=kata \
# -v "$PWD:/mnt/host:Z" \
# alpine sh -c \
# 'ls -la /mnt/host > /mnt/host/ls.txt'
#
# ./qemu-run alpine -v "$PWD:/mnt/host" 'ls -la /mnt/host > /mnt/host/ls.txt'
@tomdavidson
tomdavidson / google_voice_texts.py
Created October 2, 2024 17:49 — forked from SandNerd/google_voice_texts.py
Google Voice Takeout Parser
# Python script to parse google voice takeout messages into csv
# command line arguments
from bs4 import BeautifulSoup
import pandas as pd
import os
import argparse
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
@tomdavidson
tomdavidson / turbo.sh
Created May 24, 2024 04:45
idea to use ramdisk for workspace
# create ram disk
sudo mount -t tmpfs -o size=8G tmpfs /mnt/ramdisk
# initial sync without --delete
rsync -avP /path/to/your/workspace/ /mnt/ramdisk
# keep in sync with 5 sec delay to min overehad
chokidar "**/*" --delay 5000 \
--command "rsync -avP --delete /path/to/your/workspace/ /mnt/ramdisk"
@tomdavidson
tomdavidson / dns-record.schema.json
Last active September 28, 2023 03:25
A draft DNS record JSONSchema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "dns-record.schema.json",
"$title": "DNS Record Schema",
"type": "object",
"oneOf": [
{
"$ref": "#/components/records/A"
},
{
@tomdavidson
tomdavidson / local-trusted-ssl-cert.sh
Created May 7, 2023 04:15
gen and trust local ssl cert - wip
#!/usr/bin/env bash
# $1 : relative filename
file_path() {
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
}
output() {
@tomdavidson
tomdavidson / no-snap-on-kubuntu.sh
Last active June 21, 2025 23:35
snapd liberation without waiting for 24.04
#!/usr/bin/env bash
# Ditch snap on kubuntu - including the bs ubuntu does
# Run on a new systems without downloading by
# `$ wget -O - https://gist.githubusercontent.com/tomdavidson/33b42eb24a23adff47b7afe4387f8cf5/raw/0e7e298f519e894790c8b46d667b0210033f0c11/no-snap.sh | bash`
sudo systemctl disable snapd
sudo systemctl disable snapd.service