Skip to content

Instantly share code, notes, and snippets.

View ztane's full-sized avatar

Antti Haapala ztane

View GitHub Profile
@ztane
ztane / yadayadagettext.py
Created May 16, 2020 20:56
Yadayada gettext
import re
import itertools
def ugettext(s):
c = itertools.cycle('yada')
def replace(m):
char = m.group(0)
replacement = next(c)
if char.isupper():
@ztane
ztane / fix_0cc.py
Created December 16, 2021 17:29
Try to fix a 0cc/FTM file by writing copies with certain chunks missing
#!/usr/bin/python3
import sys
def read_block():
block_id = f.read(16)
version = f.read(4)
size = f.read(4)
contents = f.read(int.from_bytes(size, "little"))
return block_id, version, size, contents