Skip to content

Instantly share code, notes, and snippets.

@anopse
anopse / w3c.py
Created October 7, 2026 22:28
Vibe coded warcraft 3 campaign save file version fix, use at your own risk
import struct, zlib, sys, re
BLK = 0x100000
DEFAULT_WINDOW = 0x104 # end of the map-identity header: first per-save field seen in the aba3/aba4 diffs
DEFAULT_EXTRA = ['0x10e:4'] # stable 4-byte field beyond that window (offset:length)
fold = lambda x: (x ^ x >> 16) & 0xFFFF
def chk(n, u, comp):
return fold(zlib.crc32(comp)) << 16 | fold(zlib.crc32(struct.pack('<III', n, u, 0)))
def hdr_crc(h):
h = bytearray(h); h[-4:] = bytes(4); return zlib.crc32(h)
def blocks(d):
@anopse
anopse / place.user.js
Last active July 24, 2023 02:48
Bot for r/place
// ==UserScript==
// @name PlaceNL Bot Yet another edition
// @namespace https://github.com/
// @version 24
// @description Bot for r place, based on CZ
// @author NoahvdAa, GravelCZ, MartinNemi03, ...
// @match https://www.reddit.com/r/place/*
// @match https://new.reddit.com/r/place/*
// @match https://reddit.com/r/place/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=reddit.com