Skip to content

Instantly share code, notes, and snippets.


Kyle Manna kylemanna

View GitHub Profile
kylemanna /
Last active Jun 25, 2020
Do you _need_ to call threading.Thread.join() to clean-up threads on python if they exit cleanly?
#!/usr/bin/env python3
"""Do you _need_ to call threading.Thread.join() to clean-up threads on python if they exit cleanly?
import threading
import time
def do_a_thing(idx):
print(f"starting {idx}")
kylemanna /
Created Jun 24, 2020
Monkey patch to fix ValueError('ZIP does not support timestamps before 1980')
class ZipInfoTimeless(zipfile.ZipInfo):
def __init__(self, *args, **kwargs):
# Patch year to 1980 if given a datetime before 1980. Also jump through hoops because tuples are
# immutable.
if 'date_time' in kwargs and kwargs['date_time'][0] < 1980:
dt = list(kwargs['date_time'])
dt[0] = 1980
kwargs['date_time'] = tuple(dt)
elif len(args) > 1 and args[1][0] < 1980:
dt = list(args[1])
kylemanna /
Last active Jun 19, 2020
Why does this KingWin KWCR-801U3 USB3 Card reader generate block_rq_complete errors when sitting idle on kernel 5.7.2-arch1-1?

Khada's Tone Board DAC via XMOS USB

Contents of card directory files under /proc/asound for reference.

File id

kylemanna /
Created May 16, 2020
Falcon + zipfile streaming proof of concept v2
#!/usr/bin/env python3
# Falcon + zipfile streaming content using os.pipe() to minimize RAM usage to a
# pipes worth of data.
# This test program generated a nearly 500 MB zip file with various compression
# arguments supported by the python3 standard library.
# Usage for debug webserver:
# $ ./
# Run this tool and feed it stuff.
# $ python3
# Emulate a remote client sending data:
# $ cat /dev/urandom | nc -u 7502
# Cancel netcat and try again, second attempt will fail because the source port
# likely changed (not guaranteed, but statistically likely)
View Dockerfile
# Proof of Concept
# Compose a docker image of an upstream images so that binaries packages in one
# image can be incorporated into another.
# TODO This copies, would be nice if there was a way to attach an image to a
# container like `docker run --volumes-from` does for containers.
# These FROMs used as a way to distribute files via an image
View auto-typeid-demangled.cpp
#include <iostream>
#include <cxxabi.h>
using namespace std;
// To execute C++, please define "int main()"
int main() {
auto words = { "Hello, ", "World!", "\n" };
int status;

Python Flatbuffer Object -> JSON

Crude proof of concept, criticism welcome.


$ flatc --python monster.fbs
$ python3 ./
FIXME: Equipped is a table
{"color": 0, "equipped": null, "hp": 300, "inventory": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "mana": 150, "name": "Orc", "path": [], "pos": {"x": 1.0, "y": 2.0, "z": 3.0}, "weapons": [{"damage": 3, "name": "Sword"}, {"damage": 5, "name": "Axe"}]}