Skip to content

Instantly share code, notes, and snippets.

Avatar

Kyle Manna kylemanna

View GitHub Profile
@kylemanna
kylemanna / 0001-release-python-logfury-v1.0.1.patch
Last active Nov 13, 2021
Arch User Repository AUR Update for python-logfury
View 0001-release-python-logfury-v1.0.1.patch
From 94f64148ce295a4ba7b96e539f8f82798697fa71 Mon Sep 17 00:00:00 2001
From: Kyle Manna <kyle@kylemanna.com>
Date: Fri, 12 Nov 2021 20:03:13 -0600
Subject: [PATCH] release: python-logfury: v1.0.1
* Follow upstream.
* Use new git repo, old URL redirects.
* Use PyPI so pkg metadata is included.
* Update license file.
* Add test checks.
View hw_watch.sh
#!/bin/bash
#set -ex
base=/sys/class/drm/card0/device/hwmon/hwmon?
cd $base
get_hwmon() {
for i in fan1_input pwm1; do
echo hwmon: $i: $(cat $i)
done
for i in temp?_input ; do
@kylemanna
kylemanna / armory2cointracking.py
Last active Apr 17, 2021
#armory #cointracking #taxes #fml
View armory2cointracking.py
#!/usr/bin/env python3
"""Script to convert Bitcoin Armory transaction history to a format that Cointracking.info CSV"""
import argparse
import collections
import csv
import datetime
import json
import os
View 0_README.md

Commands to reproduce

$ curl -sSL https://testnet-api.helium.wtf/v1/validators/ | jq -S '[ .data[] | select(.status.listen_addrs) | select(.status.listen_addrs[] | contains("158.69.118.209")) ]' | tee validators-with-158.69.118.209-listener.json
$ curl -sSL https://testnet-api.helium.wtf/v1/validators/ | jq -S '[ .data[] | select(.status.listen_addrs) | select(.status.listen_addrs | length > 1) ]' | tee validators-with-length-greater-then-1.json

Counts

$ jq <validators-with-length-greater-then-1.json '. | length'                                                                                                                                                                                                                                                                      ✘ 127 
35
View gist:562be28c9b63a260b9a735f66f1bc414
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 Jan 13, 2021
Teensy 4.0 Arduino sketchy for TOSLINK (SPDIF) Input -> USB + SPDIF Output
View PassThroughAsyncSpdifWithUSB.ino
// 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
View 0001-digitalocean-synchronize-2.7-1.patch
From e685e2ee9ce193d573e571e3be353af48ea371ac Mon Sep 17 00:00:00 2001
From: Kyle Manna <kyle@kylemanna.com>
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 ++++++----
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])