Skip to content

Instantly share code, notes, and snippets.

@catbraincell
catbraincell / build_llama_cpp_windows_amd.bat
Last active June 5, 2025 08:56
compile llama.cpp on windows with AMD ROCm
'BROKEN, DONT TRY
D:\
set PATH=%HIP_PATH%\bin;%PATH%
cd llama.cpp
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
bootstrap-vcpkg.bat
vcpkg.exe install curl:x64-windows
@catbraincell
catbraincell / pytubefix_gui.py
Last active November 9, 2025 00:31
A minimal GUI for pytubefix with a/v merging support (call ffmpeg automatically)
#!/usr/bin/env python3
import sys
import re
import os
import shutil
import subprocess
import tempfile
from dataclasses import dataclass
from typing import List, Optional
@catbraincell
catbraincell / bidir_shiftreg.v
Last active October 20, 2025 03:19
Synthesizable variable-length bidirectional shift register
module bidir_shiftreg #(
parameter integer W = 32
) (
input wire clk,
input wire nrst,
input wire lsbfirst, // 1 = LSB-first shift (right), 0 = MSB-first (left)
input wire [$clog2(W)-1:0] N, // active bits val[N:0]
input wire [W-1:0] load, // parallel load
input wire load_en,
output reg [W-1:0] val, // parallel output
@catbraincell
catbraincell / gerber_cleanup.py
Created October 19, 2025 12:19
Remove tool information and file path from gerber & nc drill files
import os
import re
import fnmatch
# Regex replacements for .g* files
g_patterns = [
(re.compile(r'^(G04\s+#@!\s+TF\.GenerationSoftware)[^*]*\*$', re.MULTILINE),
r'\1*'),
(re.compile(r'^(G04\s+#@!\s+TF\.SameCoordinates)[^*]*\*$', re.MULTILINE),
r'\1*')