Skip to content

Instantly share code, notes, and snippets.

View theMackabu's full-sized avatar
😹
meow

Mack theMackabu

😹
meow
View GitHub Profile
function microDebounce(callback) {
let isQueued = false;
let latestArgs = [];
let latestContext = null;
return function (...args) {
latestArgs = args;
latestContext = this;
// dont queue if a task is already scheduled for the next tick
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
static uint8_t *mem;
static size_t used;
static void write_code (void *dst, const void *src, size_t n) {
mprotect (mem, 4096, PROT_READ | PROT_WRITE | PROT_EXEC);
#!/usr/bin/env bash
# needs CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_AUTH_TOKEN in environment
URL="https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/@cf/cloudflare/clef"
board="rnbqkbnr pppppppp ........ ........ ........ ........ PPPPPPPP RNBQKBNR"
squares=$(jq -nc '[range(8) as $r | range(8) as $f | ("abcdefgh"[$f:$f+1] + "\(8-$r)")] | map({(.): null}) | add')
moves=""
sq() {
static int digit_value(char c) {
if (c >= '0' && c <= '9') return c - '0';
c |= 0x20;
if (c >= 'a' && c <= 'z') return c - 'a' + 10;
return -1;
}
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static const char *prog = "coreutils";
[[noreturn]] static void die(const char *what) {
fprintf(stderr, "%s: %s: %s\n", prog, what, strerror(errno));
exit(EXIT_FAILURE);
@theMackabu
theMackabu / da.ts
Created September 12, 2026 08:42
ew
import type { ptr } from './stdlib.h';
import { mem, brk } from './memory.h';
import { $, malloc, free, memcpy, typedef } from './stdlib.h';
const da_t = typedef([
{ name: 'items', type: 'ptr' },
{ name: 'count', type: 'int' },
{ name: 'capacity', type: 'int' }
]);
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
typedef uint64_t value_t;
constexpr value_t kTypeArray = 2;
constexpr value_t kTypeUndefined = 7;
constexpr value_t kTypeNull = 8;
constexpr value_t kTypeBool = 9;
@theMackabu
theMackabu / m.c
Created September 10, 2026 00:00
/* # run this example using the program below
n = 1;
f = 1;
while (n <= 7) {
f = f * n;
print f;
n = n + 1;
}
@theMackabu
theMackabu / skill.md
Created August 16, 2026 05:21
implementation-review
name implementation-review
description Thorough review of code changes for correctness, optimality, and elegance using parallel subagents. Use this skill whenever the user asks to review an implementation, audit recent changes, review a diff or PR, check code quality, or wants a second opinion on changes they or someone else made. Also trigger when the user says things like "review this", "how does this look", "check my changes", "audit this code", or "review the implementation" — even if they don't specify the axes explicitly.

Implementation Review

You've been asked to review a set of code changes. Your job is to provide a thorough, structured review across three axes: correctness, optimality, and elegance. Each axis gets its own subagent so it receives deep, focused attention rather than a surface-level pass.

Step 1: Identify the changes

const e = new TextEncoder();
const d = new TextDecoder();
function NaNcode(string) {
const encoded = Array.from(e.encode(string));
encoded.unshift(0, 0, 0, 0, 0, 0);
while (encoded.length % 6) encoded.push(0);
const bytes = [];
let i = 0;