Compare commits

..

1 commit

Author SHA1 Message Date
dependabot[bot]
9628dc12ea
Bump sharp from 0.31.0 to 0.31.3
Bumps [sharp](https://github.com/lovell/sharp) from 0.31.0 to 0.31.3.
- [Release notes](https://github.com/lovell/sharp/releases)
- [Changelog](https://github.com/lovell/sharp/blob/main/docs/changelog.md)
- [Commits](https://github.com/lovell/sharp/compare/v0.31.0...v0.31.3)

---
updated-dependencies:
- dependency-name: sharp
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-21 20:12:14 +00:00
283 changed files with 19859 additions and 16600 deletions

1
.eslintignore Normal file
View file

@ -0,0 +1 @@
**/*.js

29
.eslintrc.json Normal file
View file

@ -0,0 +1,29 @@
{
"root": true,
"env": {
"browser": true,
"es2020": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "module"
},
"plugins": ["unused-imports", "@typescript-eslint", "prettier"],
"rules": {
"prettier/prettier": "error",
"no-unused-vars": "off",
"unused-imports/no-unused-imports-ts": "error",
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-ts-comment": "off"
}
}

View file

@ -1,58 +0,0 @@
name: Deploy to Pages
on:
push:
branches: ['main']
pull_request:
branches: ['main']
workflow_dispatch:
concurrency:
group: 'pages'
cancel-in-progress: false
jobs:
build:
runs-on: docker
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint
run: |
npm run lint
git diff
if [[ `git status --porcelain` ]]; then
exit 1
fi
- name: Typecheck
run: npm run typecheck
- name: Build, Astro Audit & QA
run: |
npx playwright install chromium
npm run qa
- name: Copy build to host pages mount
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
apt update && apt install -y rsync
mkdir -p /pages
rsync -a --delete dist/ /pages/schmelczer-dev
- name: Copy build to staging pages mount
if: github.event_name == 'pull_request'
run: |
apt update && apt install -y rsync
mkdir -p /pages
rsync -a --delete dist/ /pages/schmelczer-dev-staging

11
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"

35
.github/workflows/lint-and-deploy.yaml vendored Normal file
View file

@ -0,0 +1,35 @@
name: Check, build and deploy to GitHub Pages
on:
push:
branches:
- main
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Lint
run: |
npm ci
npm run lint && git diff
if [[ `git status --porcelain` ]]; then
exit 1
fi
build-and-deploy:
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install and Build
run: |
npm ci
npm run build
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.4.0
with:
branch: gh-pages
folder: dist

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
node_modules
dist
.astro
target
.DS_Store

1
.nvmrc
View file

@ -1 +0,0 @@
22

View file

@ -4,13 +4,7 @@
"tabWidth": 2,
"singleQuote": true,
"endOfLine": "lf",
"plugins": ["prettier-plugin-astro"],
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro"
}
}
]
"importOrder": ["^[./]", ".*", ".scss$"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
}

View file

@ -37,6 +37,6 @@
"files.exclude": {
"node_modules": true
},
"editor.rulers": [90],
"editor.rulers": [120],
"editor.wordWrap": "on"
}

2
.vscode/tasks.json vendored
View file

@ -2,7 +2,7 @@
"version": "2.0.0",
"tasks": [
{
"label": "Lint",
"label": "Format and lint",
"type": "shell",
"command": "npm run lint",
"group": "test",

View file

@ -1,33 +1,24 @@
# schmelczer.dev
Engineering writeups by Andras Schmelczer: finished projects with the design constraints left in. Built with Astro, no required client JavaScript.
Articles live in `src/content/posts`, project index entries in `src/content/projects`, and normal pages are rendered as static HTML.
## Setup
```sh
npm ci
npx playwright install --with-deps chromium # required before Playwright QA checks
```
## Commands
```sh
npm run dev
npm run lint
npm run build
npm run preview
npm run qa
```
## Structure
- `src/content/posts`: Markdown articles
- `src/content/projects`: project index entries
- `src/pages`: static routes
- `src/layouts`: page and post layouts
- `src/components`: reusable UI pieces
- `src/styles/global.css`: the visual system
- `public/media/downloads`: CV and thesis PDFs
- `public/media/video`: project videos
# Portfolio
> An easy-to-configure timeline for your projects.
[![Check, build and deploy to GitHub Pages](https://github.com/schmelczer/schmelczer.github.io/actions/workflows/lint-and-deploy.yaml/badge.svg)](https://github.com/schmelczer/schmelczer.github.io/actions/workflows/lint-and-deploy.yaml)
[Check out the live version.](https://schmelczer.dev)
## Configuration
- The actual content is in the [data](src/data) folder, starting with [portfolio.ts](src/data/portfolio.ts)
- The assets referenced should be located in [data/media](src/data/media)
## Build
1. `npm install`
2. `npm run build`
3. You can find the results in the [dist](dist) folder
## Info
- All images are converted to `WebP` after being imported into any file.
> Except for the og-image, and SVGs.

View file

@ -1,148 +0,0 @@
import { readdirSync, readFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import sitemap from '@astrojs/sitemap';
import { defineConfig } from 'astro/config';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import rehypeSlug from 'rehype-slug';
import { visit } from 'unist-util-visit';
// Build a lookup of post slugs to their last modification dates so the sitemap
// can advertise accurate <lastmod> values to crawlers. astro:content isn't
// available inside the config, so we read post frontmatter directly. Our posts
// always use single-line scalar `date:` / `updated:` keys, so a small regex
// extraction is sufficient and intentional.
const postsDir = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
'src/content/posts'
);
function extractScalar(frontmatter, key) {
const match = frontmatter.match(new RegExp(`^${key}:\\s*(.+?)\\s*$`, 'm'));
return match?.[1]?.replace(/^['"]|['"]$/g, '');
}
const postLastmodLookup = new Map(
readdirSync(postsDir, { withFileTypes: true })
.filter((entry) => entry.isFile() && entry.name.endsWith('.md'))
.map((entry) => {
const raw = readFileSync(path.join(postsDir, entry.name), 'utf8');
const frontmatter = raw.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1] ?? '';
const rawDate =
extractScalar(frontmatter, 'updated') ?? extractScalar(frontmatter, 'date');
const parsed = rawDate ? new Date(rawDate) : null;
const valid = parsed && !Number.isNaN(parsed.valueOf()) ? parsed : null;
return [entry.name.replace(/\.md$/, ''), valid];
})
.filter(([, date]) => date !== null)
);
export default defineConfig({
site: 'https://schmelczer.dev',
trailingSlash: 'ignore',
integrations: [
sitemap({
filter: (page) => {
const path = new URL(page).pathname;
return !/^\/tags\/[^/]+\/?$/.test(path) && path !== '/404/';
},
serialize(item) {
const url = new URL(item.url);
const match = url.pathname.match(/^\/articles\/([^/]+)\/?$/);
let lastmod = item.lastmod;
if (match) {
const date = postLastmodLookup.get(match[1]);
if (date instanceof Date && !Number.isNaN(date.valueOf())) {
lastmod = date.toISOString();
}
}
return { ...item, changefreq: 'monthly', ...(lastmod ? { lastmod } : {}) };
},
}),
],
image: {
service: { entrypoint: 'astro/assets/services/sharp' },
// SVG sources in src/content/**/_assets are author-controlled.
dangerouslyProcessSVG: true,
},
vite: {
// Pre-bundle the analytics tracker during dev server startup. It is only
// referenced from a client `<script>`, so Vite would otherwise discover it
// lazily on the first page request, re-optimize, and trigger a full reload.
// That reload makes already-optimized deps (including the dev toolbar's
// runtime) return 504 "Outdated Optimize Dep", which breaks the Astro Dev
// Toolbar that the audit relies on. Listing it here optimizes it up front
// so the first navigation is stable.
optimizeDeps: {
include: ['@plausible-analytics/tracker'],
},
server: {
watch: {
// Avoid inotify instance limits in dev containers and mounted volumes.
usePolling: true,
},
},
},
markdown: {
shikiConfig: {
themes: {
light: 'github-light',
dark: 'github-dark',
},
defaultColor: false,
wrap: false,
},
rehypePlugins: [
rehypeSlug,
[
rehypeAutolinkHeadings,
{
behavior: 'append',
properties: {
className: ['heading-anchor'],
},
// Glyph rendered via CSS ::before so it doesn't leak into the TOC
// when astro:content extracts heading.text from the rendered HTML.
content: [],
},
],
// Make scrollable code blocks and tables reachable via keyboard (WCAG
// 2.1.1): without tabindex, a keyboard user cannot focus a horizontally
// overflowing <pre> or <table> to scroll it. tabindex=0 is sufficient
// on its own; role=region would require a meaningful per-block label,
// which we don't have at markdown level.
function rehypeFocusableScrollables() {
const SCROLLABLE = new Set(['pre', 'table']);
return (tree) => {
visit(tree, 'element', (node) => {
if (!SCROLLABLE.has(node.tagName)) return;
node.properties.tabindex = '0';
});
};
},
function rehypeLabelHeadingPermalinks() {
function textOf(node) {
if (!node) return '';
if (node.type === 'text') return node.value ?? '';
return (node.children ?? []).map(textOf).join('');
}
return (tree) => {
visit(tree, 'element', (node) => {
if (!/^h[2-6]$/.test(node.tagName)) return;
const headingText = textOf(node).trim();
if (!headingText) return;
for (const child of node.children ?? []) {
const className = child.properties?.className;
const classes = Array.isArray(className) ? className : [className];
if (child.tagName === 'a' && classes.includes('heading-anchor')) {
child.properties.ariaLabel = `Permalink to ${headingText}`;
}
}
});
};
},
],
},
});

39
custom.d.ts vendored Normal file
View file

@ -0,0 +1,39 @@
declare module '*.svg' {
const content: string;
export default content;
}
declare module '*.jpg' {
import { ResponsiveImage } from 'src/types/responsive-image';
const content: ResponsiveImage;
export default content;
}
declare module '*.png' {
import { ResponsiveImage } from 'src/types/responsive-image';
const content: ResponsiveImage;
export default content;
}
declare module '*.mp4' {
import { url } from 'src/types/url';
const content: url;
export default content;
}
declare module '*.webm' {
import { url } from 'src/types/url';
const content: url;
export default content;
}
declare module '*.pdf' {
import { url } from 'src/types/url';
const content: url;
export default content;
}
declare module '*.html' {
const content: string;
export default content;
}

25701
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,62 +1,59 @@
{
"name": "schmelczer-dev",
"description": "A static personal blog for Andras Schmelczer.",
"name": "portfolio",
"description": "An easily configurable timeline of projects.",
"private": true,
"type": "module",
"packageManager": "npm@10.9.2",
"engines": {
"node": ">=22.13.0"
},
"scripts": {
"dev": "astro dev --host 0.0.0.0 --port 5173",
"typecheck": "astro check",
"lint": "prettier --check \"astro.config.mjs\" \"src/**/*.{astro,ts,md,css}\" \"scripts/*.mjs\" \"*.md\" \"*.json\"",
"format": "prettier --write \"astro.config.mjs\" \"src/**/*.{astro,ts,md,css}\" \"scripts/*.mjs\" \"*.md\" \"*.json\"",
"build": "astro build",
"preview": "astro preview",
"audit:astro": "npm run build && node scripts/install-playwright-deps.mjs && node scripts/export-astro-audit.mjs",
"qa:astro-audit": "node scripts/install-playwright-deps.mjs && node scripts/export-astro-audit.mjs --fail-on-issues",
"qa:no-em-dashes": "node scripts/check-no-em-dashes.mjs",
"qa:links": "node scripts/check-links.mjs",
"qa:no-js": "node scripts/check-no-js.mjs",
"qa:overflow": "node scripts/install-playwright-deps.mjs && node scripts/check-overflow.mjs",
"qa:preview-cropping": "node scripts/install-playwright-deps.mjs && node scripts/check-preview-cropping.mjs",
"qa": "npm run typecheck && npm run lint && npm run qa:no-em-dashes && npm run build && npm run qa:astro-audit && npm run qa:links && npm run qa:no-js && npm run qa:overflow && npm run qa:preview-cropping"
"start": "webpack serve --open --mode development",
"lint": "eslint --fix \"src/**/*.ts\" && prettier --write \"src/**/*.(ts|scss|json|html)\"",
"build": "webpack --mode production",
"update": "ncu"
},
"repository": {
"type": "git",
"url": "git+https://github.com/schmelczer/schmelczer.github.io.git"
},
"keywords": [
"blog",
"software engineering",
"computer science",
"portfolio"
"CV",
"curriculum",
"vitae",
"portfolio",
"resumé"
],
"author": "Andras Schmelczer",
"license": "GPL-3.0-or-later",
"bugs": {
"url": "https://github.com/schmelczer/schmelczer.github.io/issues"
},
"browserslist": [
"defaults"
],
"homepage": "https://github.com/schmelczer/schmelczer.github.io#readme",
"devDependencies": {
"@astrojs/check": "^0.9.9",
"@astrojs/rss": "^4.0.18",
"@astrojs/sitemap": "^3.7.2",
"astro": "^6.3.1",
"playwright": "^1.59.1",
"prettier": "^3.8.3",
"prettier-plugin-astro": "^0.14.1",
"rehype-autolink-headings": "^7.1.0",
"rehype-slug": "^6.0.0",
"typescript": "^5.9.3",
"unist-util-visit": "^5.1.0",
"sharp": "^0.34.5"
},
"overrides": {
"yaml": "^2.9.0"
},
"dependencies": {
"@plausible-analytics/tracker": "^0.4.5"
"@trivago/prettier-plugin-sort-imports": "^3.3.0",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"css-loader": "^6.7.1",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-unused-imports": "^2.0.0",
"html-webpack-plugin": "^5.5.0",
"inline-source-webpack-plugin": "^2.0.1",
"mini-css-extract-plugin": "^2.6.1",
"npm-check-updates": "^16.3.2",
"prettier": "^2.7.1",
"resolve-url-loader": "^5.0.0",
"responsive-loader": "^3.1.1",
"sass": "^1.55.0",
"sass-loader": "^13.0.2",
"sharp": "^0.31.3",
"sitemap-webpack-plugin": "^1.1.1",
"string-replace-loader": "^3.1.0",
"svg-inline-loader": "^0.8.2",
"terser-webpack-plugin": "^5.3.6",
"ts-loader": "^9.4.1",
"typescript": "^4.8.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.11.1"
}
}

Binary file not shown.

View file

@ -1,13 +0,0 @@
WEBVTT
00:00.000 --> 00:04.000
No spoken dialogue. Game audio only.
00:04.000 --> 00:35.000
The Ad Astra handheld board runs the game on a small OLED display.
00:35.000 --> 01:05.000
The player controls the game through the IR input while the engine updates the display in real time.
01:05.000 --> 01:34.600
The clip continues showing gameplay on the custom ATtiny85-based board.

Binary file not shown.

View file

@ -1,4 +0,0 @@
User-agent: *
Allow: /
Sitemap: https://schmelczer.dev/sitemap-index.xml

View file

@ -1,23 +0,0 @@
{
"name": "Andras Schmelczer",
"short_name": "Schmelczer",
"description": "Andras Schmelczer writes about software systems, AI deployment, graphics, simulations, and tools.",
"lang": "en",
"id": "/",
"categories": ["education", "personal", "technology"],
"icons": [
{ "src": "/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" },
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
],
"theme_color": "#201f1d",
"background_color": "#201f1d",
"display": "standalone",
"start_url": "/",
"scope": "/"
}

View file

@ -1,136 +0,0 @@
import { readdir, readFile, stat } from 'node:fs/promises';
import path from 'node:path';
const dist = path.resolve('dist');
const allowedPreservedRoutes = new Set(['/fleeting/', '/reconcile/']);
const failures = [];
async function walk(dir) {
const entries = await readdir(dir, { withFileTypes: true });
const files = [];
for (const entry of entries) {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
files.push(...(await walk(fullPath)));
} else {
files.push(fullPath);
}
}
return files;
}
async function exists(file) {
try {
return (await stat(file)).isFile();
} catch {
return false;
}
}
async function targetExists(pathname) {
if (allowedPreservedRoutes.has(pathname)) return true;
const safePath = path
.normalize(decodeURIComponent(pathname))
.replace(/^\/+/, '')
.replace(/^(\.\.(\/|\\|$))+/, '');
const candidate = path.join(dist, safePath);
const candidates = [
candidate,
path.join(candidate, 'index.html'),
path.join(dist, `${safePath}.html`),
];
for (const file of candidates) {
if (await exists(file)) return true;
}
return false;
}
try {
await stat(dist);
} catch {
throw new Error('dist/ does not exist. Run npm run build first.');
}
const files = await walk(dist);
const checkedFiles = files.filter((file) => /\.(html|xml|css|webmanifest)$/.test(file));
function pagePathname(file) {
const rel = path.relative(dist, file).replaceAll(path.sep, '/');
if (rel === 'index.html') return '/';
if (rel.endsWith('/index.html')) return `/${rel.slice(0, -'index.html'.length)}`;
return `/${rel}`;
}
function collectUrlReferences(body, rel) {
const urls = [];
for (const match of body.matchAll(/\b(?:href|src|poster)=["']([^"']+)["']/g)) {
urls.push(match[1]);
}
for (const match of body.matchAll(/\bsrcset=["']([^"']+)["']/g)) {
for (const candidate of match[1].split(',')) {
const url = candidate.trim().split(/\s+/)[0];
if (url) urls.push(url);
}
}
if (rel.endsWith('.css')) {
for (const match of body.matchAll(/url\(\s*['"]?([^'")]+)['"]?\s*\)/g)) {
urls.push(match[1]);
}
}
if (rel.endsWith('.webmanifest')) {
try {
const manifest = JSON.parse(body);
for (const key of ['start_url', 'scope']) {
if (typeof manifest[key] === 'string') urls.push(manifest[key]);
}
for (const icon of manifest.icons ?? []) {
if (typeof icon?.src === 'string') urls.push(icon.src);
}
for (const screenshot of manifest.screenshots ?? []) {
if (typeof screenshot?.src === 'string') urls.push(screenshot.src);
}
} catch {
failures.push(`${rel}: invalid web manifest JSON`);
}
}
return urls;
}
for (const file of checkedFiles) {
const body = await readFile(file, 'utf8');
const rel = path.relative(dist, file);
const baseUrl = new URL(pagePathname(file), 'https://schmelczer.dev');
for (const raw of collectUrlReferences(body, rel)) {
if (/^(mailto:|tel:|data:)/i.test(raw)) continue;
let parsed;
try {
parsed = new URL(raw, baseUrl);
} catch {
failures.push(`${rel}: invalid URL ${raw}`);
continue;
}
if (parsed.origin !== 'https://schmelczer.dev') continue;
if (!(await targetExists(parsed.pathname))) {
failures.push(`${rel}: missing local target ${parsed.pathname}`);
}
}
}
if (failures.length > 0) {
console.error(failures.join('\n'));
process.exit(1);
}
console.log('No missing local href/src targets found in dist/.');

View file

@ -1,95 +0,0 @@
import { readdir, readFile, stat } from 'node:fs/promises';
import path from 'node:path';
const forbidden = String.fromCodePoint(0x2014);
const root = process.cwd();
const textExtensions = new Set([
'.astro',
'.css',
'.html',
'.js',
'.json',
'.md',
'.mjs',
'.ts',
'.txt',
'.vtt',
'.webmanifest',
'.xml',
]);
const roots = [
'src',
'public',
'scripts',
'README.md',
'package.json',
'astro.config.mjs',
].map((entry) => path.resolve(root, entry));
async function exists(filePath) {
try {
await stat(filePath);
return true;
} catch {
return false;
}
}
async function walk(entryPath) {
const entryStat = await stat(entryPath);
if (entryStat.isFile()) return [entryPath];
const entries = await readdir(entryPath, { withFileTypes: true });
const files = [];
for (const entry of entries) {
const fullPath = path.join(entryPath, entry.name);
if (entry.isDirectory()) {
files.push(...(await walk(fullPath)));
} else if (entry.isFile()) {
files.push(fullPath);
}
}
return files;
}
function lineAndColumn(text, index) {
const before = text.slice(0, index);
const lines = before.split('\n');
return {
line: lines.length,
column: lines.at(-1).length + 1,
};
}
const files = [];
for (const entry of roots) {
if (!(await exists(entry))) continue;
files.push(...(await walk(entry)));
}
const textFiles = files.filter((file) => textExtensions.has(path.extname(file)));
const failures = [];
for (const file of textFiles) {
const text = await readFile(file, 'utf8');
let index = text.indexOf(forbidden);
while (index !== -1) {
const { line, column } = lineAndColumn(text, index);
failures.push(`${path.relative(root, file)}:${line}:${column}`);
index = text.indexOf(forbidden, index + forbidden.length);
}
}
if (failures.length > 0) {
console.error(`Em dashes are not allowed:\n${failures.join('\n')}`);
process.exit(1);
}
console.log('No em dashes found.');

View file

@ -1,91 +0,0 @@
import { readdir, readFile, stat } from 'node:fs/promises';
import path from 'node:path';
const dist = path.resolve('dist');
const failures = [];
async function walk(dir) {
const entries = await readdir(dir, { withFileTypes: true });
const files = [];
for (const entry of entries) {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
files.push(...(await walk(fullPath)));
} else {
files.push(fullPath);
}
}
return files;
}
try {
await stat(dist);
} catch {
throw new Error('dist/ does not exist. Run npm run build first.');
}
const files = await walk(dist);
const ALLOWED_JS_ASSET_PATTERNS = [
/[/\\]_astro[/\\]Analytics\.astro_astro_type_script_index_0_lang\.[\w-]+\.js$/,
];
const jsFiles = files.filter(
(file) =>
file.endsWith('.js') &&
!ALLOWED_JS_ASSET_PATTERNS.some((pattern) => pattern.test(file))
);
if (jsFiles.length > 0) {
failures.push(
`Unexpected JavaScript assets:\n${jsFiles.map((file) => `- ${file}`).join('\n')}`
);
}
// Script tags are only allowed if they declare one of these safe `type`
// attributes or match one of the known executable scripts below. All other
// scripts, including untyped ones, which default to executable JavaScript, are
// flagged.
const SAFE_SCRIPT_TYPES = new Set([
'application/ld+json',
'importmap',
'speculationrules',
]);
const ANALYTICS_SCRIPT_SRC_PATTERN =
/\bsrc=["']\/_astro\/Analytics\.astro_astro_type_script_index_0_lang\.[\w-]+\.js["']/i;
function isSafeScriptTag(tag) {
if (tag.includes('data-theme-script')) return true;
if (tag.includes('data-thumbnail-iframe-script')) return true;
if (ANALYTICS_SCRIPT_SRC_PATTERN.test(tag)) return true;
const typeMatch = tag.match(/\btype=["']([^"']+)["']/i);
if (!typeMatch) return false;
return SAFE_SCRIPT_TYPES.has(typeMatch[1].trim().toLowerCase());
}
for (const file of files.filter((candidate) => candidate.endsWith('.html'))) {
const html = await readFile(file, 'utf8');
const scripts = (html.match(/<script\b[^>]*>/gi) ?? []).filter(
(tag) => !isSafeScriptTag(tag)
);
if (scripts.length) {
failures.push(`Unexpected script tag in ${file}:\n${scripts.join('\n')}`);
}
// Inline event handlers (onclick=, onload=, etc.) execute JavaScript even
// without a <script> tag, so flag any attribute matching `on*=`. We strip
// <script> blocks first to avoid false positives from JSON-LD payloads.
const stripped = html.replace(/<script\b[\s\S]*?<\/script>/gi, '');
const handlerMatches = stripped.match(/\son\w+=/gi);
if (handlerMatches?.length) {
const unique = [...new Set(handlerMatches.map((m) => m.trim()))];
failures.push(`Unexpected inline event handler in ${file}:\n${unique.join('\n')}`);
}
}
if (failures.length > 0) {
console.error(failures.join('\n\n'));
process.exit(1);
}
console.log('No unexpected JavaScript found in dist/.');

View file

@ -1,309 +0,0 @@
import { createServer } from 'node:http';
import { mkdir, readdir, readFile, rm, stat } from 'node:fs/promises';
import path from 'node:path';
import { chromium } from 'playwright';
const dist = path.resolve('dist');
const browserTmp = path.resolve('.astro', 'playwright-overflow-tmp');
const INDEX_FILE = 'index.html';
const MAX_NAV_RETRIES = 4;
// Common device widths: iPhone SE / Galaxy S / iPhone 14 / iPad portrait /
// iPad landscape / common laptop / full HD desktop.
const VIEWPORT_WIDTHS = [320, 390, 430, 768, 1024, 1440, 1920];
const CLOSE_TIMEOUT_MS = 3000;
const LAUNCH_TIMEOUT_MS = 10000;
const CONTEXT_TIMEOUT_MS = 8000;
const PAGE_TIMEOUT_MS = 15000;
const MEASURE_TIMEOUT_MS = 25000;
const MIME = {
'.html': 'text/html; charset=utf-8',
'.css': 'text/css; charset=utf-8',
'.js': 'text/javascript; charset=utf-8',
'.svg': 'image/svg+xml',
'.png': 'image/png',
'.jpg': 'image/jpeg',
'.jpeg': 'image/jpeg',
'.webp': 'image/webp',
'.avif': 'image/avif',
'.ico': 'image/x-icon',
'.woff': 'font/woff',
'.woff2': 'font/woff2',
'.mp4': 'video/mp4',
'.webm': 'video/webm',
'.vtt': 'text/vtt; charset=utf-8',
'.pdf': 'application/pdf',
};
function contentType(file) {
const ext = path.extname(file).toLowerCase();
return MIME[ext] ?? 'application/octet-stream';
}
async function walk(dir) {
const entries = await readdir(dir, { withFileTypes: true });
const files = [];
for (const entry of entries) {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
files.push(...(await walk(fullPath)));
} else {
files.push(fullPath);
}
}
return files;
}
async function discoverRoutes() {
const files = await walk(dist);
const routes = new Set();
for (const file of files) {
if (!file.endsWith('.html')) continue;
const rel = path.relative(dist, file).replaceAll(path.sep, '/');
if (rel === '404.html') continue;
if (rel === INDEX_FILE) {
routes.add('/');
} else if (rel.endsWith(`/${INDEX_FILE}`)) {
routes.add('/' + rel.slice(0, -INDEX_FILE.length));
} else {
routes.add('/' + rel.replace(/\.html$/, '/'));
}
}
return [...routes].sort();
}
async function resolveFile(url) {
const parsed = new URL(url, 'http://localhost');
const safePath = path
.normalize(decodeURIComponent(parsed.pathname))
.replace(/^\/+/, '')
.replace(/^(\.\.(\/|\\|$))+/, '');
const candidate = path.join(dist, safePath);
const candidates = [
candidate,
path.join(candidate, 'index.html'),
path.join(dist, `${safePath}.html`),
];
for (const file of candidates) {
try {
const fileStat = await stat(file);
if (fileStat.isFile()) return file;
} catch {
// Try the next candidate.
}
}
return path.join(dist, '404.html');
}
try {
await stat(dist);
} catch {
throw new Error('dist/ does not exist. Run npm run build first.');
}
// Some CI/dev containers mount /tmp as a very small tmpfs. Chromium uses the
// process temp directory for profiles and internal files; putting it under the
// already-ignored .astro/ directory keeps the overflow check reproducible even
// when the system temp mount is full.
await rm(browserTmp, { recursive: true, force: true });
await mkdir(browserTmp, { recursive: true });
process.env.TMPDIR = browserTmp;
process.env.TMP = browserTmp;
process.env.TEMP = browserTmp;
const routes = await discoverRoutes();
const server = createServer(async (req, res) => {
try {
const file = await resolveFile(req.url ?? '/');
const body = await readFile(file);
res.writeHead(200, { 'content-type': contentType(file) });
res.end(body);
} catch (error) {
res.writeHead(500, { 'content-type': 'text/plain; charset=utf-8' });
res.end(String(error));
}
});
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
const { port } = server.address();
const failures = [];
function launchBrowser() {
return chromium.launch({
headless: true,
env: {
...process.env,
TMPDIR: browserTmp,
TMP: browserTmp,
TEMP: browserTmp,
},
args: ['--disable-dev-shm-usage', '--disable-gpu', '--no-sandbox'],
});
}
async function withTimeout(promise, timeoutMs, label) {
let timeout;
try {
return await Promise.race([
promise,
new Promise((_, reject) => {
timeout = setTimeout(() => reject(new Error(label)), timeoutMs);
}),
]);
} finally {
clearTimeout(timeout);
}
}
async function safeClosePage(page) {
await withTimeout(
page.close(),
CLOSE_TIMEOUT_MS,
'Timed out while closing Playwright page'
).catch(() => {});
}
async function safeCloseContext(context) {
await withTimeout(
context.close(),
CLOSE_TIMEOUT_MS,
'Timed out while closing Playwright context'
).catch(() => {});
}
async function safeCloseBrowser(browser) {
const childProcess = browser.process?.();
try {
await withTimeout(
browser.close(),
CLOSE_TIMEOUT_MS,
'Timed out while closing Chromium'
);
} catch {
childProcess?.kill('SIGKILL');
}
}
async function openBrowser() {
return withTimeout(
launchBrowser(),
LAUNCH_TIMEOUT_MS,
'Timed out while launching Chromium'
);
}
async function newMeasurementContext(browser, width) {
const context = await browser.newContext({
viewport: { width, height: 900 },
javaScriptEnabled: true,
});
await context.route('**/*', (route) => {
const type = route.request().resourceType();
if (type === 'media') {
route.abort('blockedbyclient');
} else {
route.continue();
}
});
return context;
}
async function openMeasurementContext(browser, width) {
return withTimeout(
newMeasurementContext(browser, width),
CONTEXT_TIMEOUT_MS,
`Timed out while creating ${width}px Playwright context`
);
}
async function measureViewport(page) {
await page.waitForLoadState('load', { timeout: 5000 }).catch(() => {});
return page.evaluate(() => ({
scrollWidth: document.documentElement.scrollWidth,
clientWidth: document.documentElement.clientWidth,
}));
}
function shouldRetryNavigation(error) {
const message = error instanceof Error ? error.message : String(error);
return /ERR_INSUFFICIENT_RESOURCES|Execution context was destroyed|Target.*closed|has been closed|Timed out while|navigation/i.test(
message
);
}
async function measureRoute(context, route) {
let page;
try {
page = await withTimeout(
context.newPage(),
PAGE_TIMEOUT_MS,
`Timed out while creating page for ${route}`
);
return await withTimeout(
(async () => {
await page.goto(`http://127.0.0.1:${port}${route}`, {
waitUntil: 'domcontentloaded',
timeout: 15000,
});
return measureViewport(page);
})(),
MEASURE_TIMEOUT_MS,
`Timed out while measuring ${route}`
);
} finally {
if (page) await safeClosePage(page);
}
}
try {
for (const width of VIEWPORT_WIDTHS) {
let browser;
let context;
try {
browser = await openBrowser();
context = await openMeasurementContext(browser, width);
for (const route of routes) {
let result;
for (let attempt = 0; attempt < MAX_NAV_RETRIES; attempt += 1) {
try {
result = await measureRoute(context, route);
break;
} catch (error) {
if (!shouldRetryNavigation(error) || attempt === MAX_NAV_RETRIES - 1) {
throw error;
}
await safeCloseContext(context);
await safeCloseBrowser(browser);
browser = await openBrowser();
context = await openMeasurementContext(browser, width);
}
}
if (result.scrollWidth > result.clientWidth + 1) {
failures.push(
`${route} overflows at ${width}px: ${result.scrollWidth}px > ${result.clientWidth}px`
);
}
}
} finally {
if (context) await safeCloseContext(context);
if (browser) await safeCloseBrowser(browser);
}
}
} finally {
server.close();
await rm(browserTmp, { recursive: true, force: true }).catch(() => {});
}
if (failures.length > 0) {
console.error(failures.join('\n'));
process.exit(1);
}
console.log(
`No horizontal overflow detected at ${VIEWPORT_WIDTHS.join(', ')}px across ${routes.length} routes.`
);

View file

