Skip to content

Instantly share code, notes, and snippets.

View dafvid's full-sized avatar
🍍

David Stenwall dafvid

🍍
View GitHub Profile
@dafvid
dafvid / upgrade_python_packages.sh
Last active February 6, 2026 11:12
FreeBSD bump python pkg versions
#!/bin/sh
# Usage: sh upgrade_python_packages.sh [FROM] [TO]
# Default: 39 -> 311
# Example: sh upgrade_python_packages.sh 310 312
FROM=${1:-39}
TO=${2:-311}
for i in $(pkg query -g %n "py${FROM}-*"); do
base="${i#py${FROM}-}"
@dafvid
dafvid / hass
Created December 21, 2022 22:45
Homeassistant FreeBSD rc-script
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: hass
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add these lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
@dafvid
dafvid / main.py
Created January 4, 2022 19:38
Micropython async reconnect
import uasyncio # upip install this if not present
from umqtt.simple import MQTTClient
import webrepl
# you only need to connect once
# it's more like WiFi settings then connect
sta = network.WLAN(network.STA_IF)
sta.connect('<SSID>', '<PASSWD>')
mqtt = MQTTClient(<MQTT_SETTINGS>)