Skip to content

Instantly share code, notes, and snippets.

#!/bin/env python2
import array
import fcntl
import argh
LIRC_MODE_PULSE = 2
def ioc(dir, type, nr, size):
#!/bin/bash
gen-keys() {
for control in "$@"; do
echo $enter "$control" $down
done
}
# weird key names
up=Up
@ekimekim
ekimekim / throws.py
Created August 3, 2021 18:05
hacked together brute force solver for necrodancer blood shop throws
from collections import namedtuple
class Point(namedtuple('_Point', ['x', 'y'])):
def __add__(self, other):
return Point(self.x + other.x, self.y + other.y)
shopkeeper = Point(2, 1)
rune = Point(2, 5)
size = Point(5, 7)
gold_weapon = Point(1, 3)
#!/bin/env python2
import os
import re
import time
import argh
PATTERNS = {
from urllib import urlencode
import requests
import argh
def build_url(base, **kwargs):
return '{}?{}'.format(base, urlencode(kwargs))
import itertools as it
import argh
def get_tries(codes, permute, start, offset, hardcodes):
"""
codes is list of codes
permute is a permutation of (0, 1, 2) where the value at index i
is the index (MSD first) of the digit in the counting number to be used in that position.
// Proof of concept for exploring an idea I had with using rust's type system
// to manage the di/ei instructions on a Gameboy (if I ever get rust-on-gb working).
// It works as follows: We have a zero-sized IntFlag object. It's zero sized
// because it is NOT actually maintaining the state. It mediates access to the state
// at compile time by being borrowed.
// Each function that MAY disable interrupts (either in itself or a child func) must
// take a &mut IntFlag. It can then borrow that for an IntDisableGuard,
// as long as it releases it before the original borrow's lifetime expires (ie. by returning).
@ekimekim
ekimekim / combat_log.py
Created April 10, 2020 01:45
Battletech combat log script - consumes debug logging output from game and pretty prints relevant info
import os
import re
import time
import argh
PATTERNS = {
# Hard code Player 1 here to ignore uselss matches like "World"
0eJzEve/OHjdy7XsrG/N5FDT/k+dWDg4Cj0fbI4wtC5Kc7CDIvZ+WZ09EvuVFriarnnxJPLbEqq6HLFaTv1r9n3/6y8+/vf/0+cPHr3/6f/7Xf/7pw9f3v9z/0P3bP/+vP3348dePX+5/+//e//3jX9//n/sf3f2vv3z46eMPP//+177+x6f33/7a73/9/k8ff/jl9//9w5cv73/5y88fPv707pcffvzbh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