Skip to content

Instantly share code, notes, and snippets.

View mnpenner's full-sized avatar
:octocat:

Mark Penner mnpenner

:octocat:
View GitHub Profile
@mnpenner
mnpenner / color.ts
Last active April 22, 2024 02:41
RGB color hex to lightness
// based on https://stackoverflow.com/a/56678483/65387
type RGB = [r: number, g: number, b: number]
const UNK = 255 / 2
/**
* @param hex RGB hex string like "#CCCFDB"
* @returns RGB tuple in [0-255]
*/
@mnpenner
mnpenner / aijail.sh
Last active April 14, 2026 14:06
A jail for LLMs
#!/usr/bin/env bash
{
set -euo pipefail
# --- Re-run inside WSL when invoked from Windows shells ---
if [[ -z "${WSL_INTEROP-}" && -z "${WSL_DISTRO_NAME-}" ]]; then
exec wsl -d Ubuntu-24.04 -- /bin/bash -lc "aijail $*"
fi
# --- Verify HOME (we bindmount a bunch of $HOME paths) ---