Skip to content

Instantly share code, notes, and snippets.

View kylenahas's full-sized avatar

Kyle kylenahas

View GitHub Profile
on Button#Switch do
if [State#State]=0
gpio,15,1
else
gpio,15,0
endif
endon
On MQTT#Connected do
// **** switch on gpio 15 ****
@s-light
s-light / olad.service
Last active April 28, 2022 16:55
olad systemd service file
# based on examples found at
# https://learn.adafruit.com/running-programs-automatically-on-your-tiny-computer/systemd-writing-and-enabling-a-service
# https://medium.com/@johannes_gehrs/getting-started-with-systemd-on-debian-jessie-e024758ca63d
# https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
# https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before=
# https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Wants=
# copy to target with:
# sudo cp olad.service /etc/systemd/system/
# enable service
@timsavage
timsavage / websocket_server.py
Last active June 27, 2023 16:58
Simple example of a websocket server with Tornado
# While this code still works, I would recommend using Fast API for websockets in modern applications.
# See: https://fastapi.tiangolo.com/advanced/websockets/
# Note this is targeted at python 3
import tornado.web
import tornado.httpserver
import tornado.ioloop
import tornado.websocket
import tornado.options