Skip to content

Instantly share code, notes, and snippets.

View htunnicliff's full-sized avatar

Hunter Tunnicliff htunnicliff

View GitHub Profile
interface Work<Input, Output = any> {
input: Input;
handle: PromiseWithResolvers<Output>;
}
interface Flush<Input> {
(batchedWork: Work<Input>[]): void | Promise<void>;
}
/**
title AST Grep and Codemods at Transcend
date 2026-06-30

AST Grep and Codemods

What to do when find and replace isn't enough

What Is a Codemod?

#!/usr/bin/env node
import { createHash } from "node:crypto";
import fs from "node:fs";
import { glob } from "node:fs/promises";
import { join } from "node:path";
import { parseArgs } from "node:util";
const logger = console;
if (import.meta.main) {
// ==UserScript==
// @name GitHub Monospace Font Override
// @namespace http://tampermonkey.net/
// @version 2025-09-23
// @description Change the default monospace font used by GitHub
// @author You
// @match https://github.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant none
// ==/UserScript==
# yaml-language-server: $schema=https://raw.githubusercontent.com/ast-grep/ast-grep/main/schemas/rule.json
id: bad-type-imports
message: Cannot use type keyword within a type import
severity: error
language: TypeScript
rule:
kind: import_specifier
pattern: type $IMPORT
inside:
@htunnicliff
htunnicliff / cloud-init.yaml
Created March 8, 2025 23:54 — forked from NatElkins/cloud-init.yaml
cloud-init script for VPS
#cloud-config
# Enable automatic package updates and upgrades during cloud-init execution
package_update: true
package_upgrade: true
packages:
# Security and Hardening
- ufw
- fail2ban

Browser Extensions

DNS

  • NextDNS
    • Configure router to point at NextDNS
  • Install app on devices
@htunnicliff
htunnicliff / react-solid-flow.tsx
Created September 7, 2023 21:41
Show, Switch, and Match for React – borrowed from Solid.js
import { Children, ReactNode, isValidElement, useMemo } from 'react';
type ShowProps<T> = {
when: T;
fallback?: ReactNode;
children: ReactNode | ((item: NonNullable<T>) => ReactNode);
};
/**
* Concept borrowed from Solid: https://www.solidjs.com/docs/latest/api#show
type HttpStatus = {
// 2xx
200: 'Ok';
201: 'Created';
202: 'Accepted';
203: 'Non-Authoritative Information';
204: 'No Content';
205: 'Reset Content';
// 4xx
400: 'Bad Request';