Skip to content

Instantly share code, notes, and snippets.

View grechnik's full-sized avatar

Evgeny Grechnikov grechnik

View GitHub Profile
from __future__ import print_function, unicode_literals
import io, sys, os, struct, zlib
ogg_crc_table = [
0x0, 0x4C11DB7, 0x9823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B,
0x1A864DB2, 0x1E475005, 0x2608EDB8, 0x22C9F00F, 0x2F8AD6D6,
0x2B4BCB61, 0x350C9B64, 0x31CD86D3, 0x3C8EA00A, 0x384FBDBD,
0x4C11DB70, 0x48D0C6C7, 0x4593E01E, 0x4152FDA9, 0x5F15ADAC,
0x5BD4B01B, 0x569796C2, 0x52568B75, 0x6A1936C8, 0x6ED82B7F,
0x639B0DA6, 0x675A1011, 0x791D4014, 0x7DDC5DA3, 0x709F7B7A,
0x745E66CD, 0x9823B6E0, 0x9CE2AB57, 0x91A18D8E, 0x95609039,
@grechnik
grechnik / extract_bink_pcm.c
Created August 1, 2020 21:58
call bink2w32.dll to extract the raw sound
#include <windows.h>
#include <stdio.h>
typedef void* (__stdcall *BinkOpen_t)(const char*, unsigned);
typedef void (__stdcall *BinkNextFrame_t)(void*);
typedef void (__stdcall *BinkClose_t)(void*);
typedef int (__stdcall *BinkSetVideoOnOff_t)(void*, int);
typedef void* (__stdcall *BinkOpenTrack_t)(void*, unsigned);
typedef void (__stdcall *BinkCloseTrack_t)(void*);
typedef unsigned (__stdcall *BinkGetTrackData_t)(void*, void*);
@grechnik
grechnik / spawn.py
Created October 19, 2024 20:27
reconstructed islands of insight spawn logic
import time
import cityhash # pip install cityhash
import zlib
import struct
import math
import argparse
from collections import namedtuple, defaultdict
# presumably most or all of this info can be loaded from Puzzles.json,
# but for now, grab already parsed records from https://egrechnikov.store/misc/ioipuzzles.zip