Skip to content

Instantly share code, notes, and snippets.

@kquinsland
kquinsland / extract.py
Last active June 12, 2024 01:39
A quick and dirty set of python scripts to extract OpenSauce2024 schedule into JSON
import re
import json
import http.client
def fetch_js_file():
# Pulled directly from chrome.
# Failure to mimic a browser may result in a 403 Forbidden response
conn = http.client.HTTPSConnection("opensauce.com")
@kquinsland
kquinsland / readme.md
Created February 17, 2023 16:23
Quick "time-remaining" sensor for ESPHome

This is a quick and dirty cut/paste from an old ESPHome project that I never got around to writing up. It monitored several sensors and controlled a hydroponics system.

The specific snip above creates a text string that is published back to Home Assistant.

Hopefully it should be pretty easy to figure out what's going on.

The time remaining depended on several factors and could change arbitrarily. For this reason, I found it much simpler to update the time remaining sensor from other entities/components which is why the update_inteerval is never.

@kquinsland
kquinsland / probe.py
Created February 13, 2022 05:01
Decoding modbus data from generic chineese PH Controller pH-1800
"""
This is a simple script to communicate with a "generic" ph / ORP controller as seen on Ali Express
The listings for these devices will usually have a title like:
PH Controller pH-1800 Industrial On-line Ph Meter Electrode pH Tester Transmitter
E.G.: https://www.aliexpress.com/item/32993041598.html
The only documentation that I could get from the seller is a microsoft word file and a microsoft windows program that appears to
need an older copy of 32 bit windows. I was not able to get the program to run in a VM to sniff the modbus traffic and a quick look
@kquinsland
kquinsland / dummy0.netdev
Created December 3, 2019 02:54
How to get consul-agent and systemd.resolvd to co-exist peicefully and still be able to resolve *.consul hostsnames from within docker
# Creates a "dummy" network interface
# we'll configure this interface with a link-local address
# See: https://www.freedesktop.org/software/systemd/man/systemd.netdev.html
##
[NetDev]
Name=dummy0
Kind=dummy
@kquinsland
kquinsland / dump.py
Created November 13, 2019 04:48
HackADay SUPERCON 2019 event/talk data
# There are many ways to parse HTML w/ python... and this one is the least unpleasant
import bs4
# for pretty JSON
import simplejson as simplejson
def _parse_event(element):
### Keybase proof
I hereby claim:
* I am kquinsland on github.
* I am kquinsland (https://keybase.io/kquinsland) on keybase.
* I have a public key ASD2mZ8my9V1TPpFAJE7kH-oTKMfgZ-XilPK2yFJD2wQZQo
To claim this, I am signing this object: