Skip to content

Instantly share code, notes, and snippets.

View mlafeldt's full-sized avatar

Mathias Lafeldt mlafeldt

View GitHub Profile
@mlafeldt
mlafeldt / postmortem.md
Last active February 20, 2026 07:06
Example Postmortem from SRE book, pp. 487-491

Shakespeare Sonnet++ Postmortem (incident #465)

Date

2015-10-21

Authors

  • jennifer
  • martym
@mlafeldt
mlafeldt / ion11.md
Created December 28, 2025 17:39
Ion 1.1 research report (generated with Claude Opus 4.5)

Amazon Ion 1.1: Major Upgrades to Encoding, Performance, and Macros

Amazon Ion 1.1 represents the most significant update to the Ion data format since its public release, introducing a macro system for templated data, switching to little-endian encoding for 1.5-3x performance gains, and adding delimited containers for streaming writes—all while maintaining full backward compatibility with Ion 1.0. The specification's final comment period closed in March 2025, but official finalization remains pending as of late December 2025. ion-rust serves as the reference implementation with full Ion 1.1 support, while ion-java offers preview support. The update has also attracted criticism for its complexity, with some observers noting "second system syndrome" patterns in the ambitious scope of changes and the slow pace of both specification finalization and library adoption.

What Amazon Ion Is and Why It Matters

Amazon Ion is a richly-typed, self-describing, hierarchical data serialization format

@mlafeldt
mlafeldt / clerk.ts
Created August 25, 2022 09:51
Talking to Clerk's backend API from Deno
#!/usr/bin/env -S deno run --allow-env=CLERK_API_KEY --allow-net=api.clerk.dev --no-check
import {
ClerkAPIResponseError,
ClerkBackendAPI,
User,
} from "https://cdn.skypack.dev/@clerk/backend-core?dts";
const ClerkAPI = new ClerkBackendAPI({
apiClient: {
@mlafeldt
mlafeldt / elf.h
Last active December 18, 2025 23:35
elf.h for OSX
/* This is the original elf.h file from the GNU C Library; I only removed
the inclusion of feature.h and added definitions of __BEGIN_DECLS and
__END_DECLS as documented in
https://cmd.inp.nsk.su/old/cmd2/manuals/gnudocs/gnudocs/libtool/libtool_36.html
On macOS, simply copy the file to /usr/local/include/.
Mathias Lafeldt <mathias.lafeldt@gmail.com> */
/* This file defines standard ELF types, structures, and macros.
@mlafeldt
mlafeldt / duckdb-go-lldb.txt
Last active December 8, 2025 19:59
How to use lldb with duckdb-go
❯ CGO_CFLAGS="-I$DUCKDB_SRC/src/include"
CGO_LDFLAGS="-L$DUCKDB_SRC/build/debug/src -lduckdb -Wl,-rpath,$DUCKDB_SRC/build/debug/src"
go build -tags "duckdb_use_lib" -gcflags="all=-N -l" -o simple_debug ./examples/simple
# github.com/duckdb/duckdb-go/v2/examples/simple
ld: warning: duplicate -rpath '/Users/mathias/devel/duckdb/duckdb/build/debug/src' ignored
ld: warning: duplicate -rpath '/Users/mathias/devel/duckdb/duckdb/build/debug/src' ignored
ld: warning: ignoring duplicate libraries: '-lduckdb'
❯ lldb ./simple_debug
(lldb) target create "./simple_debug"
@mlafeldt
mlafeldt / x.md
Created February 16, 2016 15:48
Providing a Homebrew tap backed by private GitHub repo

First of all, install Homebrew itself.

As the tap is a private Git repo, you need to generate a GitHub token with repo scope and then add this token to your ~/.netrc file like this:

machine github.com
  login <your GitHub user>
  password <your GitHub token>
#!/usr/bin/env bash
# Calculate bundle sizes for Cloudflare Pages worker modules.
# Output similar to `wrangler pages dev`.
set -euo pipefail
cd "$(dirname "$0")/.."
DIST_DIR="${1:-dist/_worker.js}"
@mlafeldt
mlafeldt / drizzle.config.local.ts
Created September 12, 2024 14:01
Drizzle config for local development with wrangler
import { defineConfig } from 'drizzle-kit'
import crypto from 'node:crypto'
import { mkdirSync } from 'node:fs'
import path from 'node:path'
// Based on https://github.com/cloudflare/workers-sdk/blob/64710904ad4055054bea09ebb23ededab140aa79/packages/miniflare/src/plugins/shared/index.ts#L194
function idFromName(uniqueKey: string, name: string) {
const key = new Uint8Array(crypto.createHash('sha256').update(uniqueKey).digest())
const nameHmac = new Uint8Array(crypto.createHmac('sha256', key).update(name).digest().subarray(0, 16))
const hmac = new Uint8Array(crypto.createHmac('sha256', key).update(nameHmac).digest().subarray(0, 16))
@mlafeldt
mlafeldt / app.py
Created August 12, 2022 08:41
Extracted from https://eventbridge-inbound-webhook-templates-prod-eu-central-1/lambda-templates/github-lambdasrc.zip
"""Webhook implementation for Github"""
import os
import json
import urllib.parse
import base64
import hmac
import hashlib
from cgi import parse_header
import boto3

EMAILENGINE LICENSE AGREEMENT

Version 2.1, 17 October 2023

PLEASE CAREFULLY READ THIS EMAILENGINE LICENSE AGREEMENT ("AGREEMENT"). THIS AGREEMENT CONSTITUTES A LEGALLY BINDING AGREEMENT BETWEEN YOU AND POSTAL SYSTEMS OÜ AND GOVERNS YOUR USE OF THE SOFTWARE (DEFINED BELOW). IF YOU DO NOT AGREE WITH THIS AGREEMENT, YOU MAY NOT USE THE SOFTWARE. IF YOU ARE USING THE SOFTWARE ON BEHALF OF A LEGAL ENTITY, YOU REPRESENT AND WARRANT THAT YOU HAVE AUTHORITY TO AGREE TO THIS AGREEMENT ON BEHALF OF SUCH ENTITY. IF YOU DO NOT HAVE SUCH AUTHORITY, DO NOT USE THE SOFTWARE IN ANY MANNER.

This Agreement is entered into by and between Postal Systems OÜ and you, or the legal entity on behalf of whom you are acting (as applicable, "You" or "Your").

1. DEFINITIONS