Skip to content

Instantly share code, notes, and snippets.

View kylemanna's full-sized avatar

Kyle Manna kylemanna

View GitHub Profile
import socket
UDP_IP = '::'
UDP_PORT = 5005
sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
sock.bind((UDP_IP, UDP_PORT))
connection_oriented = True
@kylemanna
kylemanna / PassThroughAsyncSpdifWithUSB.ino
Last active May 1, 2023 05:58
Teensy 4.0 Arduino sketchy for TOSLINK (SPDIF) Input -> USB + SPDIF Output
// Teensy Library to stream Optical TOSLINK input simultaenously to two outputs:
// * USB Audio
// * SPDIF
//
//
// Test Setup:
// * Input: Google Chromecast Audio TOSLINK Optical @ 48 KHz -> PLR135/T10 -> Teensy SPDIF_IN
// * INput: USB serial console to set gain
// * Output: Teensy SPDIF_OUT -> Khadas Tone Board RCA SPDIF input -> Analog Speaker Amp
// * Output: USB -> Arch Linux (5.10 kernel) with Pulseaudio + Audacity
From e685e2ee9ce193d573e571e3be353af48ea371ac Mon Sep 17 00:00:00 2001
From: Kyle Manna <[email protected]>
Date: Tue, 29 Dec 2020 09:10:32 -0800
Subject: [PATCH] digitalocean-synchronize 2.7-1
* Bump to latest version.
* Resolved issue with IPv6 config not working for me.
---
.SRCINFO | 8 ++++----
PKGBUILD | 10 ++++++----
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 June 25, 2020 16:41
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}")
time.sleep(1)
@kylemanna
kylemanna / python-fix-zipinfo-1980.py
Created June 24, 2020 23:16
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
kylemanna / 00_README.md
Last active June 19, 2020 17:27
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

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 00:08
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:
# $ ./app.py