Skip to content

Instantly share code, notes, and snippets.

// serve a page bundled with deno (with an HTML entrypoint)
// - all in-memory
// - re-builds automatically on refresh
// - rudimentary auto-reload (not hot reloading, it just refreshes the page)
import { extname } from "@std/path";
import { typeByExtension } from "@std/media-types";
import { debounce } from "@std/async";
import { DOMParser } from "@b-fuze/deno-dom";
import { serveDir } from "@std/http/file-server";
"""
extract a zip file which was mistakenly written with windows-style backslash-delimited paths
(i.e. one which looks sort of like the example below)
NOTE THAT THIS LIKELY DOES NOT CORRECTLY HANDLE ALL (or even most) EDGE CASES INVOLVING
STUFF LIKE PATH TRAVERSAL, I WROTE THIS IN 5 MINUTES FOR A ONE-TIME USE CASE AND IT
PROBABLY ISN'T SAFE TO RUN ON UNTRUSTED INPUT OR ANY ARCHIVES WITH WEIRD PATH NAMES
$> unzip -l ../paint.net.5.1.12.portable.x64.zip
# (most items omitted for space, but you get the point)

Notes about how reStructuredText works on Github

and some useful tips on how to do certain things

get just ip, with ip's json output and jq

ip -4 -json addr | jq --raw-output '.[] | select(.flags | contains(["LOOPBACK"]) | not) | .addr_info | .[0].local'

notes/errata

  • i wrote this in like 5 minutes and didn't read the ip docs so there could be some glaring edge cases i'm not handling here
  • if you want ipv6, swap -4 for -6
    ip -6 -json addr

specific pages from various places which i've found particularly useful. mostly programming language/library docs.
(this is just a summary, click through to see the full document)
sections at a glance: general resources. programming languages (rust, typescript, bash, reStructuredText).

@adrianmgg
adrianmgg / amgg-util.js
Created March 19, 2026 21:19
WIP collection of general-purpose JS helper things i've written
// a WIP collection of general-purpose JS helper things i've written
// figured it made sense to start collecting these things in one place
// rather than them being lost to time forever in old scripts
const util = (() => {
const idProxy = new Proxy({}, {
get(target, prop, receiver) { return document.getElementById(prop); },
});
return { idProxy };
})();
import bs4
import itertools
import re
import json
import argparse
import typing
import csv
def cli():
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, epilog=r"""examples:
#!/usr/bin/env nix-shell
#!nix-shell -p powershell -i pwsh
<#
.SYNOPSIS
merge multiple individual git repos into a single git repo with subfolders,
preserving the history from each.
.PARAMETER MergeWhat
what to merge from each existing repo (e.g. main, HEAD)
.PARAMETER MainBranch
# searches for commits changing version line (looks like "@version 0.1.2") and tags them with their corresponding version number
git log '--format=%H' | %{ $commit = $_; (git show --format=%b $commit | sls '^\+@version\s+([0-9.]+)').matches.groups | where Name -eq 1 | %{ $v=$_.value; git tag -a "v$v" $commit -m "v$v" } };