Skip to content

Instantly share code, notes, and snippets.

View pak21's full-sized avatar

Philip Kendall pak21

  • Here in a private capacity
View GitHub Profile
@pak21
pak21 / two
Created April 4, 2024 11:02
Python and node silliness
1//1;print("Hello from Python");"""
console.log("Hello from node.js")/*
"""
#*/
@pak21
pak21 / break-my-json.py
Created October 24, 2023 21:43
Don't use regular expressions as a parser :)
#!/usr/bin/env python3
import json
import re
bad_json_string = '{"key1":"This string contains the word (None) in parentheses","key2":None}'
maybe_good_json_string = re.sub(r'(?<=\W)None(?=\W)|^None|None$', 'null', bad_json_string)
good_json = json.loads(maybe_good_json_string)
print(json.dumps(good_json))
@pak21
pak21 / orkish.py
Created April 13, 2022 11:21
Orks
#!/usr/bin/env python3
RACE_DATA = {
'ork': {
'colour': 'green'
},
'human': {
'colour': 'pinkish'
}
}
@pak21
pak21 / jug-pouring.py
Created April 15, 2021 19:29
Jug pouring problem
#!/usr/bin/env python3
CAPACITIES = [9, 7, 4, 2]
INITIAL_STATE = [9, 0, 0, 0]
TARGET_STATE = [3, 3, 3, 0]
todo = [INITIAL_STATE]
seen = {tuple(INITIAL_STATE): []}
while todo:

Keybase proof

I hereby claim:

  • I am pak21 on github.
  • I am pak21 (https://keybase.io/pak21) on keybase.
  • I have a public key ASDx3nPSWh-qvSLCYipPG2vPVEEiavfQLd7wcy6zeiNy4Ao

To claim this, I am signing this object:

diff --git a/z80/z80_ops.c b/z80/z80_ops.c
index aba785c8..670d2687 100755
--- a/z80/z80_ops.c
+++ b/z80/z80_ops.c
@@ -332,6 +332,7 @@ z80_do_opcodes( void )
END_CHECK
end_opcode:
+ printf("%04x\n", PC);
PC++; R++;