Skip to content

Instantly share code, notes, and snippets.

View notwa's full-sized avatar
🚲
bikeshedding

Connor notwa

🚲
bikeshedding
View GitHub Profile
@notwa
notwa / stfu.sh
Created October 24, 2020 01:46
silence
#!/usr/bin/env ash
echo2() {
local IFS=" "
printf "%s\n" "$*" >&2
}
note() {
local IFS=" "
printf "\033[1m%s\033[0m\n" "$*" >&2
# this code generated the text at https://wiki.cloudmodding.com/mm/File_List/U_1.0
from struct import unpack
# you'll probably want to change these:
filenames_filepath = "fn M US10.txt"
dmadata_filepath = "dump/mm-US10-d6133ace5afaa0882cf214cf88daba39e266c078/0002 V0001A500"
def readu32(f):
return unpack(">I", f.read(4))[0]
@notwa
notwa / halokey.c
Last active July 20, 2025 22:28
Halo CE product key, reverse engineered
/*
most of this code was reverse engineered from PidGen.dll, with hashes:
MD5: 3e275cb6c964ad9e3bffa3f37e1eef1e
SHA-1: 325d4bc9b603075ba96c48bfaf31588cb57026c6
SHA-256: 62361c9b86f7899d736986829d7a8529573e030c6656f04f3244f3b792a6b291
how to debug:
* ensure Halo is not installed OR temporarily rename the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Halo
* run the Halo CE installer off the CD
#!/usr/bin/env zsh
set -e
# private user stuff:
read -r oauth < ~/.twitch_oauth
# public api stuff:
api='https://gql.twitch.tv/gql'
ChannelFollowsHash='fd9d5312a69d3c50cd2a8d6a1caadc824df410c249b78d330d7f469d22151933'
ClipsCardsUserHash='b73ad2bfaecfd30a9e6c28fada15bd97032c83ec77a0440766a56fe0bd632777'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@notwa
notwa / rsh.py
Created April 29, 2020 20:07
a random-sampling heuristic for optimization that usually works better than i'd like it to
#!/usr/bin/env python3
import numpy as np
# get this here: https://github.com/imh/hipsterplot/blob/master/hipsterplot.py
from hipsterplot import plot
def heuristic(costs, deltas, center_cost):
d = np.linalg.norm(deltas, axis=1)
c0 = costs[:, 0] - center_cost
@notwa
notwa / pokemon-swsh.csv
Last active December 30, 2019 16:14
Pokémon Gen 8: Sword & Shield Stats (scraped from serebii dot net)
id name form type1 type2 hp attack defense special_attack special_defense speed
1 Grookey Ordinary Grass None 50 65 50 40 40 65
2 Thwackey Ordinary Grass None 70 85 70 55 60 80
3 Rillaboom Ordinary Grass None 100 125 90 60 70 85
4 Scorbunny Ordinary Fire None 50 71 40 40 40 69
5 Raboot Ordinary Fire None 65 86 60 55 60 94
6 Cinderace Ordinary Fire None 80 116 75 65 75 119
7 Sobble Ordinary Water None 50 40 40 70 40 70
8 Drizzile Ordinary Water None 65 60 55 95 55 90
9 Inteleon Ordinary Water None 70 85 65 125 65 120
@notwa
notwa / stdio_hack.c
Created July 15, 2019 21:08
msvcrt stuff
/* WHAT: build code against the ancient Visual Studio 6.0 msvcrt.lib */
/* WHY: sizecoding; please refer to crinkler's manual.txt */
/* HOW: by replacing some of VS 14.0's definitions with VS 6.0's */
#define _NO_CRT_STDIO_INLINE 1
struct _iobuf {
char *_ptr;
int _cnt;
char *_base;
#!/usr/bin/env python3
# run like:
# python3 knapsack.py write | yices --logic=QF_BV | python3 knapsack.py read
from collections import namedtuple
# settings
# work our way up incrementally:
minimum_scores = (30000, 60000, 90000, 92000, 94000, 95000, 96000)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.