Skip to content

Instantly share code, notes, and snippets.

View dmarkey's full-sized avatar
💭
why does this exist

David Markey dmarkey

💭
why does this exist
View GitHub Profile
import simple as umqtt
SERVER="dmarkey.com"
PORT=1883
CLIENT_ID="asafsd"
RELAY="/sys/class/leds/tp-link:blue:relay/brightness"
SET = "/home/switches/homeswitch1/set"
STATUS = "/home/switches/homeswitch1"
client = umqtt.MQTTClient(CLIENT_ID, SERVER, PORT)
def callback(topic, data):
@dmarkey
dmarkey / phonewatch_temp.py
Created December 8, 2017 22:41
This is a example of scraping the Irish PhoneWatch "mypages" to establish the temperature of the sensors in the house (not updated that often)
import requests
s = requests.Session()
s.post("https://mypages.phonewatch.ie/User/Login", {"userId": EMAIL, "password": PASSWORD})
panels = [ panel['PanelId'] for panel in s.get("https://mypages.phonewatch.ie/Panel/GetPanelList").json()]
sensors = sum([ s.get("https://mypages.phonewatch.ie/Panel/GetTempratures/{}".format(panel)).json() for panel in panels], [])
for sensor in sensors:
print("Sensor {} has temperature {}".format(sensor['Label'], sensor['Temprature']))
@dmarkey
dmarkey / microk8s.yaml
Created January 19, 2019 14:46
Microk8s Cloud Init
runcmd:
- "snap install microk8s --classic"
- "echo '-H tcp://0.0.0.0' >> /var/snap/microk8s/current/args/dockerd"
- "systemctl restart snap.microk8s.daemon-docker.service"
- "ln -s /var/snap/microk8s/current/docker.sock /var/run/docker.sock"
- "/snap/bin/microk8s.start"
- "/snap/bin/microk8s.status --wait-ready"
- "/snap/bin/microk8s.enable dns storage ingress"
- "/snap/bin/microk8s.status --wait-ready"
- "iptables -P FORWARD ACCEPT"
2024-03-25 22:44:06,766 DEBUG: Since support: 1
2024-03-25 22:44:06,778 INFO: Debugging script for s2idle on AMD systems
2024-03-25 22:44:06,778 INFO: 💻 Framework Laptop 13 (AMD Ryzen 7040Series) (Laptop) running BIOS 3.3 (03.03) released 10/17/2023 and EC unknown
2024-03-25 22:44:06,778 INFO: 🐧 Arch Linux
2024-03-25 22:44:06,778 INFO: 🐧 Kernel 6.9.0-rc1-1-mainline
2024-03-25 22:44:06,780 DEBUG: BAT1 charge level is 2499000 µAh
2024-03-25 22:44:06,780 INFO: 🔋 Battery BAT1 ( ) is operating at 98.21% of design
2024-03-25 22:44:06,780 INFO: Checking prerequisites for s2idle
2024-03-25 22:44:06,780 WARNING: 🚦Logs are provided via dmesg, timestamps may not be accurate over multiple cycles
2024-03-25 22:44:06,781 INFO: ✅ AMD Ryzen 5 7640U w/ Radeon 760M Graphics (family 19 model 74)
2024-04-12 22:51:42,006 INFO: Debugging script for s2idle on AMD systems
2024-04-12 22:51:42,006 INFO: 💻 Framework Laptop 13 (AMD Ryzen 7040Series) (Laptop) running BIOS 3.5 (03.05) released 03/29/2024 and EC unknown
2024-04-12 22:51:42,006 INFO: 🐧 Arch Linux
2024-04-12 22:51:42,006 INFO: 🐧 Kernel 6.9.0-rc2-1-mainline
2024-04-12 22:51:42,008 DEBUG: BAT1 charge level is 3298000 µAh
2024-04-12 22:51:42,008 INFO: 🔋 Battery BAT1 (NVT Framewo) is operating at 94.90% of design
2024-04-12 22:51:42,008 INFO: Checking prerequisites for s2idle
2024-04-12 22:51:42,008 INFO: ✅ Logs are provided via systemd
2024-04-12 22:51:42,008 INFO: ✅ AMD Ryzen 5 7640U w/ Radeon 760M Graphics (family 19 model 74)
2024-04-12 22:51:42,009 INFO: ✅ LPS0 _DSM enabled
2024-09-07 10:49:07,816 INFO: Debugging script for s2idle on AMD systems
2024-09-07 10:49:07,816 INFO: 💻 Framework Laptop 13 (AMD Ryzen 7040Series) (Laptop) running BIOS 3.5 (03.05) released 03/29/2024 and EC unknown
2024-09-07 10:49:07,816 INFO: 🐧 Arch Linux
2024-09-07 10:49:07,816 INFO: 🐧 Kernel 6.10.8-arch1-1
2024-09-07 10:49:07,817 DEBUG: BAT1 charge level is 3294000 µAh
2024-09-07 10:49:07,817 INFO: 🔋 Battery BAT1 (NVT FRANGWA) is operating at 101.38% of design
2024-09-07 10:49:07,817 INFO: Checking prerequisites for s2idle
2024-09-07 10:49:07,817 INFO: ✅ Logs are provided via systemd
2024-09-07 10:49:07,818 INFO: ✅ AMD Ryzen 5 7640U w/ Radeon 760M Graphics (family 19 model 74)
2024-09-07 10:49:07,818 DEBUG: SMT control: on