Skip to content

Instantly share code, notes, and snippets.

View theMackabu's full-sized avatar
😹
meow

Mack theMackabu

😹
meow
View GitHub Profile
@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;
Block realloc_block(Block bk, uint32_t size) {
assert(!memcmp(bk.memptr, bk.data, bk.data_size));
- bk.data = randbytes(size);
- bk.memptr = nrealloc(bk.memptr, size);
+ uint32_t preserved_size = bk.data_size < size ? bk.data_size : size;
+ char *new_memptr = nrealloc(bk.memptr, size);
+ assert(new_memptr != NULL);
+ assert(!memcmp(new_memptr, bk.data, preserved_size));
+
+ free(bk.data);
BasedOnStyle: LLVM
IndentWidth: 2
ContinuationIndentWidth: 2
BracedInitializerIndentWidth: 2
ColumnLimit: 120
PointerAlignment: Right
IndentPPDirectives: AfterHash
AlignAfterOpenBracket: BlockIndent
BinPackArguments: false
BinPackParameters: false
static inline size_t max_size_n(const size_t *values, size_t count) {
size_t max = values[0];
for (size_t i = 1; i < count; ++i)
if (values[i] > max) max = values[i];
return max;
}
#define MAX_SIZE(...) \
max_size_n((const size_t[]){__VA_ARGS__}, \
sizeof((const size_t[]){__VA_ARGS__}) / sizeof(size_t)) \
async function* poolResults(items, concurrency, worker) {
const it = items[Symbol.iterator]();
const buffer = [];
let active = 0;
let wake = null;
const signal = () => {
if (wake) {
const w = wake;
@theMackabu
theMackabu / fun.c
Created April 29, 2026 07:55
“fun”.c
/*
* 1. Have fun.
* 2. Always clean up after yourself.
* optional: bring a priest
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
$ python3 tools/gc_log_report.py /tmp/ant.gc.log
logfile: /tmp/ant.gc.log
log rows: 602
major collections: 22
minor collections: 176
Collection Timing
major total count= 22 avg= 21.57ms p50= 28.90ms p95= 36.31ms max= 65.49ms
major objects count= 22 avg= 20.23ms p50= 27.32ms p95= 34.71ms max= 61.83ms
const std = @import("std");
const Managed = std.math.big.int.Managed;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
const n = 1_000_000;
var a = try Managed.initSet(allocator, 0);