Skip to content

Instantly share code, notes, and snippets.

View examosa's full-sized avatar

Jules Amonith examosa

View GitHub Profile
@examosa
examosa / unicode-identifiers.mjs
Created June 4, 2026 16:22
Save all valid JS identifier characters as a TSV file
#!/usr/bin/env node
import { basename } from "node:path";
import { writeFile } from "node:fs/promises";
const isStart = /^\p{ID_Start}$/u;
const isPart = /^\p{ID_Continue}$/u;
const lines = ["codepoint\tcharacter\ttype"];
@examosa
examosa / make-launch-agent.sh
Last active June 12, 2026 19:42
Shell scripts
#!/usr/bin/env nix
#! nix shell nixpkgs#argc nixpkgs#jq --command bash
# shellcheck shell=bash
# vim: filetype=bash
# @describe Bootstrap a launch agent plist
# @option -c --command! Command to run
# @option -C --cwd <DIR> Working directory
# @option -e --env*, Environment variables
# @option -l --label! Launch agent label
# @option -n --name Program name
@examosa
examosa / useSharedState.ts
Created February 12, 2026 04:40
React useSharedState hook
import { useCallback, useEffect, useMemo, useState } from "react";
const store = new Map<symbol, unknown>();
const listeners = new Map<symbol, Set<(value: any) => void>>();
function useSharedState<T>(key: symbol, initialValue?: T) {
const [state, setState] = useState(() =>
store.has(key) ? (store.get(key) as T) : initialValue,
);
@examosa
examosa / https-loader.mjs
Created January 13, 2026 19:28
Node.js HTTPS ESM Loader
/**
* Adds support for importing ES modules from the web.
*/
export function load(url, _context, nextLoad) {
if (!url.startsWith("https://")) {
return nextLoad(url);
}
return fetch(url)
.then((res) => res.text())
@examosa
examosa / fetch-instances.js
Last active January 8, 2026 15:42
Userscripts
const gh = (path) => new URL(path, 'https://nobsdelivr.private.coffee/gh');
const getJson = (url) =>
fetch(url, { headers: { Accept: "application/json" } })
.then((response) => response.json())
.catch((error) => {
console.error(error);
});
async function fetchInstances() {