Skip to content

Instantly share code, notes, and snippets.

@David-Lor
David-Lor / mqtt_sub_template.sh
Created November 22, 2019 15:30
Bash MQTT subscribe (mosquitto_sub) with callback
#!/bin/sh
mosquitto_sub -h localhost -t test -v | while read -r topic payload
do
echo "Rx @ ${topic}: ${payload}"
done
@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
@magopian
magopian / fix_permissions.py
Created November 19, 2013 11:00
Django admin command to "fix permissions" (create them properly for proxy models). This is needed because of the following bug in Django (not fixed as of 1.6): https://code.djangoproject.com/ticket/11154
# -*- coding: utf-8 -*-
"""Add permissions for proxy model.
This is needed because of the bug https://code.djangoproject.com/ticket/11154
in Django (as of 1.6, it's not fixed).
When a permission is created for a proxy model, it actually creates if for it's
base model app_label (eg: for "article" instead of "about", for the About proxy
model).