Skip to content

Instantly share code, notes, and snippets.

Avatar

Kyle Manna kylemanna

View GitHub Profile
View gist:3048a02cff9c64468297163080be3b56
esphome:
name: esp_tdisplay
platform: ESP32
board: featheresp32
wifi:
ssid: "some ssid"
password: "wifipassword"
# Enable fallback hotspot (captive portal) in case wifi connection fails
@kylemanna
kylemanna / abandon-threads.py
Last active Jun 25, 2020
Do you _need_ to call threading.Thread.join() to clean-up threads on python if they exit cleanly?
View abandon-threads.py
#!/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}")
time.sleep(1)
@kylemanna
kylemanna / python-fix-zipinfo-1980.py
Created Jun 24, 2020
Monkey patch to fix ValueError('ZIP does not support timestamps before 1980')
View python-fix-zipinfo-1980.py
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
kylemanna / 00_README.md
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?
View topping-mx3.md
View khadas-tone-board-on-linux-via-xmos.md

Khada's Tone Board DAC via XMOS USB

https://www.khadas.com/tone

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

File id

Control
@kylemanna
kylemanna / falcon-zipfile-stream.py
Created May 16, 2020
Falcon + zipfile streaming proof of concept v2
View falcon-zipfile-stream.py
#!/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:
# $ ./app.py
View connected-udp-datagram.py
# Run this tool and feed it stuff.
# $ python3 udp-test.py
#
# Emulate a remote client sending data:
# $ cat /dev/urandom | nc -u 127.0.0.1 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;
You can’t perform that action at this time.