Skip to content

Instantly share code, notes, and snippets.

@arigo
arigo / opus_magnum.py
Last active June 22, 2020 08:41
Opus Magnum Information Age puzzle generator (Python 2)
import sys
from struct import pack, unpack
import random
class Primes:
Salt = 0x1
Air = 0x2
Earth = 0x3
Fire = 0x4
arigo@catsnake:/tmp/x$ python x_build.py
generating ./StrategyBasic.c
running build_ext
building 'StrategyBasic' extension
gcc -pthread -fno-strict-aliasing -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fPIC -I/usr/include/python2.7 -c StrategyBasic.c -o ./StrategyBasic.o
gcc -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro ./StrategyBasic.o -L/usr/lib -lpython2.7 -lpython2.7 -o ./libStrategyBasic.so
arigo@catsnake:/tmp/x$ gcc main.c -L. -lStrategyBasic
arigo@catsnake:/tmp/x$ LD_LIBRARY_PATH=. a.out