@ -1,536 +0,0 @@
import { createServer } from 'node:http';
import { mkdir, readdir, readFile, rm, stat } from 'node:fs/promises';
import path from 'node:path';
import { chromium } from 'playwright';
const dist = path.resolve('dist');
const previewCss = path.resolve('src/styles/global.css');
const browserTmp = path.resolve('.astro', 'playwright-preview-cropping-tmp');
const INDEX_FILE = 'index.html';
const PREVIEW_SELECTOR = '[data-uncropped-preview]';
// Common device widths: iPhone SE / Galaxy S / iPhone 14 / iPad portrait /
// iPad landscape / common laptop / full HD desktop.
const VIEWPORT_WIDTHS = [320, 390, 430, 768, 1024, 1440, 1920];
const MAX_NAV_RETRIES = 4;
const CLOSE_TIMEOUT_MS = 3000;
const LAUNCH_TIMEOUT_MS = 10000;
const CONTEXT_TIMEOUT_MS = 8000;
const PAGE_TIMEOUT_MS = 15000;
const MEASURE_TIMEOUT_MS = 30000;
const CLIP_TOLERANCE_PX = 0.75;
const RATIO_TOLERANCE = 0.01;
const MIME = {
'.html': 'text/html; charset=utf-8',
'.css': 'text/css; charset=utf-8',
'.js': 'text/javascript; charset=utf-8',
'.svg': 'image/svg+xml',
'.png': 'image/png',
'.jpg': 'image/jpeg',
'.jpeg': 'image/jpeg',
'.webp': 'image/webp',
'.avif': 'image/avif',
'.ico': 'image/x-icon',
'.woff': 'font/woff',
'.woff2': 'font/woff2',
'.mp4': 'video/mp4',
'.webm': 'video/webm',
'.vtt': 'text/vtt; charset=utf-8',
'.pdf': 'application/pdf',
};
function contentType(file) {
const ext = path.extname(file).toLowerCase();
return MIME[ext] ?? 'application/octet-stream';
}
async function walk(dir) {
const entries = await readdir(dir, { withFileTypes: true });
const files = [];
for (const entry of entries) {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
files.push(...(await walk(fullPath)));
} else {
files.push(fullPath);
}
}
return files;
}
async function discoverRoutes() {
const files = await walk(dist);
const routes = new Set();
for (const file of files) {
if (!file.endsWith('.html')) continue;
const rel = path.relative(dist, file).replaceAll(path.sep, '/');
if (rel === '404.html') continue;
if (rel === INDEX_FILE) {
routes.add('/');
} else if (rel.endsWith(`/${INDEX_FILE}`)) {
routes.add('/' + rel.slice(0, -INDEX_FILE.length));
} else {
routes.add('/' + rel.replace(/\.html$/, '/'));
}
}
return [...routes].sort();
}
async function resolveFile(url) {
const parsed = new URL(url, 'http://localhost');
const safePath = path
.normalize(decodeURIComponent(parsed.pathname))
.replace(/^\/+/, '')
.replace(/^(\.\.(\/|\\|$))+/, '');
const candidate = path.join(dist, safePath);
const candidates = [
candidate,
path.join(candidate, 'index.html'),
path.join(dist, `${safePath}.html`),
];
for (const file of candidates) {
try {
const fileStat = await stat(file);
if (fileStat.isFile()) return file;
} catch {
// Try the next candidate.
}
}
return path.join(dist, '404.html');
}
try {
await stat(dist);
} catch {
throw new Error('dist/ does not exist. Run npm run build first.');
}
function lineAndColumn(text, index) {
const before = text.slice(0, index);
const lines = before.split('\n');
return {
line: lines.length,
column: lines.at(-1).length + 1,
};
}
function declarationValue(body, property) {
const pattern = new RegExp(`(?:^|;)\\s*${property}\\s*:\\s*([^;]+)`, 'i');
return body.match(pattern)?.[1]?.trim();
}
function scaleValueExpands(value) {
for (const match of value.matchAll(/\bscale(?:3d|x|y)?\(([^)]*)\)/gi)) {
const name = match[0].slice(0, match[0].indexOf('(')).toLowerCase();
const values = match[1]
.split(/[\s,]+/)
.map(Number)
.filter(Number.isFinite);
if (name === 'scalex' || name === 'scaley') {
if ((values[0] ?? 1) > 1) return true;
continue;
}
if ((values[0] ?? 1) > 1 || (values[1] ?? values[0] ?? 1) > 1) {
return true;
}
}
return value
.split(/[\s,]+/)
.map(Number)
.filter(Number.isFinite)
.some((number) => number > 1);
}
async function checkPreviewCroppingStyles() {
const css = await readFile(previewCss, 'utf8');
const styleFailures = [];
const blockPattern = /([^{}]+)\{([^{}]*)\}/g;
for (const match of css.matchAll(blockPattern)) {
const selector = match[1].replace(/\/\*[\s\S]*?\*\//g, '').trim();
const body = match[2];
// Only inspect rules that target elements explicitly opted in to the
// no-crop contract via [data-uncropped-preview]. Listing thumbnails
// that intentionally cover-crop don't carry this attribute.
if (!selector || !/\[data-uncropped-preview\b/.test(selector)) continue;
const targetsMedia = /\b(img|picture|video|canvas)\b/i.test(selector);
const objectFit = declarationValue(body, 'object-fit');
const backgroundSize = declarationValue(body, 'background-size');
const transform = declarationValue(body, 'transform');
const scale = declarationValue(body, 'scale');
const addFailure = (property, reason) => {
const propertyIndex = css.indexOf(property, match.index);
const { line, column } = lineAndColumn(css, propertyIndex);
styleFailures.push(
`${path.relative(process.cwd(), previewCss)}:${line}:${column}: ${selector} ${reason}`
);
};
if (targetsMedia && /^cover\b/i.test(objectFit ?? '')) {
addFailure('object-fit', 'uses object-fit: cover');
}
if (/^cover\b/i.test(backgroundSize ?? '')) {
addFailure('background-size', 'uses background-size: cover');
}
if (targetsMedia && transform && scaleValueExpands(transform)) {
addFailure('transform', 'scales preview media larger than its container');
}
if (targetsMedia && scale && scaleValueExpands(scale)) {
addFailure('scale', 'scales preview media larger than its container');
}
}
return styleFailures;
}
// Keep Chromium temp files inside the repo so the check is reproducible in CI
// containers with very small /tmp mounts.
await rm(browserTmp, { recursive: true, force: true });
await mkdir(browserTmp, { recursive: true });
process.env.TMPDIR = browserTmp;
process.env.TMP = browserTmp;
process.env.TEMP = browserTmp;
const routes = await discoverRoutes();
const failures = await checkPreviewCroppingStyles();
const server = createServer(async (req, res) => {
try {
const file = await resolveFile(req.url ?? '/');
const body = await readFile(file);
res.writeHead(200, { 'content-type': contentType(file) });
res.end(body);
} catch (error) {
res.writeHead(500, { 'content-type': 'text/plain; charset=utf-8' });
res.end(String(error));
}
});
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
const { port } = server.address();
function launchBrowser() {
return chromium.launch({
headless: true,
env: {
...process.env,
TMPDIR: browserTmp,
TMP: browserTmp,
TEMP: browserTmp,
},
args: ['--disable-dev-shm-usage', '--disable-gpu', '--no-sandbox'],
});
}
async function withTimeout(promise, timeoutMs, label) {
let timeout;
try {
return await Promise.race([
promise,
new Promise((_, reject) => {
timeout = setTimeout(() => reject(new Error(label)), timeoutMs);
}),
]);
} finally {
clearTimeout(timeout);
}
}
async function safeClosePage(page) {
await withTimeout(
page.close(),
CLOSE_TIMEOUT_MS,
'Timed out while closing Playwright page'
).catch(() => {});
}
async function safeCloseContext(context) {
await withTimeout(
context.close(),
CLOSE_TIMEOUT_MS,
'Timed out while closing Playwright context'
).catch(() => {});
}
async function safeCloseBrowser(browser) {
const childProcess = browser.process?.();
try {
await withTimeout(
browser.close(),
CLOSE_TIMEOUT_MS,
'Timed out while closing Chromium'
);
} catch {
childProcess?.kill('SIGKILL');
}
}
async function openBrowser() {
return withTimeout(
launchBrowser(),
LAUNCH_TIMEOUT_MS,
'Timed out while launching Chromium'
);
}
async function newMeasurementContext(browser, width) {
const context = await browser.newContext({
viewport: { width, height: 900 },
javaScriptEnabled: true,
reducedMotion: 'reduce',
});
await context.route('**/*', (route) => {
const type = route.request().resourceType();
if (type === 'image' || type === 'media') {
route.abort('blockedbyclient');
} else {
route.continue();
}
});
return context;
}
async function openMeasurementContext(browser, width) {
return withTimeout(
newMeasurementContext(browser, width),
CONTEXT_TIMEOUT_MS,
`Timed out while creating ${width}px Playwright context`
);
}
async function inspectPreviews(page, route, width, phase, index = null) {
const findings = await page.evaluate(
({ clipTolerancePx, index, phase, ratioTolerance, selector }) => {
const failures = [];
const previews = [...document.querySelectorAll(selector)];
const selectedPreviews =
index === null ? previews : [previews[index]].filter(Boolean);
const clippingValues = new Set(['hidden', 'clip', 'scroll', 'auto']);
function isClippingElement(element) {
const style = getComputedStyle(element);
return (
clippingValues.has(style.overflow) ||
clippingValues.has(style.overflowX) ||
clippingValues.has(style.overflowY)
);
}
function nearestClippingAncestor(image, preview) {
let current = image.parentElement;
while (current && preview.contains(current)) {
if (isClippingElement(current)) return current;
if (current === preview) break;
current = current.parentElement;
}
return null;
}
function labelFor(preview, image) {
const label =
preview.getAttribute('data-preview-label') ||
preview.getAttribute('aria-label') ||
image.alt ||
'preview image';
const source = image.currentSrc || image.src;
let pathname = source;
try {
pathname = new URL(source, document.baseURI).pathname;
} catch {
// Keep the raw source if URL parsing fails.
}
return `${label} (${pathname})`;
}
function ratioDelta(first, second) {
return Math.abs(first - second) / Math.max(first, second);
}
function isRectClipped(rect, clipRect) {
return (
rect.left < clipRect.left - clipTolerancePx ||
rect.top < clipRect.top - clipTolerancePx ||
rect.right > clipRect.right + clipTolerancePx ||
rect.bottom > clipRect.bottom + clipTolerancePx
);
}
for (const preview of selectedPreviews) {
if (!(preview instanceof HTMLElement)) continue;
const image = preview.querySelector('img');
if (!(image instanceof HTMLImageElement)) {
failures.push({
label: preview.getAttribute('data-preview-label') || 'preview image',
reason: 'has no rendered <img>',
});
continue;
}
const label = labelFor(preview, image);
const sourceWidth = Number(image.getAttribute('width')) || image.naturalWidth;
const sourceHeight = Number(image.getAttribute('height')) || image.naturalHeight;
if (sourceWidth <= 0 || sourceHeight <= 0) {
failures.push({ label, reason: 'image has no intrinsic dimensions' });
continue;
}
const imageRect = image.getBoundingClientRect();
const imageWidth = image.clientWidth || imageRect.width;
const imageHeight = image.clientHeight || imageRect.height;
if (imageWidth <= 0 || imageHeight <= 0) {
failures.push({ label, reason: 'image rendered with no visible size' });
continue;
}
const imageStyle = getComputedStyle(image);
const sourceRatio = sourceWidth / sourceHeight;
const boxRatio = imageWidth / imageHeight;
if (
imageStyle.objectFit === 'cover' &&
ratioDelta(sourceRatio, boxRatio) > ratioTolerance
) {
failures.push({
label,
reason: `uses object-fit: cover for a ${sourceWidth}x${sourceHeight} source in a ${Math.round(imageWidth)}x${Math.round(imageHeight)} box`,
});
}
const clippingAncestor = nearestClippingAncestor(image, preview);
if (clippingAncestor) {
const clipRect = clippingAncestor.getBoundingClientRect();
if (isRectClipped(imageRect, clipRect)) {
failures.push({
label,
reason: 'image bounds are clipped by an overflow container',
});
}
}
}
return failures.map((failure) => ({
...failure,
phase,
}));
},
{
clipTolerancePx: CLIP_TOLERANCE_PX,
index,
phase,
ratioTolerance: RATIO_TOLERANCE,
selector: PREVIEW_SELECTOR,
}
);
return findings.map(
(finding) =>
`${route} at ${width}px (${finding.phase}): ${finding.label}: ${finding.reason}`
);
}
function shouldRetryNavigation(error) {
const message = error instanceof Error ? error.message : String(error);
return /ERR_INSUFFICIENT_RESOURCES|Execution context was destroyed|Target.*closed|has been closed|Timed out while|navigation/i.test(
message
);
}
async function measureRoute(context, route, width) {
let page;
try {
page = await withTimeout(
context.newPage(),
PAGE_TIMEOUT_MS,
`Timed out while creating page for ${route}`
);
return await withTimeout(
(async () => {
await page.goto(`http://127.0.0.1:${port}${route}`, {
waitUntil: 'domcontentloaded',
timeout: 15000,
});
await page.waitForLoadState('load', { timeout: 5000 }).catch(() => {});
return inspectPreviews(page, route, width, 'normal');
})(),
MEASURE_TIMEOUT_MS,
`Timed out while checking preview cropping for ${route}`
);
} finally {
if (page) await safeClosePage(page);
}
}
try {
for (const width of VIEWPORT_WIDTHS) {
let browser;
let context;
try {
browser = await openBrowser();
context = await openMeasurementContext(browser, width);
for (const route of routes) {
let result;
for (let attempt = 0; attempt < MAX_NAV_RETRIES; attempt += 1) {
try {
result = await measureRoute(context, route, width);
break;
} catch (error) {
if (!shouldRetryNavigation(error) || attempt === MAX_NAV_RETRIES - 1) {
throw error;
}
await safeCloseContext(context);
await safeCloseBrowser(browser);
browser = await openBrowser();
context = await openMeasurementContext(browser, width);
}
}
failures.push(...result);
}
} finally {
if (context) await safeCloseContext(context);
if (browser) await safeCloseBrowser(browser);
}
}
} finally {
server.close();
await rm(browserTmp, { recursive: true, force: true }).catch(() => {});
}
if (failures.length > 0) {
console.error(failures.join('\n'));
process.exit(1);
}
console.log(
`No cropped previews detected at ${VIEWPORT_WIDTHS.join(', ')}px across ${routes.length} routes.`
);

View file

@ -1,484 +0,0 @@
import { spawn } from 'node:child_process';
import { once } from 'node:events';
import { mkdir, readdir, rm, stat, writeFile } from 'node:fs/promises';
import { createServer as createNetServer } from 'node:net';
import path from 'node:path';
import { chromium } from 'playwright';
const dist = path.resolve('dist');
const browserTmp = path.resolve('.astro', 'playwright-astro-audit-tmp');
const outputJson = path.resolve(
process.env.ASTRO_AUDIT_OUTPUT_JSON ?? '.astro/astro-audit-results.json'
);
const outputMarkdown = path.resolve(
process.env.ASTRO_AUDIT_OUTPUT_MD ?? '.astro/astro-audit-results.md'
);
const astroBin = path.resolve(
'node_modules',
'.bin',
process.platform === 'win32' ? 'astro.cmd' : 'astro'
);
const HOST = '127.0.0.1';
const INDEX_FILE = 'index.html';
const SERVER_START_TIMEOUT_MS = 60000;
const CLOSE_TIMEOUT_MS = 3000;
const NAV_TIMEOUT_MS = 20000;
const AUDIT_TIMEOUT_MS = 30000;
const DEFAULT_VIEWPORTS = '1440x900';
const failOnIssues =
process.argv.includes('--fail-on-issues') ||
process.env.ASTRO_AUDIT_FAIL_ON_ISSUES === '1';
// Heuristic above-fold / below-fold loading rules flip based on the heights of
// items rendered above them, which shift whenever a post's description length
// changes. They produce false positives that can't be resolved with a single
// `eagerThumbnailCount` per list, so the audit suppresses them.
const IGNORED_AUDIT_CODES = new Set(['perf-use-loading-eager', 'perf-use-loading-lazy']);
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
function parseViewports(raw = process.env.ASTRO_AUDIT_VIEWPORTS ?? DEFAULT_VIEWPORTS) {
return raw.split(',').map((entry) => {
const match = entry.trim().match(/^(\d+)x(\d+)$/i);
if (!match) {
throw new Error(
`Invalid ASTRO_AUDIT_VIEWPORTS entry "${entry}". Use values like 1440x900,390x844.`
);
}
return { width: Number(match[1]), height: Number(match[2]) };
});
}
async function walk(dir) {
const entries = await readdir(dir, { withFileTypes: true });
const files = [];
for (const entry of entries) {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
files.push(...(await walk(fullPath)));
} else {
files.push(fullPath);
}
}
return files;
}
async function discoverRoutes() {
if (process.env.ASTRO_AUDIT_ROUTES) {
return process.env.ASTRO_AUDIT_ROUTES.split(',')
.map((route) => route.trim())
.filter(Boolean)
.map((route) => (route.startsWith('/') ? route : `/${route}`));
}
try {
await stat(dist);
} catch {
throw new Error('dist/ does not exist. Run npm run build first.');
}
const files = await walk(dist);
const routes = new Set();
for (const file of files) {
if (!file.endsWith('.html')) continue;
const rel = path.relative(dist, file).replaceAll(path.sep, '/');
if (rel === '404.html') continue;
if (rel === INDEX_FILE) {
routes.add('/');
} else if (rel.endsWith(`/${INDEX_FILE}`)) {
routes.add('/' + rel.slice(0, -INDEX_FILE.length));
} else {
routes.add('/' + rel.replace(/\.html$/, '/'));
}
}
return [...routes].sort();
}
async function getFreePort() {
const server = createNetServer();
await new Promise((resolve, reject) => {
server.once('error', reject);
server.listen(0, HOST, resolve);
});
const { port } = server.address();
await new Promise((resolve, reject) => {
server.close((error) => (error ? reject(error) : resolve()));
});
return port;
}
function startAstroDev(port) {
const child = spawn(astroBin, ['dev', '--host', HOST, '--port', String(port)], {
stdio: ['ignore', 'pipe', 'pipe'],
env: {
...process.env,
ASTRO_TELEMETRY_DISABLED: '1',
NO_COLOR: '1',
TMPDIR: browserTmp,
TMP: browserTmp,
TEMP: browserTmp,
},
});
let output = '';
const append = (chunk) => {
output = `${output}${chunk.toString()}`.slice(-20000);
};
child.stdout.on('data', append);
child.stderr.on('data', append);
child.getRecentOutput = () => output.trim();
return child;
}
async function waitForDevServer(baseUrl, child) {
const deadline = Date.now() + SERVER_START_TIMEOUT_MS;
while (Date.now() < deadline) {
if (child.exitCode !== null) {
throw new Error(
`Astro dev server exited before it was ready.\n${child.getRecentOutput()}`
);
}
try {
const response = await fetch(baseUrl);
if (response.status < 500) return;
} catch {
// Server is not listening yet.
}
await sleep(250);
}
throw new Error(
`Timed out waiting for Astro dev server at ${baseUrl}.\n${child.getRecentOutput()}`
);
}
async function stopProcess(child) {
if (!child || child.exitCode !== null) return;
child.kill('SIGTERM');
const exited = once(child, 'exit');
const timedOut = sleep(CLOSE_TIMEOUT_MS).then(() => 'timeout');
if ((await Promise.race([exited, timedOut])) === 'timeout') {
child.kill('SIGKILL');
}
}
async function safeCloseBrowser(browser) {
const childProcess = browser?.process?.();
try {
await Promise.race([
browser.close(),
sleep(CLOSE_TIMEOUT_MS).then(() => {
throw new Error('Timed out while closing Chromium');
}),
]);
} catch {
childProcess?.kill('SIGKILL');
}
}
function viewportLabel(viewport) {
return `${viewport.width}x${viewport.height}`;
}
async function extractAuditResults(page) {
return page.evaluate(
async ({ auditTimeoutMs }) => {
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const deadline = Date.now() + auditTimeoutMs;
function describeElement(element) {
if (!element) return '';
const pieces = [];
let current = element;
while (
current instanceof Element &&
current !== document.documentElement &&
pieces.length < 5
) {
let piece = current.localName;
if (current.id) {
piece += `#${current.id}`;
} else {
const classes = [...current.classList].slice(0, 2);
if (classes.length > 0) piece += `.${classes.join('.')}`;
const parent = current.parentElement;
if (parent) {
const siblings = [...parent.children].filter(
(child) => child.localName === current.localName
);
if (siblings.length > 1) {
piece += `:nth-of-type(${siblings.indexOf(current) + 1})`;
}
}
}
pieces.unshift(piece);
current = current.parentElement;
}
return pieces.join(' > ');
}
function resolveRuleValue(value, element) {
try {
if (typeof value === 'function') return String(value(element) ?? '');
return String(value ?? '');
} catch (error) {
return `Error resolving audit value: ${
error instanceof Error ? error.message : String(error)
}`;
}
}
function sourceForAudit(audit) {
const tooltip = audit.highlight?.shadowRoot?.querySelector(
'astro-dev-toolbar-tooltip'
);
const sourceSection = tooltip?.sections?.find(
(section) => section.clickDescription === 'Click to go to file'
);
return sourceSection?.content ?? null;
}
while (Date.now() < deadline) {
const toolbar = document.querySelector('astro-dev-toolbar');
const button = toolbar?.shadowRoot?.querySelector('[data-app-id="astro:audit"]');
if (button && !button.classList.contains('active')) {
button.click();
}
const auditCanvas = toolbar?.shadowRoot?.querySelector(
'astro-dev-toolbar-app-canvas[data-app-id="astro:audit"]'
);
const auditWindow = auditCanvas?.shadowRoot?.querySelector(
'astro-dev-toolbar-audit-window'
);
if (button?.classList.contains('active') && auditWindow) {
await sleep(100);
return {
results: (auditWindow.audits ?? []).map((audit) => {
const element = audit.auditedElement;
return {
code: audit.rule.code,
category: audit.rule.code?.split('-')[0] ?? '',
title: resolveRuleValue(audit.rule.title, element),
message: resolveRuleValue(audit.rule.message, element),
description: resolveRuleValue(audit.rule.description, element),
ruleSelector: audit.rule.selector,
source: sourceForAudit(audit),
element: {
selector: describeElement(element),
tagName: element?.tagName?.toLowerCase() ?? '',
html: element?.outerHTML?.replace(/\s+/g, ' ').slice(0, 800) ?? '',
},
};
}),
};
}
await sleep(250);
}
return {
error:
'Timed out waiting for the Astro Dev Toolbar Audit app. Make sure devToolbar is enabled.',
};
},
{ auditTimeoutMs: AUDIT_TIMEOUT_MS }
);
}
async function auditRoute(context, baseUrl, route, viewport) {
const page = await context.newPage();
try {
await page.goto(new URL(route, baseUrl).href, {
waitUntil: 'domcontentloaded',
timeout: NAV_TIMEOUT_MS,
});
await page.waitForSelector('astro-dev-toolbar', {
state: 'attached',
timeout: AUDIT_TIMEOUT_MS,
});
await page.waitForLoadState('load', { timeout: 5000 }).catch(() => {});
const audit = await extractAuditResults(page);
if (audit.error) {
throw new Error(`${route} at ${viewportLabel(viewport)}: ${audit.error}`);
}
return audit.results
.filter((result) => !IGNORED_AUDIT_CODES.has(result.code))
.map((result) => ({
route,
url: page.url(),
viewport: viewportLabel(viewport),
...result,
}));
} finally {
await page.close().catch(() => {});
}
}
function markdownEscape(value) {
return String(value ?? '').replaceAll('|', '\\|');
}
function renderMarkdown(report) {
const lines = [
'# Astro Audit Results',
'',
`Generated: ${report.generatedAt}`,
`Routes checked: ${report.routes.length}`,
`Viewports: ${report.viewports.map(viewportLabel).join(', ')}`,
`Issues found: ${report.results.length}`,
'',
];
if (report.results.length === 0) {
lines.push('No accessibility or performance issues detected.');
return `${lines.join('\n')}\n`;
}
const byRoute = Map.groupBy(report.results, (result) => result.route);
for (const [route, routeResults] of byRoute) {
lines.push(`## ${route}`, '');
lines.push('| Viewport | Code | Title | Source | Element |');
lines.push('| --- | --- | --- | --- | --- |');
for (const result of routeResults) {
lines.push(
`| ${markdownEscape(result.viewport)} | \`${markdownEscape(result.code)}\` | ${markdownEscape(
result.title
)} | ${markdownEscape(result.source ?? '')} | \`${markdownEscape(
result.element.selector
)}\` |`
);
}
lines.push('');
}
lines.push('## Details', '');
for (const result of report.results) {
lines.push(
`### ${result.route} ${result.viewport} ${result.code}`,
'',
`- Title: ${result.title}`,
`- Source: ${result.source ?? 'unknown'}`,
`- Message: ${result.message}`,
`- Description: ${result.description || 'none'}`,
`- Element: \`${result.element.selector}\``,
'',
'```html',
result.element.html,
'```',
''
);
}
return `${lines.join('\n')}\n`;
}
const viewports = parseViewports();
const routes = await discoverRoutes();
if (routes.length === 0) {
throw new Error('No HTML routes found to audit.');
}
await rm(browserTmp, { recursive: true, force: true });
await mkdir(browserTmp, { recursive: true });
await mkdir(path.dirname(outputJson), { recursive: true });
await mkdir(path.dirname(outputMarkdown), { recursive: true });
process.env.TMPDIR = browserTmp;
process.env.TMP = browserTmp;
process.env.TEMP = browserTmp;
const port = await getFreePort();
const baseUrl = `http://${HOST}:${port}/`;
let devServer;
let browser;
const results = [];
try {
devServer = startAstroDev(port);
await waitForDevServer(baseUrl, devServer);
browser = await chromium.launch({
headless: true,
env: {
...process.env,
TMPDIR: browserTmp,
TMP: browserTmp,
TEMP: browserTmp,
},
args: ['--disable-dev-shm-usage', '--disable-gpu', '--no-sandbox'],
});
for (const viewport of viewports) {
const context = await browser.newContext({
viewport,
javaScriptEnabled: true,
});
await context.route('**/*', (route) => {
if (route.request().resourceType() === 'media') {
route.abort('blockedbyclient');
} else {
route.continue();
}
});
try {
for (const route of routes) {
results.push(...(await auditRoute(context, baseUrl, route, viewport)));
}
} finally {
await context.close().catch(() => {});
}
}
const report = {
generatedAt: new Date().toISOString(),
baseUrl,
routes,
viewports,
results,
};
await writeFile(outputJson, `${JSON.stringify(report, null, 2)}\n`);
await writeFile(outputMarkdown, renderMarkdown(report));
console.log(
`Exported ${results.length} Astro audit issue${
results.length === 1 ? '' : 's'
} across ${routes.length} routes.`
);
console.log(`JSON: ${path.relative(process.cwd(), outputJson)}`);
console.log(`Markdown: ${path.relative(process.cwd(), outputMarkdown)}`);
if (results.length > 0) {
for (const result of results.slice(0, 20)) {
console.log(
`- ${result.route} [${result.viewport}] ${result.code}: ${result.title}${
result.source ? ` (${result.source})` : ''
}`
);
}
if (results.length > 20) {
console.log(`...and ${results.length - 20} more. See the report files.`);
}
}
if (failOnIssues && results.length > 0) {
process.exitCode = 1;
}
} finally {
if (browser) await safeCloseBrowser(browser);
if (devServer) await stopProcess(devServer);
await rm(browserTmp, { recursive: true, force: true }).catch(() => {});
}

View file

@ -1,32 +0,0 @@
import { spawnSync } from 'node:child_process';
import { existsSync } from 'node:fs';
import { chromium } from 'playwright';
const isLinux = process.platform === 'linux';
if (!isLinux) {
process.exit(0);
}
const executablePath = chromium.executablePath();
let needsInstall = !existsSync(executablePath);
if (!needsInstall) {
const ldd = spawnSync('ldd', [executablePath], { encoding: 'utf8' });
const output = `${ldd.stdout ?? ''}${ldd.stderr ?? ''}`;
needsInstall = ldd.status !== 0 || output.includes('not found');
}
if (!needsInstall) {
process.exit(0);
}
const result = spawnSync('playwright', ['install', '--with-deps', 'chromium'], {
stdio: 'inherit',
});
if (result.error) {
throw result.error;
}
process.exit(result.status ?? 1);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

View file

@ -1,3 +0,0 @@
<script>
import '../scripts/analytics';
</script>

View file

@ -1,62 +0,0 @@
---
import type { CollectionEntry } from 'astro:content';
import EntryThumbnail from './EntryThumbnail.astro';
import TagList from './TagList.astro';
import { ARTICLE_THUMBNAIL, articlePath, formatDate, formatDateShort } from '../lib/site';
interface Props {
posts: CollectionEntry<'posts'>[];
showYear?: boolean;
tagLimit?: number;
timeline?: boolean;
// Opt-in: eagerly load thumbnails that are reliably above the fold. Lists
// below substantial content (related, about, 404) should leave this at zero.
eagerFirstThumbnail?: boolean;
eagerThumbnailCount?: number;
}
const {
posts,
showYear = true,
tagLimit = 3,
timeline = false,
eagerFirstThumbnail = false,
eagerThumbnailCount = eagerFirstThumbnail ? 1 : 0,
} = Astro.props;
---
<ol class:list={['article-list', timeline && 'article-list--timeline']}>
{
posts.map((post, index) => {
const href = articlePath(post);
const eager = index < eagerThumbnailCount;
return (
<li>
<article>
<h3>
<a class="entry-title" href={href}>
{post.data.title}
</a>
</h3>
<p>{post.data.description}</p>
<TagList tags={post.data.tags} limit={tagLimit} />
</article>
<time datetime={post.data.date.toISOString()}>
{showYear ? formatDate(post.data.date) : formatDateShort(post.data.date)}
</time>
<EntryThumbnail
src={post.data.thumbnail.src}
alt={post.data.thumbnail.alt}
href={href}
class="article-thumbnail"
widths={ARTICLE_THUMBNAIL.widths}
sizes={ARTICLE_THUMBNAIL.sizes}
ariaLabel={`Open article: ${post.data.title}`}
loading={eager ? 'eager' : 'lazy'}
fetchpriority={eager && index === 0 ? 'high' : undefined}
/>
</li>
);
})
}
</ol>

View file

@ -1,50 +0,0 @@
---
import type { CollectionEntry } from 'astro:content';
import ProjectLinks from './ProjectLinks.astro';
type Link = CollectionEntry<'projects'>['data']['links'][number];
interface Props {
role?: string;
projectPeriod?: string;
stack?: string[];
scale?: string;
outcome?: string;
links?: Link[];
headingId: string;
}
const {
role,
projectPeriod,
stack = [],
scale,
outcome,
links = [],
headingId,
} = Astro.props;
const rows: Array<[string, string]> = [];
if (role) rows.push(['Role', role]);
if (projectPeriod) rows.push(['Period', projectPeriod]);
if (stack.length > 0) rows.push(['Stack', stack.join(', ')]);
if (scale) rows.push(['Scale', scale]);
if (outcome) rows.push(['Outcome', outcome]);
---
{
rows.length > 0 && (
<aside class="at-a-glance" aria-labelledby={headingId}>
<h2 id={headingId}>At a Glance</h2>
<dl>
{rows.map(([label, value]) => (
<div class="at-a-glance__row">
<dt>{label}</dt>
<dd>{value}</dd>
</div>
))}
</dl>
{links.length > 0 && <ProjectLinks links={links} />}
</aside>
)
}

View file

@ -1,33 +0,0 @@
---
interface Crumb {
href?: string;
label: string;
}
interface Props {
items: Crumb[];
}
const { items } = Astro.props;
const lastIndex = items.length - 1;
---
<nav aria-label="Breadcrumb">
<ol class="breadcrumbs">
{
items.map((item, index) => {
const isLast = index === lastIndex;
const isLink = item.href && !isLast;
return (
<li>
{isLink ? (
<a href={item.href}>{item.label}</a>
) : (
<span aria-current={isLast ? 'page' : undefined}>{item.label}</span>
)}
</li>
);
})
}
</ol>
</nav>

View file

@ -1,57 +0,0 @@
---
import type { ImageMetadata } from 'astro';
import { Picture } from 'astro:assets';
interface Props {
src: ImageMetadata;
alt: string;
href?: string;
class?: string;
widths: number[];
sizes: string;
loading?: 'lazy' | 'eager';
fetchpriority?: 'high' | 'low' | 'auto';
ariaLabel?: string;
// When the listing already has a focusable, screen-reader-visible title
// link, the thumbnail link is visually duplicative. We keep it clickable
// for pointer users but drop it from the tab order. The link still needs
// a name because some assistive tech exposes non-tabbable links.
decorative?: boolean;
}
const {
src,
alt,
href,
class: extraClass,
widths,
sizes,
loading = 'lazy',
fetchpriority,
ariaLabel,
decorative = true,
} = Astro.props;
const Tag = href ? 'a' : 'div';
const isDecorativeLink = Boolean(href) && decorative;
---
<Tag
class:list={['entry-thumbnail', extraClass]}
href={href}
tabindex={isDecorativeLink ? -1 : undefined}
aria-label={isDecorativeLink ? (ariaLabel ?? alt) : undefined}
>
<Picture
src={src}
alt={isDecorativeLink ? '' : alt}
formats={['avif', 'webp']}
fallbackFormat="jpg"
widths={widths}
sizes={sizes}
quality="high"
loading={loading}
decoding="async"
fetchpriority={fetchpriority}
/>
</Tag>

View file

@ -1,22 +0,0 @@
---
import { site } from '../lib/site';
const year = new Date().getFullYear();
---
<footer class="site-footer">
<div class="footer-meta">
<span class="footer-copyright">
<span>&copy;</span>
<span>{year}</span>
<span class="footer-name">{site.name}</span>
</span>
{/* address marks only the author's contact details, per HTML spec. */}
<address class="footer-contact">
<a href={`mailto:${site.email}`}>Email</a>
<a href={site.cv} rel="noopener">CV</a>
<a href={site.github} rel="noopener me">GitHub</a>
<a href={site.linkedin} rel="noopener me">LinkedIn</a>
</address>
</div>
</footer>

View file

@ -1,158 +0,0 @@
---
import { navItems, site } from '../lib/site';
const currentPath = Astro.url.pathname;
const current =
currentPath === '/' || currentPath.endsWith('/') || /\.[^/]+$/.test(currentPath)
? currentPath
: `${currentPath}/`;
// Exact match for the current page; section match (descendant URLs) for
// ancestor links. `aria-current="page"` is reserved for the exact page,
// `"true"` indicates an ancestor section.
function currentState(href: string): 'page' | 'true' | undefined {
if (current === href) return 'page';
if (href !== '/' && current.startsWith(href)) return 'true';
return undefined;
}
// Header shows nav items except Home and footer-only entries. RSS lives as a
// dedicated icon link to the right of the nav.
const headerNavItems = navItems.filter((item) => item.href !== '/' && !item.footerOnly);
---
<a class="skip-link" href="#content">Skip to content</a>
<header class="site-header">
<a class="site-title" href="/" aria-current={currentState('/')}>{site.brand}</a>
<div class="header-actions">
<nav class="site-nav" aria-label="Primary">
{
headerNavItems.map((item) => (
<a href={item.href} aria-current={currentState(item.href)}>
{item.label}
</a>
))
}
</nav>
<a class="rss-link" href="/rss.xml" aria-label="RSS feed">
<svg
class="rss-icon"
viewBox="0 0 24 24"
width="18"
height="18"
aria-hidden="true"
focusable="false"
>
<path
fill="currentColor"
d="M6.18 17.82a2.18 2.18 0 1 1-4.36 0 2.18 2.18 0 0 1 4.36 0ZM2 9.86v3.13a8.97 8.97 0 0 1 9.01 9.01h3.13A12.1 12.1 0 0 0 2 9.86Zm0-5.86V7.1A14.92 14.92 0 0 1 16.9 22H20A17.9 17.9 0 0 0 2 4Z"
></path>
</svg>
<span class="sr-only">RSS feed</span>
</a>
<button
id="theme-switcher"
class="theme-switcher"
type="button"
aria-label="Dark theme"
aria-pressed="false"
>
<svg
class="theme-switcher-icon theme-switcher-icon-sun"
viewBox="0 0 24 24"
width="18"
height="18"
aria-hidden="true"
focusable="false"
>
<circle cx="12" cy="12" r="4" fill="none" stroke="currentColor" stroke-width="2"
></circle>
<path
fill="none"
stroke="currentColor"
stroke-linecap="round"
stroke-width="2"
d="M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32 1.41 1.41M2 12h2m16 0h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"
></path>
</svg>
<svg
class="theme-switcher-icon theme-switcher-icon-moon"
viewBox="0 0 24 24"
width="18"
height="18"
aria-hidden="true"
focusable="false"
>
<path
fill="currentColor"
d="M21 13.79A8.5 8.5 0 0 1 10.21 3a7 7 0 1 0 10.8 10.79Z"></path>
</svg>
<span class="sr-only">Toggle theme</span>
</button>
</div>
</header>
<script is:inline data-theme-script>
// Co-located with the button so the initial aria state is set as soon as the
// button parses, avoiding a flash of the wrong icon. The theme itself is
// already on <html> from theme-init.js in <head>.
(function () {
var root = document.documentElement;
var switcher = document.getElementById('theme-switcher');
if (!switcher) return;
// Keep in sync with --color-bg in global.css and theme-init.js.
var THEME_BG = { light: '#fbfaf7', dark: '#201f1d' };
var themeColorMetas = document.querySelectorAll('meta[name="theme-color"]');
function sync(theme) {
switcher.setAttribute('aria-pressed', String(theme === 'dark'));
switcher.setAttribute(
'title',
theme === 'dark' ? 'Switch to light theme' : 'Switch to dark theme'
);
for (var i = 0; i < themeColorMetas.length; i += 1) {
themeColorMetas[i].setAttribute('content', THEME_BG[theme]);
}
}
sync(root.dataset.theme === 'dark' ? 'dark' : 'light');
var reduced = matchMedia('(prefers-reduced-motion: reduce)');
switcher.addEventListener('click', function () {
var next = root.dataset.theme === 'dark' ? 'light' : 'dark';
try {
localStorage.setItem('theme', next);
} catch (e) {}
var run = function () {
root.dataset.theme = next;
root.style.colorScheme = next;
sync(next);
};
if (!reduced.matches && typeof document.startViewTransition === 'function') {
document.startViewTransition(run);
} else {
run();
}
});
})();
</script>
<style>
.rss-link {
display: inline-flex;
align-items: center;
justify-content: center;
min-block-size: 44px;
min-inline-size: 44px;
color: inherit;
line-height: 0;
transition: color 150ms ease;
}
.rss-link:hover,
.rss-link:focus-visible {
color: var(--color-link-hover);
}
.rss-icon {
display: block;
}
</style>

View file

@ -1,30 +0,0 @@
---
import type { CollectionEntry } from 'astro:content';
import PostMediaFigure from './PostMediaFigure.astro';
type MediaItem = CollectionEntry<'posts'>['data']['media'][number];
interface Props {
items: MediaItem[];
}
const { items } = Astro.props;
// Wrap in a gallery `<ul>` when there's more than one item; otherwise the
// figures sit directly in the post flow.
const isGallery = items.length > 1;
---
{
isGallery ? (
<ul role="list" class="post-gallery">
{items.map((item) => (
<li>
<PostMediaFigure item={item} />
</li>
))}
</ul>
) : (
items.map((item) => <PostMediaFigure item={item} />)
)
}

View file

@ -1,81 +0,0 @@
---
import type { CollectionEntry } from 'astro:content';
import { Picture } from 'astro:assets';
type MediaItem = CollectionEntry<'posts'>['data']['media'][number];
interface Props {
item: MediaItem;
}
const { item } = Astro.props;
const videoWidth = item.type === 'video' ? (item.poster?.width ?? 1280) : undefined;
const videoHeight = item.type === 'video' ? (item.poster?.height ?? 720) : undefined;
---
<figure class="post-media">
{
item.type === 'video' ? (
// Decorative videos stay inert and hidden from assistive tech. Meaningful
// videos expose controls, captions, and an accessible name.
item.decorative ? (
<video
muted
playsinline
preload="metadata"
poster={item.poster?.src}
width={videoWidth}
height={videoHeight}
aria-hidden="true"
tabindex="-1"
>
{item.webm && <source src={item.webm} type="video/webm" />}
{item.mp4 && <source src={item.mp4} type="video/mp4" />}
</video>
) : (
<video
controls
preload="none"
poster={item.poster?.src}
width={videoWidth}
height={videoHeight}
aria-label={item.alt}
>
{item.webm && <source src={item.webm} type="video/webm" />}
{item.mp4 && <source src={item.mp4} type="video/mp4" />}
{item.captions && (
<track
kind="captions"
src={item.captions}
srclang="en"
label={item.captionsLabel}
default
/>
)}
</video>
)
) : (
item.src && (
<Picture
src={item.src}
alt={item.decorative ? '' : (item.alt ?? '')}
formats={['avif', 'webp']}
widths={[480, 960, 1280, 1920]}
sizes="(max-width: 700px) calc(100vw - 2 * clamp(20px, 4vw, 32px)), (max-width: 1100px) min(calc(100vw - 4rem), 56rem), 56rem"
quality="high"
loading="lazy"
decoding="async"
/>
)
)
}
{item.caption && !item.decorative && <figcaption>{item.caption}</figcaption>}
{
item.transcript && (
<p class="media-transcript">
<strong>Transcript:</strong> {item.transcript}
</p>
)
}
</figure>

View file

@ -1,119 +0,0 @@
---
import { Picture } from 'astro:assets';
import type { CollectionEntry } from 'astro:content';
import { absoluteUrl } from '../lib/site';
interface Props {
post: CollectionEntry<'posts'>;
}
const { post } = Astro.props;
const demoLink = post.data.links.find(
(link) => !link.download && link.label.trim().toLowerCase() === 'demo'
);
const iframeUrl = post.data.iframeThumbnail ? demoLink?.url : undefined;
const iframeSrc = iframeUrl?.startsWith('/') ? absoluteUrl(iframeUrl) : iframeUrl;
const iframeTitle = demoLink
? `${demoLink.label}: ${post.data.title}`
: `Embedded demo: ${post.data.title}`;
const aspectRatio = `${post.data.thumbnail.src.width} / ${post.data.thumbnail.src.height}`;
const iframeThumbnailScript = `
for (const root of document.querySelectorAll('.post-thumbnail--iframe')) {
const trigger = root.querySelector('[data-thumbnail-iframe-trigger]');
const frame = root.querySelector('[data-thumbnail-iframe-frame]');
if (!(trigger instanceof HTMLButtonElement) || !(frame instanceof HTMLIFrameElement)) {
continue;
}
trigger.addEventListener(
'click',
() => {
const src = trigger.dataset.iframeSrc;
if (!src) return;
if (window.isSecureContext === false) {
const opened = window.open('', '_blank');
if (!opened) {
window.location.href = src;
} else {
opened.opener = null;
opened.location.href = src;
}
return;
}
frame.src = src;
frame.hidden = false;
root.classList.add('is-active');
trigger.setAttribute('aria-expanded', 'true');
frame.focus();
},
{ once: true }
);
}
`;
---
<div
class:list={['post-thumbnail', iframeSrc && 'post-thumbnail--iframe']}
style={iframeSrc ? `--post-thumbnail-aspect: ${aspectRatio}` : undefined}
data-uncropped-preview
data-preview-label={post.data.title}
>
<Picture
src={post.data.thumbnail.src}
alt={post.data.thumbnail.alt}
formats={['avif', 'webp']}
fallbackFormat="jpg"
widths={[640, 960, 1280, 1920]}
sizes="(max-width: 700px) calc(100vw - 3rem), (max-width: 1100px) calc(100vw - 4rem), 56rem"
quality="high"
loading="eager"
fetchpriority="high"
decoding="async"
/>
{
iframeSrc && (
<>
<button
class="post-thumbnail__play"
type="button"
data-thumbnail-iframe-trigger
data-iframe-src={iframeSrc}
aria-label={`Play ${demoLink?.label.toLowerCase() ?? 'demo'}`}
aria-expanded="false"
>
<span class="post-thumbnail__play-icon" aria-hidden="true">
<svg viewBox="0 0 24 24" focusable="false">
<path d="M8 5v14l11-7z" />
</svg>
</span>
<span class="sr-only">Play {demoLink?.label.toLowerCase() ?? 'demo'}</span>
</button>
<iframe
class="post-thumbnail__iframe"
data-thumbnail-iframe-frame
title={iframeTitle}
src="about:blank"
allow="fullscreen; webgpu"
allowfullscreen
referrerpolicy="strict-origin-when-cross-origin"
tabindex="0"
hidden
/>
<noscript>
<p class="post-thumbnail__noscript">
<a href={iframeSrc}>Open {demoLink?.label.toLowerCase() ?? 'demo'}</a>
</p>
</noscript>
</>
)
}
</div>
{
iframeSrc && (
<script is:inline data-thumbnail-iframe-script set:html={iframeThumbnailScript} />
)
}

View file

@ -1,64 +0,0 @@
---
import type { CollectionEntry } from 'astro:content';
type Link = CollectionEntry<'projects'>['data']['links'][number];
interface Props {
links: Link[];
}
const { links } = Astro.props;
function isExternal(url: string) {
return /^https?:\/\//.test(url);
}
---
{
links.length > 0 && (
<ul class="project-links">
{links.map((link) => (
<li>
<a
href={link.url}
download={link.download ? '' : undefined}
rel={isExternal(link.url) ? 'noopener noreferrer' : undefined}
target={isExternal(link.url) ? '_blank' : undefined}
>
{link.label}
{isExternal(link.url) && (
<>
<svg
class="external-link-icon"
xmlns="http://www.w3.org/2000/svg"
width="0.85em"
height="0.85em"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
<polyline points="15 3 21 3 21 9" />
<line x1="10" y1="14" x2="21" y2="3" />
</svg>
<span class="sr-only">(opens in new tab)</span>
</>
)}
{link.download && (
<>
<span class="download-indicator" aria-hidden="true">
</span>
<span class="sr-only">(download)</span>
</>
)}
</a>
</li>
))}
</ul>
)
}

View file

@ -1,75 +0,0 @@
---
import type { CollectionEntry } from 'astro:content';
import { getEntry } from 'astro:content';
import EntryThumbnail from './EntryThumbnail.astro';
import ProjectLinks from './ProjectLinks.astro';
import { PROJECT_THUMBNAIL, articlePath, entrySlug } from '../lib/site';
interface Props {
projects: CollectionEntry<'projects'>[];
// Opt-in: eagerly load thumbnails that are reliably above the fold. Lists
// below substantial content should leave this at zero.
eagerFirstThumbnail?: boolean;
eagerThumbnailCount?: number;
}
const {
projects,
eagerFirstThumbnail = false,
eagerThumbnailCount = eagerFirstThumbnail ? 1 : 0,
} = Astro.props;
// The `essay` field is a `reference('posts')`, so when present it's always a
// `{ collection, id }` shape that `getEntry` resolves to a CollectionEntry.
// Drafts are skipped because their article page is not built.
const essayHrefs = new Map<string, string>();
for (const project of projects) {
const essay = project.data.essay;
if (!essay) continue;
const resolved = await getEntry(essay);
if (resolved && !resolved.data.draft) essayHrefs.set(project.id, articlePath(resolved));
}
---
<ol class="project-list">
{
projects.map((project, index) => {
const anchor = entrySlug(project);
const titleId = `${anchor}-title`;
const essayHref = essayHrefs.get(project.id);
const primaryHref = essayHref ?? project.data.links[0]?.url;
const eager = index < eagerThumbnailCount;
return (
<li class="project-card" id={anchor}>
<EntryThumbnail
src={project.data.thumbnail.src}
alt={project.data.thumbnail.alt}
href={primaryHref}
class="project-thumbnail"
widths={PROJECT_THUMBNAIL.widths}
sizes={PROJECT_THUMBNAIL.sizes}
ariaLabel={`Open project: ${project.data.title}`}
loading={eager ? 'eager' : 'lazy'}
fetchpriority={eager && index === 0 ? 'high' : undefined}
/>
<article class="project-card__summary">
<h3 id={titleId}>
{primaryHref ? (
<a href={primaryHref}>{project.data.title}</a>
) : (
project.data.title
)}
{essayHref && <span class="project-essay-badge">Article</span>}
</h3>
<p class="project-description">{project.data.description}</p>
<p class="project-meta">
{project.data.period} · {project.data.technologies.join(', ')}
</p>
{project.data.links.length > 0 && <ProjectLinks links={project.data.links} />}
</article>
</li>
);
})
}
</ol>

View file

@ -1,40 +0,0 @@
---
import { tagPath } from '../lib/site';
interface Props {
tags: readonly string[];
currentTag?: string;
limit?: number;
counts?: Record<string, number>;
}
const { tags, currentTag, limit, counts } = Astro.props;
const visibleTags = typeof limit === 'number' ? tags.slice(0, limit) : tags;
const remaining =
typeof limit === 'number' && tags.length > limit ? tags.length - limit : 0;
---
<ul class="tag-list">
{
visibleTags.map((tag) => (
<li>
<a href={tagPath(tag)} aria-current={tag === currentTag ? 'page' : undefined}>
{tag}
{counts && counts[tag] !== undefined && (
<span class="tag-count">{counts[tag]}</span>
)}
</a>
</li>
))
}
{
remaining > 0 && (
<li>
<a href="/tags/" class="tag-more">
+{remaining} more
</a>
</li>
)
}
</ul>

View file

@ -1,169 +0,0 @@
import { defineCollection, reference } from 'astro:content';
import type { SchemaContext } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';
function isRootRelativeUrl(url: string) {
return url.startsWith('/') && !url.startsWith('//');
}
const linkUrl = z.string().refine(
(url) => {
if (isRootRelativeUrl(url)) return true;
try {
const parsed = new URL(url);
return ['https:', 'mailto:'].includes(parsed.protocol);
} catch {
return false;
}
},
{ message: 'URL must be an absolute https/mailto URL or a root-relative path.' }
);
const mediaUrl = z.string().refine(
(url) => {
if (isRootRelativeUrl(url)) return true;
try {
return new URL(url).protocol === 'https:';
} catch {
return false;
}
},
{ message: 'Media URL must be an absolute https URL or a root-relative path.' }
);
function isIframeUrl(url: string) {
if (isRootRelativeUrl(url)) return true;
try {
return new URL(url).protocol === 'https:';
} catch {
return false;
}
}
const linkSchema = z.object({
label: z.string(),
url: linkUrl,
download: z.boolean().optional(),
});
const thumbnailSchema = ({ image }: SchemaContext) =>
z.object({
src: image(),
alt: z.string().min(1, 'Thumbnail alt text must not be empty.'),
});
const mediaSchema = ({ image }: SchemaContext) =>
z
.discriminatedUnion('type', [
z.object({
type: z.enum(['image', 'diagram']),
src: image(),
alt: z.string().optional(),
decorative: z.boolean().optional(),
caption: z.string().optional(),
transcript: z.string().optional(),
}),
z
.object({
type: z.literal('video'),
poster: image().optional(),
mp4: mediaUrl.optional(),
webm: mediaUrl.optional(),
captions: mediaUrl.optional(),
captionsLabel: z.string().default('English captions'),
alt: z.string().optional(),
decorative: z.boolean().optional(),
caption: z.string().optional(),
transcript: z.string().optional(),
})
.refine((item) => Boolean(item.mp4) || Boolean(item.webm), {
message: 'Video media needs at least one mp4 or webm source.',
}),
])
.refine((item) => item.decorative || (Boolean(item.alt) && Boolean(item.caption)), {
message: 'Meaningful media needs both alt text and a caption.',
})
.refine(
(item) => item.type !== 'video' || item.decorative || Boolean(item.captions),
{
message: 'Meaningful video needs captions.',
}
)
.refine(
(item) => item.type !== 'video' || item.decorative || Boolean(item.transcript),
{
message: 'Meaningful video needs a transcript.',
}
);
const posts = defineCollection({
loader: glob({ pattern: '**/*.md', base: './src/content/posts' }),
schema: ({ image }) =>
z
.object({
title: z.string(),
description: z.string().max(160),
date: z.coerce.date(),
updated: z.coerce.date().optional(),
draft: z.boolean().default(false),
thumbnail: thumbnailSchema({ image }),
iframeThumbnail: z.boolean().default(false),
tags: z.array(
z.enum([
'ai',
'systems',
'graphics',
'simulation',
'embedded',
'web',
'tools',
'games',
])
),
featuredOrder: z.number().optional(),
projectPeriod: z.string().optional(),
role: z.string().optional(),
stack: z.array(z.string()).optional(),
scale: z.string().optional(),
outcome: z.string().optional(),
audience: z
.enum(['general', 'technical', 'recruiter-relevant'])
.default('technical'),
links: z.array(linkSchema).default([]),
media: z.array(mediaSchema({ image })).default([]),
})
.refine(
(post) =>
!post.iframeThumbnail ||
post.links.some(
(link) =>
!link.download &&
link.label.trim().toLowerCase() === 'demo' &&
isIframeUrl(link.url)
),
{
path: ['iframeThumbnail'],
message:
'iframeThumbnail requires a non-download Demo link with an https or root-relative URL.',
}
),
});
const projects = defineCollection({
loader: glob({ pattern: '**/*.md', base: './src/content/projects' }),
schema: ({ image }) =>
z.object({
title: z.string(),
description: z.string().max(160),
thumbnail: thumbnailSchema({ image }),
period: z.string(),
sortDate: z.coerce.date(),
technologies: z.array(z.string()).default([]),
selected: z.boolean().default(false),
essay: reference('posts').optional(),
links: z.array(linkSchema).default([]),
}),
});
export const collections = { posts, projects };

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

View file

@ -1,47 +0,0 @@
<svg width="200" height="200" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#4A90E2;stop-opacity:1" />
<stop offset="100%" style="stop-color:#357ABD;stop-opacity:1" />
</linearGradient>
</defs>
<!-- Background circle -->
<circle cx="100" cy="100" r="90" fill="url(#grad1)" opacity="0.15"/>
<!-- Main vault icon -->
<g transform="translate(100, 100)">
<!-- Vault body -->
<rect x="-45" y="-50" width="90" height="80" rx="8" fill="none" stroke="url(#grad1)" stroke-width="6"/>
<!-- Vault door circle -->
<circle cx="0" cy="-10" r="22" fill="none" stroke="url(#grad1)" stroke-width="5"/>
<circle cx="0" cy="-10" r="14" fill="none" stroke="url(#grad1)" stroke-width="3"/>
<circle cx="0" cy="-10" r="6" fill="url(#grad1)"/>
<!-- Vault handle -->
<line x1="0" y1="-4" x2="18" y2="-4" stroke="url(#grad1)" stroke-width="3" stroke-linecap="round"/>
<circle cx="18" cy="-4" r="4" fill="url(#grad1)"/>
<!-- Link chain -->
<g opacity="0.9">
<!-- Left link -->
<ellipse cx="-30" cy="40" rx="12" ry="8" fill="none" stroke="url(#grad1)" stroke-width="4"/>
<!-- Right link -->
<ellipse cx="30" cy="40" rx="12" ry="8" fill="none" stroke="url(#grad1)" stroke-width="4"/>
<!-- Center link connecting them -->
<ellipse cx="0" cy="40" rx="12" ry="8" fill="none" stroke="url(#grad1)" stroke-width="4"/>
</g>
<!-- Sync arrows (subtle) -->
<g opacity="0.5">
<!-- Clockwise arrow top-right -->
<path d="M 35 -35 Q 50 -35 50 -20 L 50 -15" fill="none" stroke="url(#grad1)" stroke-width="2.5" stroke-linecap="round"/>
<polygon points="50,-15 47,-22 53,-22" fill="url(#grad1)"/>
<!-- Counter-clockwise arrow bottom-left -->
<path d="M -35 25 Q -50 25 -50 10 L -50 5" fill="none" stroke="url(#grad1)" stroke-width="2.5" stroke-linecap="round"/>
<polygon points="-50,5 -47,12 -53,12" fill="url(#grad1)"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2 KiB

View file

@ -1,44 +0,0 @@
---
title: A 50 FPS Game Engine on an 8-Bit Microcontroller
description: 'A handheld game built from the PCB up: ATtiny85V, OLED, IR receiver, EEPROM, 8 MHz 8-bit ALU. 50 FPS floor.'
date: 2026-05-06
projectPeriod: 'Spring 2020'
thumbnail:
src: ./_assets/ad-astra.jpg
alt: The Ad Astra game running on a small OLED display.
tags: ['embedded', 'games', 'systems']
role: Hardware and firmware author
stack: ['C', 'ATtiny85V', 'SPI OLED', 'IR receiver', 'EEPROM', 'KiCad']
scale: 8 MHz, 8-bit ALU, ~31 mW at full brightness, ~1.5 mA standby, 1520 ms frame budget
outcome: A handheld built from schematic to firmware, with a 50 FPS game on it
audience: technical
links:
- label: Source
url: https://github.com/schmelczer/ad_astra
media:
- type: video
poster: ./_assets/ad-astra.jpg
webm: /media/video/ad_astra.webm
mp4: /media/video/ad_astra.mp4
captions: /media/video/ad_astra.vtt
alt: Video demonstration of the embedded game running on a small OLED display.
caption: The whole thing, from board and firmware to sprites and game loop, runs on a single ATtiny85V at 8 MHz.
transcript: No spoken dialogue. The handheld board runs its OLED game; the player moves through the small display while the IR input controls gameplay.
---
I'd done microcontroller work on dev boards before and it always felt like I was renting the hardware. As soon as I had a real board with my own soldering on it, bugs stopped feeling like software inconveniences and started feeling like consequences of choices I'd made in KiCad. That shift was most of the value of doing it this way. Four years on from [my first hardware project](/articles/lights-synchronized-to-music/), the lesson was that owning the whole stack down to the copper changes how you debug.
This one is a handheld game built from the PCB up around an ATtiny85V: 8-bit ALU at 8 MHz, no FPU, no SIMD, 8 KB of flash. Anything I built had to fit inside that, or I'd be staring at a brick.
## The bits worth showing
- **SIMD-on-an-8-bit-ALU display driver.** The OLED is 128×64 monochrome, 1024 bytes per frame. The driver packs four pixels into a byte and processes them with bit-parallel tricks. That's how the frame budget stayed under 20 ms with room for game logic.
- **Prototype-based inheritance, in C.** Entities share behaviour by pointing at a struct of function pointers. No vtable, no class, no allocator. Cheap dispatch and the whole object model fits on one screen.
- **Atomic EEPROM commits.** Sprite data and save state both live in EEPROM. The commit path writes a new region, then swaps a tiny header pointer. Pull the battery mid-write and the previous version is intact.
- **PNG-to-C sprite pipeline.** A Python script turns PNG artwork into static C arrays the firmware can include directly. Asset workflow without ever leaving the source tree.
## What I'd change
- **A host-side emulator.** Debugging firmware directly on hardware was character-building and slow. A small SDL-based simulator linking the same C code would have shortened the iteration loop from "reflash and hope" to "rebuild and run."
- **Power numbers I'd actually trust.** I have peak and standby draw. I don't have a curve over a real gameplay session, so I honestly can't say how long the battery lasts under load. I can only say it outlasted my patience.
- **A development log for the driver.** The display driver and the EEPROM commit protocol are the parts I'd still defend. They deserved diagrams and measurements at the time, not the half page of comments I left them with.

View file

@ -1,16 +0,0 @@
---
title: Avoid
description: My first browser game. Tiny, archived for honesty.
date: 2026-04-29
projectPeriod: 'January 2018'
thumbnail:
src: ./_assets/avoid.jpg
alt: Screenshot of the Avoid web game.
tags: ['games', 'web']
role: Game author
stack: ['JavaScript', 'Canvas']
outcome: My first browser game; kept for the timeline
audience: general
---
Keeping it here because pretending the older work didn't happen would be dishonest. The first browser game I wrote, January 2018. It isn't good, but it was the moment a `<canvas>` element stopped being mysterious.

View file

@ -1,97 +0,0 @@
---
title: Backing Up Running Databases Without Stopping Them
description: A Bash container around BorgBackup. BTRFS snapshots give atomic consistency, numeric env vars give multi-target 3-2-1, the loop is sleep not cron.
date: 2026-05-29
projectPeriod: '2024-2026'
thumbnail:
src: ./_assets/backup.png
alt: Placeholder thumbnail for the backup container post.
tags: ['systems', 'tools']
role: Container and script author
stack: ['Bash', 'BorgBackup', 'BTRFS', 'Alpine', 'Docker', 'SSH', 'zstd']
scale: One container, multiple targets per host, two years of restored incidents
outcome: A self-hosted backup that has survived every actual incident I've thrown at it
audience: technical
links:
- label: Source
url: https://github.com/schmelczer/backup-container
- label: Container image
url: https://github.com/schmelczer/backup-container/pkgs/container/backup-container
---
Once you self-host a few services with live databases, the backup question stops being theoretical. A Postgres or SQLite file half-written when `tar` reads it goes into the archive in a state nothing on Earth will replay; you just don't find out until the restore. Two years in, with multiple incidents I had to actually recover from (including the photos behind the [e-ink frame](/articles/frame-eink-photo-display/)), I trust this stack precisely because the correctness argument is short: BTRFS gives me an atomic snapshot, and everything above it can be a shell script. One Alpine container, ~75 lines of Bash, pushes that snapshot to one or more [Borg](https://borgbackup.readthedocs.io/) repositories on a fixed interval. Multi-target is numeric env vars (`BORG_REPO_0`, `BORG_REPO_1`, ...). No config format, no DSL; the env file is the configuration.
## The problem the snapshot solves
I self-host several databases that are mid-write at every moment of the day. `tar | borg create` against the live volume is a race: a Postgres or SQLite file that's half-written when borg reads it goes into the archive in a state nothing on Earth can replay. The "right" answer is to coordinate a quiesce with every database: a fan-out of `pg_dump`, SQLite `.backup`, Redis `BGSAVE`, and so on, all with retry, timeouts, and per-app credentials.
The cheaper answer, if you've put everything on one BTRFS volume, is `btrfs subvolume snapshot`. It returns instantly with a copy-on-write fork of the entire filesystem. Every file is now atomically consistent at exactly the same instant. Run borg against the snapshot, not against the live volume.
```bash
btrfs subvolume snapshot /btrfs-root /snapshot
cd "/snapshot/btrfs-root${BACKUP_RELATIVE_PATH:-}"
borg create ... ::"{hostname}-{now:%Y-%m-%dT%H:%M:%S}" .
```
The snapshot lives only for the duration of the borg run. A `trap cleanup EXIT` deletes the subvolume whether the backup succeeded, failed, or was killed. The next run snapshots fresh.
This shifts the entire correctness argument from "did I quiesce every database in time" to "does BTRFS give me a consistent snapshot." It does. That's why everything below it can be a shell script.
## Multi-target as numeric env vars
The 3-2-1 backup rule wants three copies, two media, one offsite. My answer is a remote (rsync.net) and a local HDD, both fed from the same snapshot. The wire format for "multiple targets" is just numbered env vars:
```sh
BORG_PASSPHRASE_0=...
BORG_REMOTE_PATH_0=borg1
BORG_REPO_0=username@username.rsync.net:~/backup
BORG_PASSPHRASE_1=...
BORG_REPO_1=/local-backup
```
`backup-wrapper.sh` loops `index=0` upward, exports `BORG_PASSPHRASE` / `BORG_REPO` / `BORG_REMOTE_PATH` from the indexed copies, runs `backup.sh`, unsets them, increments. Stops the first time the next index has no passphrase.
There's also a no-index fallback (`BORG_REPO=...` with no number) for the single-target case. Same script, no extra config plane.
I keep coming back to this pattern for small-system orchestration. The env file _is_ the data structure. There's no YAML parsing, no JSON schema, no config-validation layer between you and the variable that actually matters.
## The scheduler is a sleep, not cron
```bash
while true; do
/src/backup-wrapper.sh 2>&1 | log_message
sleep "$SLEEP_TIME"
done
```
A comment in the file says it out loud: "Using a simple sleep loop to schedule backups instead of cron to avoid concurrency issues." Cron with a one-hour cadence and a backup that occasionally takes 70 minutes will eventually overlap itself. The sleep-loop can't: the next run starts when the previous one is done, plus the interval. One process, one snapshot, one borg invocation. Concurrency bugs you can't have are concurrency bugs you don't have.
## Healthcheck is a file mtime
`borg create` succeeded? Write `date > /health/backup_completion_time.log`. The Docker healthcheck shells out every 10 seconds and compares that mtime against `MAX_BACKUP_AGE_SECONDS` (default 86400). Older than that, container is unhealthy and whatever's watching containers (in my case a notification hook) finds out.
Two subtleties worth naming:
- **First-boot grace period.** If `backup_completion_time.log` doesn't exist yet (fresh container, first backup still running), fall back to `container_start_time.log` so the container isn't reported unhealthy during the first scheduled run.
- **Partial success is not success.** In multi-target mode, the completion log is only written if _every_ target succeeded. One repo failing means the healthcheck stays red even if the other two are fine. Stale-but-quiet was the failure mode I wanted to make impossible.
## Smaller calls
- **`borg break-lock` at the start of every run.** If the previous container was killed mid-backup, the repo is locked and the next `borg create` will hang. Just break it. There's only ever one writer because of the sleep loop.
- **`set -e` after `borg init`, not before.** The init line is the only one allowed to fail (first run on a fresh repo). Everything after halts on error.
- **`BORG_RSH='ssh -oBatchMode=yes'`.** Fail fast if SSH would have prompted, instead of hanging forever inside a detached container.
- **`ServerAliveInterval 30` in `ssh_config`.** Long borg transfers across home-ISP NAT get killed if nothing flows for a few minutes. Keepalives keep the tunnel open.
- **`--files-cache=ctime,size,inode`.** The default `mtime,size,inode` re-hashes files when their mtime changes; on BTRFS, ctime is the more honest signal of "this content actually changed."
- **`compression=zstd,12`.** The sweet spot for backup data on my hardware: substantially better than zlib, not so slow it dominates the run.
- **`borg compact --threshold=5 --cleanup-commits`.** Reclaims space from pruned archives whenever the segment-file fragmentation crosses 5%.
- **`IGNORE_GIT_UNTRACKED=true`.** Optional. Walks every `.git` dir under the snapshot, runs `git ls-files --others --exclude-standard`, and feeds the result into `--exclude-from`. Skips `target/`, `node_modules/`, build caches; anything the repo already knows isn't worth keeping.
- **`SYS_ADMIN` capability on the container.** Needed for `btrfs subvolume snapshot` and `delete` from inside the namespace. The narrower capability set didn't have a way through.
## What I'd change
- **A test rig that restores into an empty volume on a schedule.** "Backups exist" is not the property I care about. "Backups restore" is. I have anecdotal evidence after every incident; I don't have a green checkmark before one.
- **A failure notifier separate from the healthcheck.** Docker healthcheck-unhealthy is one signal; I'd also want an explicit push (ntfy, email, Telegram) on first failure of a run, so I don't have to be watching the container state.
- **Parallel targets when network and disk don't compete.** The current loop is strictly sequential: rsync.net then local HDD. They share neither bandwidth nor spindles; they could run in parallel and halve the wall-clock. Sequential made the wrapper trivial; the trade was knowable and I made it.
Two years in, the part I'd defend hardest is the snapshot. Everything above it is a wrapper that could be rewritten in an afternoon. The snapshot is what makes the wrapper allowed to be one.

View file

@ -1,21 +0,0 @@
---
title: A Unity City Where Bad PLC Code Made Cars Crash
description: A REST-controlled traffic-light sim for a cybersecurity event. Bad PLC code showed up as car crashes, the most honest feedback loop I've shipped.
date: 2026-05-01
projectPeriod: 'July-August 2018'
thumbnail:
src: ./_assets/city-simulation.jpg
alt: Screenshot of a Unity traffic simulation.
tags: ['simulation', 'systems']
role: Simulation author
stack: ['Unity', 'C#', 'REST API', 'Blender']
outcome: Visible consequences for an otherwise abstract PLC challenge
audience: technical
links: []
---
Most security challenges punish wrong answers with a red "incorrect." This one punished them with car wrecks, and people learned faster. A PLC cybersecurity event in the summer of 2018 needed something visceral; I built a small Unity city where the traffic lights were driven by a REST API and contestants wrote the control logic.
All decisions ran on the server and got broadcast to clients. The harder problem wasn't the simulation; it was making the broadcast fault-tolerant on conference Wi-Fi without flooding it. I built it solo, including the models and animations in Blender. Not a flex, just context for why everything's a little janky.
There was also a HUD overlay for tweets. It felt clever at the time and dated horribly. Skip that part.

View file

@ -1,48 +0,0 @@
---
title: One Game Library, Imported by Both the Client and the Server
description: A mobile multiplayer browser game where client and server linked the same TypeScript module. One source of truth, one fewer class of bug.
date: 2026-05-07
projectPeriod: 'Autumn-Winter 2020'
thumbnail:
src: ./_assets/decla-red.jpg
alt: The decla.red browser game interface showing a space scene.
tags: ['games', 'web', 'systems']
role: Game and backend systems author
stack: ['TypeScript', 'Node.js', 'WebSockets', 'Firebase', 'WebGL', 'SDF-2D']
scale: Multiple game servers, each talking to 1632 clients, browser and mobile
outcome: A multiplayer browser game that proved SDF-2D survived a real game loop
audience: technical
links:
- label: Source
url: https://github.com/schmelczer/decla.red
- label: BSc thesis
url: /media/downloads/sdf2d-andras-schmelczer.pdf
download: true
media:
- type: image
src: ./_assets/decla-red.jpg
alt: The decla.red browser game interface showing a space scene with team controls and planets.
caption: A real game loop is a worse audience than a tech demo. That's the point.
---
My thesis was a renderer; proving it in a real multiplayer loop was the point. A real game loop is a worse audience than a tech demo. That's the point. So through autumn 2020 I built decla.red on top of [SDF-2D](/articles/sdf-2d-ray-tracing/): a conquest-style space shooter, two teams, small planets, ray-traced 2D rendering, browser and mobile. The architecture decision worth remembering came out of needing the server and the client to stop lying to each other: one TypeScript module containing the game rules, linked by both sides of the wire.
## The split that usually goes wrong
Real-time multiplayer has an awkward two-machine problem. The server has to be authoritative or the game is cheatable; the client has to feel immediate or the game is unplayable. If you write the rules twice, once on each side, they will drift. Eventually a player's screen will say one thing and the server will think another.
I wanted the server's "compute the next state" function and the client's "predict the next state locally" function to be literally the same function. So I put the rules in a shared TypeScript library, published nothing, and had both `package.json` files link to it.
The win wasn't elegance, it was the bugs that didn't happen. Client prediction stopped being an approximation of the server; it _was_ the server, run optimistically and reconciled when the authoritative update came back.
## Other choices worth a sentence
- **k-d trees for spatial queries.** Once the world held more than a few dozen objects, naive collision and proximity checks dominated the server tick. A k-d tree dropped them out of the profile.
- **Message-passing object model.** Lifted from Smalltalk's `doesNotUnderstand:` idea. Entities respond to messages they care about and ignore the rest. Easier to extend than the inheritance tree I tried first, and less brittle.
- **Firebase only for server discovery.** Not for game state, just for "which servers are currently in the pool." Tiny consistent store, didn't need to write one.
## What I'd change
- **Observability for desync.** Multiplayer systems live or die by visibility into divergence. I had logs; I needed dashboards showing the rate, the shape, and the triggering interaction for every prediction miss. Without those, debugging was guessing.
- **Don't tangle rendering and networking in the same tree.** Both were interesting, both put different kinds of pressure on the architecture, and the directories grew into each other. Separate top-level folders from day one next time.
- **Skip multi-server until the math demands it.** I wired up multi-server early because it sounded right. With 1632 clients per server I was nowhere near needing it; the complexity wasn't free.

View file

@ -1,33 +0,0 @@
---
title: A Physics Practice App for the Hungarian Érettségi
description: A static jQuery site I built in high school to drill past exam questions. 659 questions, a decade of past papers, still online and still used.
date: 2026-05-28
projectPeriod: '2017-2018'
thumbnail:
src: ./_assets/fizika.jpg
alt: Screenshot of the Fizika practice app showing topic-selection buttons over a light textured background.
tags: ['web', 'tools']
role: Question database, frontend, backend
stack: ['jQuery', 'vanilla HTML/CSS', 'Node/Express', 'JSON', 'localStorage']
outcome: A free practice app real students still find when they search for past érettségi physics papers
audience: general
links:
- label: Live
url: https://fizika.schmelczer.dev
- label: Source
url: https://home.schmelczer.dev/git/andras/fizika
---
I needed it. In my last year of high school I was about to sit the _emelt szintű_ (advanced-level) physics érettségi, and the practice material I could find online was either paywalled or scattered across PDFs that wouldn't tell you whether your answer was right. So one evening I started typing past exam questions into a JSON file. A few weeks later I had something resembling a study tool, and a few weeks after that I had 659 questions covering more than a decade of past papers.
The site is intentionally small. A static frontend on jQuery, four CSS files, a JSON blob of questions, a folder of scanned diagrams from the original papers. You pick a topic (_Mechanika, Hőtan, Elektromosság, Atomfizika_) or hunt down a specific year's exam, get a randomised quiz, answer, and the page colours each row green or red. Past results sit in `localStorage`, because the audience was high schoolers; account-less was the privacy answer.
It outgrew Firebase eventually. I moved the data to a small Express backend so I could keep editing questions without a paid plan, with a JSON file and an image folder as the storage layer. The admin routes have no auth; instead, the service stays off the public internet and I edit through an SSH-forwarded localhost. Fine for a one-person CMS, terrible advice for anything with multiple editors.
What I'd change if I were starting it now:
- **Astro instead of jQuery plus a Node server.** The whole thing could be one static site that re-renders on push. No backend, no CSP fiddling, no Docker.
- **Markdown source, not a hand-edited JSON file.** Editing questions in JSON is fine until you forget a comma at 1am and the site stops loading.
- **A real licence note on the question text.** The papers are public exam material, but it's worth saying so somewhere on the page.
It's been online in some form for eight years. Every spring I get a few emails from students asking whether I'll add the latest year's paper. I usually do, eventually. The thing I made for myself in 2017 is still doing its job for someone else's last year of high school, and that's the only metric on it I actually care about.

View file

@ -1,71 +0,0 @@
---
title: A WebGPU Drawing Garden Where Agents Rewrite Your Strokes
description: A single-file WebGPU drawing toy. You stroke a colour, agents follow it, and a 3×3 matrix per vibe gives each preset its personality.
date: 2026-05-22
projectPeriod: '2026'
thumbnail:
src: ./_assets/fleeting-garden.jpg
alt: A kaleidoscopic Fleeting Garden snapshot of cyan, violet, and yellow agent trails radiating from a central knot.
iframeThumbnail: true
tags: ['graphics', 'simulation', 'web']
role: Graphics and shader author
stack: ['TypeScript', 'WebGPU', 'WGSL', 'Compute shaders', 'Vite', 'Tweakpane']
scale: One HTML file, ~10 WGSL shaders, 6 vibe presets, 60 FPS target on consumer hardware
outcome: A browser drawing toy where user strokes seed an agent simulation that overwrites them
audience: technical
links:
- label: Demo
url: /fleeting/
- label: Source
url: https://home.schmelczer.dev/git/andras/webgpu
media:
- type: image
src: ./_assets/fleeting-garden.jpg
alt: Close-up of intertwining cyan, violet, and yellow agent trails radiating into a kaleidoscopic central knot.
caption: A snapshot from one session. What you see is the trail texture; the agents that drew it are already gone.
---
Nine numbers in `{-1, 0, 1}` arranged in a 3×3 matrix decide an entire vibe's personality. That constraint is what kept me up: proving simplicity can be expressive, that you don't need a behaviour function per preset. A WebGPU drawing toy where you stroke a colour, agents spawn along it, and the garden slowly overwrites the patch you laid down. One static HTML file, six compute stages, none of them skippable.
## Why physarum needed a knob
Physarum-style agent sims are everywhere and most of them stop being interesting after thirty seconds, because they converge to the same family of branching shapes no matter what you feed them. Seeding the initial condition isn't enough; the input has to keep being a force inside the loop, otherwise you're just watching the attractor settle.
My second self-imposed constraint was that one engine had to produce six visibly different presets without forking. The first prototype had a `switch (preset)` with one behaviour function per vibe and it was already painful at vibe two. I needed the personality to live in data, not code.
## The reaction matrix
Each vibe is a 3×3 table of colour-to-colour affinities. When an agent of colour `i` looks at the trail in front of it, it weights the three channels of that sample by row `i` of the matrix, then uses the sign to pick left, right, or straight. That's it. The whole behaviour rule.
Three examples of what nine numbers can do:
- **Aurora Mycelium:** cyclic, each colour chases the next. Agents wind into ribbons.
- **Velvet Observatory:** every off-diagonal entry negative. Colours repel into separate islands.
- **Paper Lantern Fog:** matrix filled with ones. Colours collapse into one cooperative blob.
Adding a tenth number to the matrix would tax every existing vibe. Tuning the nine I have is a text edit. Six presets in, I haven't extended it.
## The compute work, broken into small jobs
Six stages, ten WGSL files, each one short enough that I can hold it in my head when something breaks:
1. **Agent step:** sample the trail at a sensor offset, pick a turn, move, deposit colour. ~300 lines, the longest one.
2. **Diffusion:** blur and decay so old marks soften. The boring one, and the one you can't skip: without it, strokes stay forever and the garden collapses into noise.
3. **Brush:** write user strokes into both the trail texture and a separate "source" texture the agents can read.
4. **Eraser:** two variants: one clears a region of the trail, the other kills agents in a radius.
5. **Agent generation:** spawn along strokes, resize the buffer when the cap changes, compact after erasure so dead slots don't waste GPU time.
6. **Render:** read the trail, apply palette and grain.
The bind-group setup overhead from running more pipelines was lost in the noise next to the simulation cost. The win was that when the eraser shader started killing the wrong agents, I opened one file and reasoned about it without touching anything else.
## Smaller calls
- **Adaptive cap, circular buffer.** If FPS drops, the cap shrinks; if there's headroom, it grows. When the cap is hit, new agents overwrite older ones. The decay you see, a stroke vanishing thirty seconds after you drew it, isn't an explicit eraser, it's the buffer wrapping around.
- **URL is the share format.** The chosen vibe is in the query string. The "send your friend this preset" link is just a URL with `?vibe=tidepool-lantern` on it. The parser is tolerant about accents and casing because people retype these.
- **One HTML file.** All CSS and JS inline. The piano samples sit beside it. Self-contained enough to email or drop on a USB stick.
## What I'd change
- The intro animation (agents fly in to spell the title, then transition to steady state) couples three shaders through a single `progress: 0 → 1` value. It's the bit I'd least want to refactor today. Next time I'd model the intro as its own dispatch with its own buffer and hand off cleanly.
- Mobile works, but the toolbar fights the canvas for screen and the agent cap has to shrink hard to keep frame time down. A proper fix means rethinking the toolbar and exposing the cap-vs-resolution tradeoff to the user.
- The simulation has invariants that proptest would falsify in minutes: agent count under the cap, every stroke produces a positive-coloured deposit on the next frame, and the eraser doesn't leak agents past its radius. Snapshot tests aren't the right tool here.

View file

@ -1,29 +0,0 @@
---
title: Predicting EUR/USD With Hanning Windows
description: A weekend frequency-domain experiment that did a passable job on EUR/USD. I would not have trusted it with my money, and I didn't.
date: 2026-05-03
projectPeriod: 'Autumn 2019'
thumbnail:
src: ./_assets/forex.jpg
alt: Chart comparing predicted and actual EUR/USD exchange rates.
tags: ['systems', 'tools']
role: Experiment author
stack: ['Python', 'NumPy', 'SciPy', 'Flask', 'MQL4']
outcome: A prediction server, an MQL4 trading client, and a clearer view of how far my edge wasn't
audience: technical
links: []
---
In the autumn of 2019 I was an undergrad with a few weekends free and the quiet conviction that I could find a small edge on EUR/USD. The screenshots were flattering: the prediction (blue) hugged the actual rate (green) in a way that looked like skill. A linear regression in the frequency domain, dressed up. I did not trade real money with it, and that restraint is the only thing about the project that aged well.
The pipeline:
- Smooth the input series.
- Differentiate.
- Short-time Fourier transform with overlapped, Hanning-windowed frames.
- Extrapolate the frequency-domain coefficients.
- Invert everything back to a predicted price series.
A Python server (NumPy, SciPy, Flask) ran the model. An MQL4 client on a broker terminal called the server and would have placed trades if I'd dared.
What I actually learned: even a naive model can show a sometimes-profitable backtest, and that's the trap. The real game is built by people with co-located servers, microsecond ticks, and millions in infrastructure. This project taught me how far my edge wasn't.

View file

@ -1,80 +0,0 @@
---
title: An E-Ink Photo Frame That Sleeps When the House Is Empty
description: A Pi, a 6-colour e-ink panel, and a self-hosted Immich library. Photos picked by date and favourites, gated on Home Assistant presence, Atkinson-dithered.
date: 2026-05-27
projectPeriod: '2026'
thumbnail:
src: ./_assets/frame.jpg
alt: The e-ink frame on the wall showing a dithered landscape scene with the capture age and EXIF location painted into the bottom corners.
tags: ['embedded', 'systems', 'tools']
role: Frame builder and pipeline author
stack:
[
'Python',
'Raspberry Pi Zero 2W',
'Waveshare 7.3" 6-colour panel',
'Immich',
'Home Assistant',
'numba',
'Atkinson dither',
]
scale: One panel, one household, ~64 refreshes a day at peak
outcome: A wall-mounted photo frame that pulls from self-hosted Immich, gated on home presence, with no cloud dependencies
audience: general
links:
- label: Source
url: https://home.schmelczer.dev/git/andras/frame
media:
- type: image
src: ./_assets/frame.jpg
alt: The frame on the wall showing a 6-colour Atkinson-dithered landscape photo, with "2 years ago" and a location label painted into the bottom corners.
caption: The bottom corners carry the photo's age and EXIF location. Painted as text on top, so the dither can't smear them.
---
In 2024, researchers found family-blog photos of Brazilian children inside the LAION training set. Self-hosting your photos used to be a preference; it's a safeguarding decision now. Nixplay's cloud-tied frames have bricked. Funimation deleted libraries people had paid for. I wanted a photo frame on the hallway wall, and I wasn't going to hand the family album to a vendor who could close the doors on it.
So it's a Raspberry Pi Zero 2W driving Waveshare's [PhotoPainter](https://www.waveshare.com/wiki/PhotoPainter) panel, pulling from my self-hosted [Immich](https://immich.app/) library, part of the same [self-hosting setup I back up with btrfs and borg](/articles/backup-container-btrfs-borg/). A few hundred lines of stdlib Python on top of the reference driver.
## Why a stupid amount of engineering for a picture on a wall
That's the point. Albert Borgmann once distinguished _devices_ (which efficiently deliver a commodity and disappear into the wall) from _focal things_, which gather a practice around them. A Nest Hub is a device; it shows you photos the way a microwave delivers heat. The frame is a focal thing. I curated the weights. I hung it where the light was right. I tweak it when something feels off. It doesn't sell my attention back to me; it asks me to pay some.
The medium helps. E-ink doesn't glow and doesn't beep. From across the room it reads as _image_, not as _screen_, and that one perceptual difference changes how often I actually look at it.
## The presence gate
The cron line does most of the work. Every 15 minutes, the script checks the time of day, then asks Home Assistant whether anyone in `HA_PRESENCE` is home. If not, it quits. The panel keeps showing the last photo, because e-ink, so you walk in to whatever was there when the house emptied.
The point isn't power saving. John Berger drew a line between photographs kept inside a context of lived meaning (private), and ones severed and circulated (public). Google Photos hands you the public mode dressed as the private. A wall in the hallway, lit only when your people are home, restores the context. The same photograph means something different surfacing while you're cooking dinner than it does in a feed at 11pm.
## How a photo gets picked
The pool is biased the way memory is biased: four buckets, weighted ~30% "on this day" (dropping to ~10% if only the ±3-day fallback fires), ~18% favourites, ~36% the last 30 days, ~36% everything else. Within those buckets, orientation-match against the current frame gets 4x the weight of mismatch, because cropping landscape to portrait works less often than the reverse.
A 7-day rolling history filters repeats. Before accepting a candidate, the picker runs `heads_fit_in_crop` against Immich's detected face boxes, extended upward to cover the skull and padded by `HEAD_SAFETY_MARGIN`: if the planned crop would slice into any visible head, that candidate is rejected and another is drawn. A wall photo with half a face in it is worse than the same photo not on the wall at all.
`face_aware_crop` does the actual cropping: resize-cropping to fill the frame while biasing the window around detected faces. A landscape shot with room around the subject usually crops cleanly to portrait this way; the guardrail above catches the ones that don't.
## Tuning the pipeline somewhere else
Iterating on the Pi means waiting 12+ seconds per refresh. Both the face-aware crop and the dither were tuned in Jupyter against a local pool of a few hundred photos, then frozen and shipped.
The dither is where the choice visibly matters. The panel can only show black, white, red, yellow, blue, green; no intensity control, every pixel is one of those six. I compared Floyd-Steinberg, Stucki, and a couple of ordered variants. Atkinson kept the highest perceived contrast on the 6-colour palette without smearing skin tones into the nearest yellow. Pure-Python Atkinson on the Pi Zero was unusably slow, so the inner loop runs through `numba` with perceptual-weighted nearest-colour matching (0.299/0.587/0.114). Roughly 100x faster after the JIT cache warms.
## The weekend-reimplementable rule
Hundred Rabbits, a couple who live offshore on a sailboat doing permacomputing in practice, hold themselves to a rule: any system they depend on should be reimplementable in a weekend. The frame meets the bar. A few hundred lines of stdlib Python on a documented panel, reading from an HTTP endpoint that returns JPEGs. It came together over an afternoon with Claude Code plus a couple of weekends tuning the picker and the dither; the repo is public partly as a reference for anyone wanting to do something similar. If Immich disappears tomorrow the selection logic is eighty lines I can repoint at whatever replaces it.
## Smaller calls
- **Capture age and EXIF location painted as text.** White on a black stroke, written _after_ dithering, so the labels stay sharp on the 6-colour palette.
- **Swap masked, journald volatile.** The SD card is the most likely thing to die on this build. Don't write to it unless you have to.
- **Wifi power-save reconnect job.** The Pi Zero 2W's wifi drops if power-save kicks in. A separate `wifi-check.sh` every five minutes brings it back.
## What I'd change
- **Lower-power hardware.** The Pi Zero 2W is overkill and idles 14 minutes out of every 15. The Waveshare board didn't have an RTC interrupt pin soldered, and rather than hack one in, I'd reach for an ESP32 next time. Deep sleep has plenty of time to do the image work inside a 15-minute window.
- **A bigger panel and a small light.** The [Inky Impression](https://shop.pimoroni.com/products/inky-impression) 13" with a custom frame and integrated lighting would help most in the evenings, when the e-ink reads muddled under warm lamps.
- **A daytime cadence curve.** 15 minutes is constant. It should slow at night and speed up around the times we're actually in the hallway.
The frame is small, slow, and almost entirely silent. It does one thing for one household and doesn't tell anyone about it. The smallness is the point. There should be more of this kind of thing.

View file

@ -1,19 +0,0 @@
---
title: A JavaFX Editor for the Cooling Simulator
description: Companion editor for the cooling-system sim. Drag-and-drop graph layout, JSON export, upload-to-backend. Small tool, mattered more than I expected.
date: 2026-04-25
projectPeriod: 'October-November 2018'
thumbnail:
src: ./_assets/process-simulator-input.jpg
alt: JavaFX graph editor for the cooling system simulator.
tags: ['simulation', 'tools']
role: Editor author
stack: ['JavaFX', 'JSON', 'REST API']
outcome: A drag-and-drop graph editor that let non-developers feed the simulator
audience: technical
links: []
---
Non-technical event organisers needed to rewire a cooling plant in real time without me hovering. That was the brief, and it ruled out every interface I'd have enjoyed writing. The [cooling system sim](/articles/nuclear-cooling-simulation/) was only as useful as the tool that fed it, so in late 2018 I built a JavaFX desktop editor: lay out the plant as a graph, edit each element's parameters in a side panel, export JSON, or upload straight to the backend.
Small tool, and the whole event hinged on it. If I built it again I'd skip JavaFX and put the editor in the browser next to the monitoring clients. One install fewer for everyone, and one fewer reason for someone to call me over.

View file

@ -1,53 +0,0 @@
---
title: A Python Framework Where Doing the Right Thing Is the Default
description: My MSc thesis. 33 catalogued ML deployment habits, a decorator-shaped Python API, and a survey of working engineers on which actually got adopted.
date: 2026-05-09
projectPeriod: '2022'
thumbnail:
src: ./_assets/great-ai.png
alt: Example Python code using the GreatAI API.
tags: ['ai', 'systems', 'tools']
featuredOrder: 1
role: Researcher and framework author
stack: ['Python', 'decorators', 'FastAPI', 'survey design']
scale: 33 deployment habits surveyed, 6 proposed additions, framework evaluated by working data scientists and engineers
outcome: A pip-installable framework, an MSc thesis, and one strong opinion about API surface area
audience: recruiter-relevant
links:
- label: PyPI
url: https://pypi.org/project/great-ai/
- label: Project site
url: https://great-ai.scoutinscience.com
- label: MSc thesis
url: /media/downloads/great-ai-andras-schmelczer.pdf
download: true
media:
- type: image
src: ./_assets/great-ai.png
alt: Example Python code using GreatAI decorators and prediction helpers.
caption: A working GreatAI service is about ten lines on top of a plain prediction function.
---
By the end of 2021 I had stopped believing the people skipping ML deployment best practices were the problem. They knew the list. They agreed with the list. They had a deadline, and every item on the list cost five lines of glue. My MSc thesis turned that into the actual research question: not "what should engineers do" but "what API shape makes doing the right thing cheaper than not." The framework that fell out, `great-ai`, is a decorator on a plain Python function. The thesis behind it is the part worth reading.
## The thing nobody wants to admit
The literature has a long list of habits you should adopt when shipping an ML service: track inputs, version models, expose health, log decisions, keep predictions reproducible. Everyone agrees with the list. Almost nobody implements all of it.
I spent the bulk of the thesis catalogueing 33 such habits, proposing 6 more, and surveying engineers on which actually got applied in their day jobs. The data was pretty clear about the failure mode: it wasn't ignorance, it wasn't laziness, it wasn't budget. It was that the cost of doing the right thing, five lines of glue per habit multiplied across a stack, was higher than the visible cost of skipping it. So skipping it became the default.
So the real research question wasn't "what should engineers do." It was "what API shape makes doing the right thing cheaper than not."
## The framework's bet
- **A decorator on a plain function.** `@GreatAI.create` turns a regular Python function into a deployed service with metadata, request tracing, and a versioned interface. No inheritance, no project layout, no enforced directory structure. The mental cost is one import.
- **Implicit behaviour only for cross-cutting concerns.** Logging, versioning, metadata are implicit. Anything touching business logic stays explicit. The rule: if it would surprise me when I'm debugging, it shouldn't be implicit.
- **Own the contract, leave the storage alone.** Where you persist logs, models, or metrics is your choice; GreatAI defines the shape and provides defaults. The model registry stays somebody else's library.
The survey backed up the central premise: ease of use and functionality both matter for adoption, and they're independent axes. A framework that ticks every box and is awkward will lose to a smaller one that doesn't.
## What I'd change
- I'd narrow further. Anything GreatAI did that overlapped with MLflow, BentoML, or modern observability stacks would go. The durable bit was always the decorator and the catalogue behind it.
- I'd publish the survey instrument separately. The 33-habit catalogue and the adoption-vs-impact methodology outlive the framework. People still ask about that part.
- I'd stop calling them "best practices." I used that phrase in the thesis and it aged into corporate-speak. The honest name is "things that hurt later if you skip them."

View file

@ -1,58 +0,0 @@
---
title: Syncing State with an Immutable Trie
description: 'A visual goal tracker whose lasting idea was the sync model: an immutable trie so structural diffs are trivial and only deltas cross the wire.'
date: 2026-05-05
projectPeriod: 'August-September 2019'
thumbnail:
src: ./_assets/towers.jpg
alt: Life Towers goal tracking interface with tower-like visual structures.
tags: ['systems', 'web', 'tools']
featuredOrder: 4
role: Full-stack author
stack: ['Python', 'Angular', 'TypeScript', 'Custom sync protocol']
scale: Multi-device goal and task state shared between clients and a server
outcome: A working sync protocol where structural sharing made the delta tiny
audience: recruiter-relevant
links:
- label: Source
url: https://github.com/schmelczer/life-towers/
media:
- type: image
src: ./_assets/towers.jpg
alt: Screenshot of a life tracking web interface represented with tower-like visual structures.
caption: The interface was a 2019 weekend experiment. The trie underneath aged better.
---
In August 2019 I wanted a goal tracker I'd actually open, on whichever device was nearest, without watching it disagree with itself. Nothing off the shelf fit, so I built one over a couple of weekends. The tower metaphor was the part friends saw; the part that aged well was the sync model that fell out of needing the same state in three places at once.
## The problem in one paragraph
Pick any non-trivial mutable object graph, sync it across devices, and you end up either sending the whole thing on every change (wasteful) or writing ad-hoc diff logic per shape (brittle). I wanted a representation where the _shape_ of the data made the diff fall out for free.
## The trie, concretely
A goal in Life Towers is a path of strings. `Health / Running / 5k`. Tasks under a goal hang off the leaf. A user's whole state is a tree, and a trie is exactly the data structure that makes that tree's _identity_ manipulable.
Two properties did the heavy lifting:
- **Structural sharing.** When you tick off a task under `Health / Running / 5k`, the new root reuses every untouched subtree by reference. The `Career` branch and the `Reading` branch are the same objects they were before. Comparing the old and new roots is mostly pointer equality; only the path that actually changed gets walked.
- **Immutability.** Updates produce new structure instead of mutating. "Where I was" and "where I am" become two pointers, not two snapshots. The diff between them is whatever's not shared, and that walk is O(changes), not O(state).
The sync loop falls out:
1. Client holds the last root the server acknowledged plus its own current root.
2. To send: walk only the unshared paths, emit one op per changed leaf. In practice that's a handful of bytes for a typical edit, no matter how large the rest of the tree is.
3. Server applies, returns its new root.
4. Client rebases any in-flight edits by replaying them on top.
There's no conflict resolution layer because the operations commute on the structure. Two clients adding tasks under different branches produce non-overlapping deltas that compose trivially. The hard cases (two clients editing the same leaf) are tiny and obvious, because they're the _only_ place the deltas touch the same path.
## What I'd change
- **Property tests around the rebase.** The reconcile path is exactly where a generator finds bugs that hand-written tests never think to write. I had hand-written cases; I'd start with `proptest` now.
- **A standalone spec for the wire format.** The part worth lifting out was the protocol, not the goal tracker. A short spec would let me (or anyone) reimplement it in a different stack without re-deriving everything from the Python source.
- **Strip the visual experiment.** The tower visualisation was fun but it bound the storage to a UI metaphor. The sync model should be a library; the towers should be a separate toy.
## If you take one idea from this
Most sync problems are diff problems pretending to be transport problems. Pick the data structure that makes the diff free, and the protocol almost writes itself. The corollary: if you're writing a lot of "if this changed, send that" code, you're using the wrong structure.

View file

@ -1,23 +0,0 @@
---
title: 'My First Real Project: LEDs Driven by an FFT'
description: A Raspberry Pi music player that drove RGB strips through MOSFETs. The first thing I started and actually finished.
date: 2026-04-26
projectPeriod: 'Spring 2016'
thumbnail:
src: ./_assets/leds.jpg
alt: RGB LED strips lit by a music synchronisation project.
tags: ['systems', 'tools']
role: Hardware and software author
stack: ['Python', 'NumPy', 'FFT', 'Raspberry Pi', 'MOSFETs', 'vanilla web']
outcome: The first non-trivial project I started and finished
audience: technical
links: []
---
Spring 2016. I had a Raspberry Pi, a couple of 12V RGB LED strips someone had given me, a handful of MOSFETs from an electronics kit, and zero idea what I was doing. I wired one of the MOSFETs backwards and it got hot enough to leave a small mark on the breadboard. I learned to read a datasheet, slowly, by needing one. This was the first thing I started and actually finished.
The plan was something like: play music, look at it, make the lights match. I got bands wrong first. Mapping raw audio amplitude to brightness made the lights pulse with anything (clipping, voice, fan noise), a strobing mess that hurt to look at. Reading about Fourier transforms long enough to type `numpy.fft.fft(audio_chunk)` into a REPL was the moment the project started actually behaving like the thing I'd imagined. Bass-heavy frequency bins went to red; mids to green; highs to blue. Smoothing the output over a few frames stopped the seizure-inducing flicker.
The frontend was a vanilla web page on the same Pi: pick a track, tweak the band thresholds, see what changed. No framework. Just a `<select>`, a few sliders, and an `XMLHttpRequest`. It worked.
It's not impressive in 2026. The thing I actually keep from it isn't the FFT or the MOSFETs; it's the discovery that I'd rather have a finished janky thing than an elegant unfinished one. Most of the projects on this site are downstream of that discovery; [the ATtiny85 handheld](/articles/ad-astra-attiny85-game-engine/) four years later is the same instinct with the soldering iron held steadier. I'd still recommend the same path to anyone learning: pick something physical, plug things together until they work, accept that the first version will be ugly.

View file

@ -1,21 +0,0 @@
---
title: 'My Notes: A Markdown App for Android'
description: A small Android note app built on Markwon. The idea wasn't new; the point was learning a platform that wasn't the web.
date: 2026-05-02
projectPeriod: 'November 2019'
thumbnail:
src: ./_assets/my-notes.png
alt: Screenshots of the My Notes Android app.
tags: ['tools']
role: Android app author
stack: ['Android', 'Markdown', 'Markwon']
outcome: A working notes app and my first time outside the web stack
audience: technical
links:
- label: Source
url: https://github.com/schmelczer/my-notes
---
In November 2019 I wrote my own notes app for Android, used it daily for a while, and then it lost a long battle with Obsidian. The loss was the lesson: I learned what I actually wanted from a notes app by watching mine fail to be it. Years later that same itch is why I wrote [reconcile-text](/articles/reconcile-text-3-way-merge/); by then I was editing the same notes in Vim, VS Code, and Obsidian, and nothing existed to merge three independently-edited copies back into one.
The app itself was small: Markdown notes, hashtag filtering, Markwon for rendering. Every developer writes their own notes app eventually and the bar for shipping one isn't high. What I actually wanted was a few weeks outside the web stack, somewhere with different conventions about lifecycle, storage, and resource constraints. Android delivered that. I'd still recommend "write a small thing on a new platform" as a way to recalibrate what you take for granted.

View file

@ -1,58 +0,0 @@
---
title: 'Two Graphs Are Simpler Than One: A Cooling System Simulator'
description: Live cooling-system sim for a PLC cybersecurity event. Splitting flow and heat into two graph passes kept it cheap and the behaviour believable.
date: 2026-05-04
projectPeriod: 'October-November 2018'
thumbnail:
src: ./_assets/process-simulator.jpg
alt: Cooling system simulator interface with pipes, pumps, and temperature values.
tags: ['simulation', 'systems', 'tools']
featuredOrder: 5
role: Simulation and UI author
stack: ['Python', 'Flask', 'NumPy', 'HTML canvas', 'JavaFX']
scale: One remote sim server, many monitoring clients, separate JavaFX graph editor
outcome: A believable PLC simulation usable by non-specialists during a live cybersecurity challenge
audience: recruiter-relevant
links: []
media:
- type: image
src: ./_assets/process-simulator.jpg
alt: Screenshot of the cooling system simulator with pipes, pumps, coolers, and temperature values.
caption: Flow ran first as a graph traversal, then heat solved as a matrix equation.
- type: image
src: ./_assets/process-simulator-input.jpg
alt: Screenshot of the JavaFX graph editor used to define simulator input.
caption: The JavaFX editor produced JSON that the simulator ate as input.
---
Trying to solve flow and heat as a coupled system would have been a real CFD problem and I had two weeks. A cybersecurity event in late 2018 needed a cooling-system simulator that contestants could poke at through PLCs over a weekend, and the deadline shaped every decision after it: cheap to compute, plausible to a non-specialist, runs all weekend on one server. The useful design move was modelling flow and heat as **two separate graph passes**, not one combined PDE.
## What the event needed
The challenge was about PLCs. Contestants would change setpoints, valves, or pump speeds, and we needed them to see whether their action made the plant stable, wasted coolant, or melted something. That meant:
- Multiple monitoring clients had to update from one simulation server in near real time.
- The system had to be configurable enough that the event organisers could ship me a new plant on Friday night and have it running Saturday morning.
- It had to be obvious. A simulator nobody understands isn't a teaching tool, it's noise.
## The split that made it cheap
Instead of the coupled solver:
1. **Flow first, as graph traversal.** Walk the pipe graph from the pumps, accumulate pressure, distribute water to nodes.
2. **Heat second, as a linear system.** Build the adjacency matrix from the flow result, add boundary conditions (heaters, exchangers, base temperatures), solve for node temperatures with NumPy.
3. Repeat both passes per tick.
This is wrong as physics. It's right as a model. Flow doesn't react to instantaneous heat in any way contestants could perceive, and the cost of solving them separately was a tiny fraction of solving them together. The clean phase boundary also meant when "the heat is weird," I knew exactly which pass to look at.
## Why the editor mattered
The simulator's most-used UI was the _input_ editor, a separate JavaFX tool where you laid out the plant, set parameters per element, and exported JSON the sim ate. I wrote up the editor's [own story here](/articles/graph-editor-javafx-simulation-input/), because in hindsight it deserved to be its own project.
The lesson: a simulation is only as useful as its input pipeline. If editing the plant requires editing source, organisers won't use it.
## What I'd change
- **State what the model claims.** A convincing sim needs an honest README about what it does and doesn't model. Mine didn't. Anyone who took the numbers seriously could have walked away believing more than the model deserved.
- **Recorded scenarios as regression tests.** Sim projects drift in ways that look plausible on screen. Storing "this input over 60 seconds produces these outputs" would have caught me when I broke the temperature solver on Saturday morning at the event.
- **Skip JavaFX.** Cross-platform packaging was painful and the desktop dependency made the editor harder to hand off than it should have been. A web-based editor in the same browser the monitors used would have meant one fewer install for the organisers.

View file

@ -1,122 +0,0 @@
---
title: 25 Million UK Property Rows in a Single Rust Process
description: Notes on perfect-postcode.co.uk. Every numeric feature is u16-quantised in a row-major array, so filter eval is two integer compares per row.
date: 2026-05-28
projectPeriod: '2026'
thumbnail:
src: ./_assets/perfect-postcode.jpg
alt: The Perfect Postcode dashboard with active filters on property type, price, transit time, and crime, showing a Manchester map with matching properties highlighted as a heatmap.
tags: ['systems', 'web', 'tools']
role: Server architect and operator
stack:
[
'Rust',
'Axum',
'Polars',
'h3o',
'rayon',
'PocketBase',
'PMTiles',
'MapLibre',
'deck.gl',
'Conveyal R5',
'Gemini',
]
scale: ~25M historical properties, ~2.5M postcodes, ~150 numeric features per row, all in RAM on a single VM
outcome: A single-binary UK property-intelligence service with sub-100ms hexagon aggregations under filter
audience: technical
links:
- label: Site
url: https://perfect-postcode.co.uk
media:
- type: image
src: ./_assets/perfect-postcode.jpg
alt: A Perfect Postcode dashboard view of Manchester with five active filters (property type, price, public-transport time to Manchester city centre, crime, noise) and a hex heatmap of 1,247 matching properties.
caption: A normal user pan triggers a hexagon aggregation under filter. The hot path holds itself to two u16 compares per row.
---
A user told me the map felt sluggish when they dragged it across Manchester with four filters on. They were right. The previous version round-tripped to a database, decoded floats, and lost the budget for a single pan inside the first filter. The rewrite is one Rust binary that holds the entire UK property history in RAM and treats every filter as three integer compares. Everything else in this post is the consequence of refusing to break that latency again.
## The constraint that shapes everything
The answer to _"what's the median price in this hexagon, filtered to four-bedroom terraces under £450k with a 35-minute transit to Manchester"_ needs to come back inside a single map pan. Per visible cell, per request, every time the user moves anything. That's the work.
At the resolution we want, the inputs are roughly 25M historical transactions, each with around 150 numeric features (price, EPC, deprivation deciles, school catchment metrics, POI proximities, noise, crime, …). Naively f32 per cell, that's ~15 GB before you count anything else: postcodes, POIs, places, tiles, travel times. The rest of the architecture is the consequence of insisting it all lives in one process on one rentable box.
## u16 quantisation in a row-major flat array
Every numeric feature is encoded as `((value - feature_min) / feature_range) * 65534`. Dequant is `raw * dequant_a + quant_min`. `u16::MAX` is reserved as `NAN_U16` (the explicit missing-value sentinel), so the live range is 65534, not 65535. Per feature we keep a `(min, scale, p1, p99)` tuple and a 100-bucket histogram for the UI sliders.
Storage is a single `Vec<u16>` laid out row-major: `feature_data[row * num_features + feat_idx]`. Sixteen features fit in one 64-byte cache line; a row scan stays in L1 for several rows at a time. With 25M rows × ~150 features × 2 bytes, the property matrix is around 7.5 GB, comfortably inside a 16 GB instance once the rest of the data joins it.
The precision loss is real but bounded: 0.010.1% per feature on the data we have, below the noise floor of any downstream statistic. The win is that the hot loop never touches an `f32`.
## The hot loop is three integer compares
`ParsedFilter` carries `min_u16` and `max_u16`: the user's bounds requantised against the same per-feature `(min, scale)` at parse time. The row test is literal:
```rust
let raw = feature_data[base + filter.feat_idx];
raw != NAN_U16 && raw >= filter.min_u16 && raw <= filter.max_u16
```
No string keys. No `f32` decoding. Enum features go through a pre-built `FxHashSet<u16>` of allowed raw values, same shape.
Two small parse-time choices made this fast in practice:
- **Sort filters by selectivity.** `numeric.sort_unstable_by_key(|f| f.max_u16.saturating_sub(f.min_u16))` puts the narrowest ranges first. A 50-filter request usually short-circuits on filter two or three.
- **Reject inverted ranges at parse time.** `min > max` errors out, so `saturating_sub` can't wrap a huge u16 into the sort key and silently reorder things.
## Spatial: a CSR grid plus precomputed H3
Two indexes, used for different things.
A 0.01° (~1 km) regular grid in CSR layout (a single flat `values: Vec<u32>` of row indices and an `offsets: Vec<u32>` of per-cell starts) answers bbox queries. CSR avoids the 24-byte-per-cell `Vec` header you'd pay with `Vec<Vec<u32>>`, which is the difference between a few MB and a few hundred MB at UK scale. `for_each_in_bounds` is the variant that skips the result allocation; aggregators stream into it directly.
An H3 cell at resolution 12 is precomputed per property at boot, stored as `Vec<u64>`. Lower-resolution cells are derived via `CellIndex::parent()`; fast and exact. The hexagon endpoint thresholds at `PARALLEL_THRESHOLD = 50_000`: below, plain serial aggregation; above, `rayon::par_chunks()` with `chunk = max(1000, rows / num_threads)`. Below the threshold, rayon's per-chunk overhead dominates the work it's parallelising; it's worse than the obvious thing. Above, the slope flips.
A small per-thread `FxHashMap<u64, u64>` H3 cache inside each rayon chunk takes care of properties touched by multiple aggregations within the same chunk.
## State is an Arc-clone away
`AppState` is large and immutable after the boot-time loads. `SharedState = RwLock<Arc<AppState>>` wraps it; every handler does `shared.load_state()`: a brief read lock, an `Arc::clone`, no further lock contention for the request.
The standard read-mostly pattern, but worth naming for one reason: it makes hot-reloading the parquet trivial later. Build a new `AppState` from disk, take the write lock, swap the `Arc`, drop the old one when the last in-flight request finishes. None of the handlers need to change.
On top of that there's a per-endpoint `ConcurrencyLimitLayer::new(N)`. The expensive endpoints (filter-counts, hexagon-stats, screenshot, export) get 35; the cheap ones get 2030. It is the simplest backpressure you can write and it does most of the work.
## PocketBase as the distributed lock
For mutations that need exclusion (subscription state transitions, redeem-invite races), there is no Redis. Instead, `acquire_pocketbase_lock` does an optimistic create against a `locks` collection. If create succeeds, we own it; if it fails on conflict, we fetch the existing lock, check `expires_at_unix`, and if it's expired we delete and retry. Owner ID is a 24-char random string so stale-lock detection doesn't rely on host identity or wall-clock skew.
Release is a `Drop` handler that spawns a tokio task to delete the record; async cleanup keeps the synchronous drop path free of I/O. 100 ms retry, 10-second acquire deadline. Coarse, but correct, audit-loggable in PocketBase, and adds zero new infrastructure to operate.
## Cost-capping the LLM endpoint
The AI filter parser is a Gemini call. Two structural choices made it cheap enough to leave on:
- **One system prompt, computed once.** `build_system_prompt(features, mode_destinations)` runs at boot. The feature catalogue, the enum of available travel modes, the few-shot examples: all concatenated once into a `String` on `AppState`. Every request reuses the same bytes, which Gemini's input cache likes.
- **A `search_destinations` tool with a closed enum of modes.** The LLM doesn't get to invent place slugs. It can call the function; the server slugifies and resolves against the loaded travel-time directory using a word-overlap matcher tolerant of `kings-cross` vs `King's Cross`.
On top: a per-week token budget (`AI_FILTERS_WEEKLY_TOKEN_LIMIT = 10_000_000`) and a 2,000-token output cap. The budget is the actual cost guarantee; the per-call cap is belt-and-braces.
## Smaller calls
- **`mlockall(MCL_CURRENT | MCL_FUTURE)` at startup.** The hot dataset has to never page out. With `CAP_IPC_LOCK` it works; without it we log and continue.
- **`malloc_trim(0)` after each big load.** Polars leaves a high allocator water-mark after parquet scans. Trimming after each major load gives back hundreds of MB of RSS before steady state.
- **Prometheus path normalisation.** `/api/tiles/5/16/10` becomes `/api/tiles/:z/:x/:y` before it becomes a label. Otherwise `/.env`, `/wp-admin/...`, and bot scans explode cardinality.
- **Median-half eviction over LRU.** Token, share-bounds, and superuser-token caches evict the older half on overflow instead of one entry at a time. Cheap, and it spreads the re-validation cost instead of triggering a thundering herd.
- **`spawn_blocking` for Polars I/O.** Parquet scans are CPU-bound. They block the tokio executor if you let them; they don't if you don't.
- **`Box<[T]>` instead of `Vec<T>` for aggregator accumulators.** No `capacity` field, 8 bytes saved per slot. At hundreds of hexagons × six features per request it adds up.
- **String interning, three times.** Postcodes (~2.5M unique from 25M rows) live in a `lasso::RodeoReader`; each row stores a `Spur` (~4 bytes). Address tokens are flattened into one buffer with per-row `(offset, length)` arrays. The same pattern for enum value strings.
- **Free-zone bbox check, not point check.** Unlicensed queries must have their _entire_ bbox inside `FREE_ZONE_BOUNDS`. Point-in-zone would be convenient and wrong; it would let users pan to anywhere from a free-zone centre.
- **Share-link bounds are server-computed.** `bounds_from_view(lat, lon, zoom)` derives the bbox from a UK-aware longitude/latitude span (`half_lat = half_lon * 0.6`) and clamps it. Legacy short URLs without server-stored bounds grant nothing.
## What I'd change
- **Pin the allocator.** I rely on `malloc_trim` to keep RSS predictable. A jemalloc with explicit purge would behave better than glibc plus periodic trimming, especially under sustained load.
- **One bench for the hot loop.** I trust the structure but I have no number for _filter throughput per row per filter under typical load_. That number would tell me when the u16 trick stops being enough.
- **Move free-zone bounds to PocketBase.** `FREE_ZONE_BOUNDS` is a `const`. It's been right for the demo region for a year. The next time it changes I'll regret hardcoding it.
- **A typed query DSL instead of `;;`-separated strings.** The current filter wire format is `name:min:max;;name:val1|val2`. Cheap to parse, awful to evolve. A small JSON envelope would survive the next feature.
There's something a little embarrassing about a binary that just memory-maps a country. But the architecture made the latencies trivial, and the latencies are most of what a user feels.

View file

@ -1,21 +0,0 @@
---
title: A Colour Grader Where Distance Was the Whole Idea
description: Pick a colour, transform every nearby colour as a function of distance. A proof-of-concept grader I built to try one interaction idea.
date: 2026-04-30
projectPeriod: 'June 2018'
thumbnail:
src: ./_assets/photo-colour-grader.jpg
alt: Colour grading interface with tonal controls and an edited preview.
tags: ['graphics', 'web', 'tools']
role: Interface and image processing author
stack: ['JavaScript', 'Canvas', 'Image processing']
outcome: A working proof-of-concept grader and an interaction model I'd still defend
audience: technical
links: []
---
In June 2018 I got tired of every grader I tried making me think in masks. I wanted to point at "this orange" in a photo from one of my [walks](/articles/photo-site-generator/), nudge it, and have the neighbouring reds and yellows come along by however much made sense. Distance in colour space, not a brush. So I built the proof.
The UI was a colour wheel where you'd click to drop a marker, drag to move it, click anywhere to add another. Each marker had its own settings; transformations fell off smoothly with distance from the picked colour. No masks, ever.
I never built it into a real tool. The idea still feels right: distance in colour space is the natural unit for prose-style editing of an image. If I returned to it, I'd reach for WebGL instead of canvas. The interaction only earns its keep if the preview is live on a real photo, and canvas couldn't get there.

View file

@ -1,21 +0,0 @@
---
title: A Photo Site That Generated Itself From a Folder
description: A Webpack script that turns a folder of photos into a static site with responsive image variants. Mostly here as an excuse to talk about walks.
date: 2026-04-27
projectPeriod: 'Summer 2016'
thumbnail:
src: ./_assets/photos.jpg
alt: Screenshot of a generated photography site.
tags: ['web', 'tools']
role: Site generator author
stack: ['Webpack', 'Image processing', 'Static site generation']
outcome: A photography site that updated itself when I dropped new images into a folder
audience: general
links: []
---
I take walks with a camera. Most of what I shoot isn't good, but the act of walking slowly with a frame to think about is the most reliable way I know to come back with an idea for whatever I'm working on. In the summer of 2016 I wanted somewhere to put the few frames that survived, and I wasn't going to maintain a CMS for it.
So a Webpack script: point it at a directory of full-size photos, get a static site with responsive variants per image. Drop in a new photo, run the build, deploy. The pipeline mattered less than making the habit visible. The same habit later produced a [colour grader](/articles/photo-colour-grader/) for the same shots.
If I rebuilt it today I'd use Astro, which is what this site runs on.

View file

@ -1,22 +0,0 @@
---
title: A 3D Voxel Game in C, Built While Learning Pointers
description: My Basics of Programming project. 3D platformer in C with SDL 1.2, destructible terrain, time-slowdown powerups, and a great many segmentation faults.
date: 2026-04-28
projectPeriod: 'Autumn 2017'
thumbnail:
src: ./_assets/platform-game.jpg
alt: Screenshot from a 3D platform game written in C.
tags: ['games', 'systems']
role: Game author
stack: ['C', 'SDL 1.2', 'Voxel terrain']
outcome: A playable course project, and the moment programming clicked
audience: technical
---
Autumn 2017, Basics of Programming, a deadline that forced me to learn C the hard way. I'd write almost none of it the same way today, and I'd defend every choice in it anyway. A 3D voxel platformer in pure C with SDL 1.2. No engine, no scripting layer.
Maps were randomly generated and destructible voxel by voxel, so the player could dig their way out of trouble or wall off flying enemies that merged into larger ones as they got closer. Powerups let you shoot, or slow down time at the cost of points.
What I actually learned was pointers, painfully, through an adequate number of segfaults. The course was meant to teach the basics of programming; for me it was the moment programming stopped feeling like a list of facts and started feeling like a thing I could build with. The next time I reached for C it was on hardware that punished waste; see [Ad Astra](/articles/ad-astra-attiny85-game-engine/).
First-project privilege.

View file

@ -1,67 +0,0 @@
---
title: A 3-Way Text Merger That Never Shows Conflict Markers
description: reconcile-text merges Markdown notes from three editors I don't control, with no history. Why git, CRDTs, and diff-match-patch each failed me.
date: 2026-05-21
projectPeriod: '2025'
thumbnail:
src: ./_assets/reconcile.png
alt: The reconcile-text logo and tagline "Conflict-free 3-way text merging".
tags: ['systems', 'tools', 'web']
featuredOrder: 2
role: Library author
stack: ['Rust', 'WebAssembly', 'Python', 'pyo3', 'wasm-bindgen']
scale: One Rust core, three published packages (crates.io, npm, PyPI), driving an Obsidian sync plugin
outcome: A small Rust library that auto-resolves prose conflicts, with WASM and Python bindings
audience: recruiter-relevant
links:
- label: Demo
url: /reconcile/
- label: Source
url: https://github.com/schmelczer/reconcile
- label: crates.io
url: https://crates.io/crates/reconcile-text
- label: npm
url: https://www.npmjs.com/package/reconcile-text
- label: PyPI
url: https://pypi.org/project/reconcile-text/
media:
- type: image
src: ./_assets/reconcile.png
alt: The reconcile-text logo, a stylised merge arrow, with the tagline "Conflict-free 3-way text merging".
caption: reconcile-text weaves conflicting edits together instead of asking a human to choose.
---
## Why I wrote it
I keep Markdown notes in three editors I don't control the internals of: Vim on my laptop, VS Code on my work machine, Obsidian on my phone. When two of them edit the same note between syncs, I have three files: the last-synced parent and two divergent children. That's the input. I want one merged file out, and I want to hand it back to the editors without conflict markers, because `<<<<<<< HEAD` is not something a notes app should ever show me.
Every existing tool got close and missed:
- `git merge-file` does exactly the right thing structurally, then writes markers into the output. That's correct for source code and wrong for prose.
- CRDTs and OT both assume you own the editing pipeline down to the keystroke. I don't. I'm looking at three files.
- `diff-match-patch` doesn't take a common ancestor. On adjacent edits it quietly produces wrong output. I have a runnable example in the repo.
So the library does exactly one thing: pure function from three strings to one. No async, no networking, no concurrency, no plugins. Anything outside that boundary is somebody else's library.
## The decisions worth naming
**Myers diff per side, then weave the diffs.** Each child is diffed against the parent, the two edit scripts are optimised so adjacent changes group cleanly, then a single weaving pass interleaves them into one ordered op sequence that produces the merged text. The weave borrows the shape of operational transformation, but the inputs are batched complete diffs, not live keystrokes, so it only runs once per merge.
**Tokeniser is the user knob.** This is the choice I'd defend hardest. Most of what people want when they say "merge differently" isn't a new algorithm; it's a different unit. Word-level tokenisation turns most "conflicts" in prose into two adjacent edits that coexist. Line-level makes it behave like `git merge-file`. Markdown-level merges on headings and list items. Same engine, four different products depending on what you call a token.
**Cursors are first-class merge inputs.** Each cursor has a stable ID and rides through the merge so a collaborative editor can ask "where did this cursor go?" without reconstructing it from the output text. This is the bit that made it useful to anything that wasn't just [the Obsidian sync plugin I wrote alongside it](/articles/vault-link-obsidian-sync/).
**The Rust core is generic; the FFI surface is not.** Inside Rust, the tokeniser is a `dyn Fn(&str) -> Vec<Token<T>>`. That dies the moment you try to pass it through wasm-bindgen or pyo3. The fix was a closed enum of built-in tokenisers for non-Rust callers, with the generic version reserved for Rust users. Not elegant, but the alternative was per-binding glue forever.
**WASM size mattered enough to tune for it.** The release profile is aggressive about size, and the JS package ships a small leak detector that warns if you forget to free wasm-bindgen objects. I lost an afternoon to that the first time and didn't want anyone else to.
## What's held up, what I'd change
- **Kept:** the never-emits-markers, never-drops-edits guarantee. It's the only reason a sync engine can call this library without an escape hatch.
- **Kept:** the comparison example against `diff-match-patch`. It's a runnable program in the repo showing exact inputs where the alternative is wrong. Way more convincing than a benchmark table.
- **Cut:** the snapshot tests do well on regressions and badly on unknown edge cases. Three-way merging is exactly what proptest was made for, and I should have written generators on day one.
- **Next:** I want to be more explicit about the boundary. reconcile-text is a merge primitive, not a live collab engine. If you have a keystroke stream and a real-time channel, use Yjs or Automerge. This library is for when you don't.
## If you take one idea from this
Prose deserves a merger that prefers a slightly clumsy sentence over a marker. Code doesn't. That one asymmetry is the whole reason the library exists in the shape it does; everything else fell out of taking it seriously.

View file

@ -1,56 +0,0 @@
---
title: A 2D Ray Tracer for the Browser, Tuned for the Phone in Your Pocket
description: 'My BSc thesis library. The mobile GPU shaped the architecture: tile-based passes, deferred shading, shaders generated per scene and device.'
date: 2026-05-08
projectPeriod: 'Autumn-Winter 2020'
thumbnail:
src: ./_assets/sdf2d.jpg
alt: SDF-2D browser demo with soft lighting effects.
tags: ['graphics', 'web', 'systems']
featuredOrder: 3
role: Library author
stack:
['TypeScript', 'WebGL', 'WebGL2', 'Signed distance fields', 'Dynamic shader generation']
scale: Browser library, mobile-targeted, real-time on consumer GPUs, both WebGL1 and WebGL2 paths
outcome: An NPM package and BSc thesis; the renderer behind the decla.red multiplayer game
audience: recruiter-relevant
links:
- label: NPM package
url: https://www.npmjs.com/package/sdf-2d
- label: Video
url: https://www.youtube.com/watch?v=K3cEtnZUNR0
- label: BSc thesis
url: /media/downloads/sdf2d-andras-schmelczer.pdf
download: true
media:
- type: image
src: ./_assets/sdf2d.jpg
alt: Browser demo page showing SDF-2D scenes rendered with soft lighting effects.
caption: SDF-2D shipped as a TypeScript library, not a one-shot demo. That distinction shaped most of the design.
---
Winter 2020, BSc thesis deadline closing in, and the thing had to run acceptably on my advisor's laptop the day he graded it. That single shipping pressure exposed every lazy assumption in the architecture and picked the design: tile-based passes, deferred shading, shaders generated per scene and per device. A 2D ray tracer in the browser via signed distance fields: soft shadows, smooth reflections, no triangle mesh. The other half of the thesis was [decla.red](/articles/declared-shared-simulation-code/), the multiplayer game that proved the renderer survived a real game loop.
## What "mobile GPU" actually meant
A 2D SDF ray tracer is conceptually simple: for each pixel, march along a ray, sample the distance field, accumulate light. The implementation that works on a desktop NVIDIA card spends so much per pixel that a mobile GPU melts. So the design problem was never "can SDFs do soft shadows" (yes, easily), it was "what work can I avoid per pixel without giving up the look."
Three constraints did most of the design work:
- **WebGL1 and WebGL2 both supported.** No "modern browser only" cheat. That ruled out anything that needed compute shaders or storage buffers.
- **No per-scene hand-tuned shader.** This is a library; users plug in their own scene descriptions. The renderer has to compile something appropriate at runtime.
- **Acceptable on a phone.** Not "good when the user owns the right hardware." It had to be acceptable on the laptop my advisor used to grade the thesis.
## How it actually runs
- **Tile-based rendering.** Group pixels and reason about them together. Most regions of a frame share the same nearby geometry, so you can early-out enormous swathes of pixel work if you know the tile's bounds. This was the single biggest perf win.
- **Deferred shading.** Separate "find the surface" from "shade the surface." Shadow casting and reflections need the same geometry queries; doing them once per pixel and reusing the result was worth the extra texture bandwidth.
- **Generated shaders per scene and device.** If a scene has no reflective surfaces, the generated shader doesn't carry the reflection path. If the device only supports WebGL1, the shader doesn't reach for WebGL2 features. Static feature flags do this badly; runtime generation does it well.
- **TypeScript scene descriptions, no DSL.** I prototyped a small DSL for SDF authoring and threw it away. Pride's expensive. Users describe scenes in plain TypeScript and the library compiles them down. A DSL would have meant one more language to teach and one more compiler to debug.
## Held up, didn't hold up
- **Held up:** the mobile constraint forced structural perf work instead of cosmetic perf work. When something only runs on a desktop GPU you mistake headroom for good architecture, and the rude awakening comes from a user.
- **Held up:** keeping the library boundary clean. A demo can hide a messy implementation; a published package can't.
- **Didn't:** I had no instrumentation around shader variants. Today I'd ship a small `?debug=1` overlay that prints exactly which shader got compiled for that session and why.
- **Didn't:** the docs are words about ray marching. The ideas are visual; the explanation should have been too. Diagrams next time.

View file

@ -1,106 +0,0 @@
---
title: An Obsidian Sync Built Around the Merger I Already Had
description: 'VaultLink: self-hosted Obsidian sync. Edit in any editor, online or off, then come back to a converged vault. The app that justified reconcile-text.'
date: 2026-05-30
projectPeriod: '2025-2026'
thumbnail:
src: ./_assets/vault-link.svg
alt: 'The VaultLink logo: a chain-link mark in a soft gradient.'
tags: ['systems', 'web', 'tools']
role: Sync engine and server author
stack:
[
'Rust',
'axum',
'sqlx',
'SQLite',
'WebSockets',
'TypeScript',
'Obsidian plugin',
'ts-rs',
'wasm-bindgen',
'reconcile-text',
]
scale: One Rust server, one TypeScript sync engine, three published consumers (Obsidian plugin, CLI, fuzz/deterministic test harnesses)
outcome: A self-hosted Obsidian sync I trust enough to use as my primary vault transport
audience: technical
links:
- label: Source
url: https://github.com/schmelczer/vault-link
- label: Docs
url: https://vault-link.schmelczer.dev
---
I refuse to give up the editor. Obsidian on the phone, Vim on the laptop, VS Code at work, the occasional headless `sed` across the whole vault. None of them know about each other, none of them are going to learn to, and I'm not switching to whichever sync product picks a favourite. VaultLink is the architecture that falls out of that refusal: one Rust server, one TypeScript sync engine, an Obsidian plugin, a CLI, and two test harnesses. The merge primitive underneath it all is [reconcile-text](/articles/reconcile-text-3-way-merge/), which I wrote first. VaultLink is the question that made it worth writing, finally asked in earnest.
## The constraint that picks the algorithm
The consequence of that refusal is that the server never sees keystrokes. It sees end states: a file as it stood when sync caught it. That kills CRDTs (which need every operation) and OT-as-it's-usually-implemented (same). It leaves you with one primitive: 3-way merge given a parent, a left, and a right. Which is reconcile-text. Which I'd written exactly because no existing tool took three independently-edited file states and gave one back.
The other consequence is that the _path placement_ is its own problem. Two clients might both move the same file. A file might land on a slot another file already occupies. A rename and a content edit might race. That's the part I underestimated.
## Two loops, separate invariants
The sync engine is two loops, deliberately disentangled:
- **Wire loop** (`syncer.ts`). Drains the single-consumer FIFO of pending HTTP and WebSocket ops. Updates a document's record fields (`remoteRelativePath`, `parentVersionId`, `remoteHash`) and writes content to whatever path the record currently holds. _Never moves files for path placement._
- **Path reconciler** (`reconciler.ts`). Runs after every drained event. Best-effort pass that moves files on disk so `localPath === remoteRelativePath`. The move graph is topologically sorted. Records with pending local events are skipped; the reconciler only operates on settled ones. Failures (slot occupied by something untracked) are silent skips; the next pass retries.
The split is the load-bearing decision. It used to be one loop with both responsibilities, and the bug catalogue was a parade of slot-collision stashes, "conflict-uuid" hacks, and `MoveOnConflict.NEW`/`EXISTING` policy choices. Separating wire transport from path placement made most of that vanish: the wire loop can freely write `remoteRelativePath` to whatever the server returned, even if it disagrees with the file on disk, because the reconciler won't move anything out from under a queued user rename.
Cycles in the move graph (A→B, B→C, C→A) are resolved by reading every file in the cycle into memory and writing each back to its new slot; no tmp files. A write-ahead marker at `.vaultlink/swap-<uuid>.json` lists each leg. On startup the reconciler reads the marker, hashes each `from` to determine which legs ran, and replays the rest. `.vaultlink/**` is hardcoded into the internal ignore pattern so the swap markers never themselves get synced.
## Pending creates are Promises, not strings
When the user creates a file locally and _then_ immediately edits or renames it before the create has been acknowledged, the engine doesn't know the document's id yet; the server assigns it. So queued events for that doc carry a `Promise<DocumentId>` in their `documentId` slot, threaded back to the still-in-flight `LocalCreate`. When the server acks the create, `resolveCreate` fulfils the promise and `replacePendingDocumentId` walks the queue swapping the resolved string into every dependent event.
If you're walking `events[]` and comparing docIds with `===`, you'll silently fail to match until the swap happens. There's a comment in `sync-event-queue.ts` that warns about exactly that, in slightly more alarmed punctuation. The shape is unusual but the alternative (synchronously waiting for the create ack before letting the user type more) is the kind of thing that makes a notes app feel like a 1998 webform.
## MinCovered: the watermark that doesn't lie
The catch-up handshake says "give me everything newer than `lastSeenUpdateId`." If the client advances that id as it receives a stream of RemoteChange ids out of order, it'll publish a too-high cursor, and the next reconnect will request from a point past events it never actually applied. Permanent gap. Replay-forever bug, with extra steps.
The fix is a small data structure called `MinCovered`: a contiguous-prefix tracker over a stream of integers. It advances the public min only when the next consecutive id has been processed. Out-of-order arrivals stash without bumping the cursor. Five files of test, one screen of implementation, and an entire category of confusing data-loss bugs disappears.
## reconcile-text on the server
The merge sits on the server. When two clients submit edits against the same `parent_version_id`, the second submission triggers a 3-way merge against the parent and the freshly-committed first edit. Three strings in, one out. No conflict markers. The engine commits the merged result, increments the version, and broadcasts the new state to every connected client.
Two restrictions, both honest:
- **Only `.md` and `.txt`.** Markdown that fails UTF-8 validation gets treated as binary, same as PNGs and PDFs.
- **Last-write-wins for everything else.** Concurrent edits to a `.docx` lose one of the writes. The right fix is "don't edit binaries concurrently," which is unsatisfying but true.
Merge quality is exactly what reconcile-text gives me. Word-level tokenisation turns most prose conflicts into two adjacent edits that coexist. If the merge looks slightly clumsy now and then, the alternative is a `<<<<<<< HEAD` block in my notes, and I'd take the clumsy sentence every time.
## Two test harnesses, one workflow
Distributed-sync bugs are confusing the first time and impossible the second. The fix is two harnesses:
- **`test-client` (fuzz).** N parallel processes hammering random ops against a shared server for minutes at a time. Catches bugs nobody thought to write a test for. Reproductions are noisy.
- **`deterministic-tests`.** Scripted multi-client scenarios with a step grammar (`pause-server`, `pause-websocket`, `barrier`, `assert-consistent`) using an in-memory filesystem against a real server binary. Used to capture a fuzz-found bug as a minimal repro before fixing it.
The workflow: fuzz finds something, I sift logs for a root cause, write the minimal deterministic test that fails on it, fix until both that test and the fuzz pass. Without the deterministic harness, every bug fix would be vibes-based.
## Smaller calls
- **TS types are generated from Rust via `ts-rs`.** The HTTP/WS API has one source of truth: the Serde types in the server. `scripts/update-api-types.sh` re-emits `frontend/sync-client/src/services/types/`. Hand-edits to those files are explicitly banned.
- **`sqlx::query!` macros over a checked-in `.sqlx` cache.** SQL is verified against the schema at compile time. Touching SQL means re-running `cargo sqlx prepare --workspace`; if you forget, CI catches it.
- **One sync engine, four consumers.** `sync-client` is the engine. Obsidian plugin, standalone CLI, fuzz harness, and deterministic harness all depend on it via `file:../sync-client`. Bugs are fixed once and inherited everywhere.
- **`record.localPath` mutates in place across awaits.** The watcher can rename a doc while a wire-loop handler is mid-HTTP. Snapshotting `localPath` into a local at function entry and reading it after the await reads a vacated slot. Read it live; only snapshot when you deliberately want to compare _before_ and _after_ the await.
- **Watermark advancement is load-bearing both ways.** Branches that skip a remote event without advancing `lastSeenUpdateId` create permanent gaps that re-deliver forever. Branches that advance without applying the content lose data. The rule that survives review is: advance only if you applied the event or deliberately discarded it.
## The race I haven't structurally fixed
Pause-or-disable-sync mid-flight is the one left. An HTTP that committed server-side but whose response was dropped leaves the server holding a doc the client never recorded. On resume, the offline scan finds the file again, uploads it as a new create, and server-side dedupe merges the duplicate into the existing doc. If the merge produces a deconflict file (two real divergences), the user picks up an extra file in their vault. Not data loss, but a small ugliness.
The two-loop split doesn't fix this and probably shouldn't. The honest path is something like a persisted client-side "have I acked this op?" log, sitting in the same SQLite the engine already uses. It's on my list, below several things I want more.
## What I'd change
- **Move the merge to the client.** Right now reconcile-text runs on the server. Putting it in the WASM build of reconcile-text on each client, and letting the server be a dumb commit log, would let the merge benefit from device-specific tokenisers (Markdown-aware on the desktop, word-level on mobile). It would also stop the server from needing to understand the file format at all.
- **Property tests for the move graph.** The cycle resolver is the part I trust least under crash. Snapshot tests can't go where proptest can; I should be generating arbitrary move-graph + interruption combinations.
- **A first-class "pause" with a write-ahead op log.** See above.
- **More than `.md` and `.txt`.** A canvas-aware merge for Obsidian's `.canvas` files is one reconcile-text tokeniser away. Not because anyone asked, but because the asymmetry annoys me.
The way I think about VaultLink now: reconcile-text was the bet. VaultLink is what I built once the bet looked like it might pay off. The interesting part of the bet was always that three independently-edited files can become one without anyone telling the system about the keystrokes that produced them. The interesting part of the application is everything you have to do _around_ that merge to stop the rest of the system from undoing it.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 KiB

Some files were not shown because too many files have changed in this diff Show more