Skip to content

Instantly share code, notes, and snippets.

View sumnerboy12's full-sized avatar

Ben Jones sumnerboy12

View GitHub Profile
@samuel
samuel / supervisor-errmail.py
Created December 17, 2010 02:50
Supervisor event listener that emails on a proces writing to stderr
#!/usr/bin/env python
import os
import smtplib
import sys
import time
from optparse import OptionParser
from supervisor import childutils
@adamzaninovich
adamzaninovich / QuadEncoder.cpp
Created September 25, 2012 18:33
Code used on demo project shown at (http://www.youtube.com/watch?v=a1M5kirA2_8) and (http://www.youtube.com/watch?v=epJ3aSzrsXQ) Includes climate sensing, logging to SD card, HTTP server with JSON output, LCD display with settings menus.
/**
* QuadEncoder.cpp - Library for reading moves from a quadrature rotary encoder
* Created by Pedro Rodrigues ([email protected]) 9, January of 2010
* Released into the public domain.
*/
#include "Arduino.h"
#include "QuadEncoder.h"
QuadEncoder::QuadEncoder(int pin1, int pin2)
@jpmens
jpmens / holymoly.md
Last active March 11, 2022 16:10
Create openHAB (Jetty) keystore from OpenSSL certificate/key pair

Configure openHAB keystore to use our own TLS server certificates

1. Launch openHAB, and verify that the shipped cert is in effect

$ openssl s_client -connect localhost:8443
[lots of stuff truncated]
-----END CERTIFICATE-----
subject=/C=Unknown/ST=Unknown/L=Unknown/O=openHAB/OU=Unknown/CN=openhab.org
issuer=/C=Unknown/ST=Unknown/L=Unknown/O=openHAB/OU=Unknown/CN=openhab.org
@mazzmn
mazzmn / temp4sensor.py
Last active January 8, 2019 16:55
ChannelOneTempMonitor
#!/usr/bin/python
#Based on Adafruit's Raspberry Pi Lesson 11 Temperature sensing tutorial by Simon Monk
#Modified by Tim Massaro 2/2014
#This script now uses a Raspberry Pi, Adafruit PiPlate LCD and
#two DS18B20 temp sensor to monitor the freezer and fridge unit at Channel One Food Shelf
#significant changes
#adapt for 2 sensors
#Display temperature on the LCD
#sendtext messages when temperature is out of range
@dreamcat4
dreamcat4 / tvheadend.md
Last active October 6, 2023 09:20
How to Install TvHeadend on FreeBSD, FreeNAS / NAS4Free / pfSense, with Finch / Qjail 3.5 - http://dreamcat4.github.io/finch/

NOTICE - TvHeadend Internal Grabbers don't work on FreeBSD yet. There is some work in progress updating the FreeBSD port to enable that.

TvHeadend How-To

How to install TvHeadend. Most of these commands can just be copy-pasted.

Install drivers for your TV Tuner device

# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@Nihisil
Nihisil / jail.local
Last active September 5, 2023 06:20
Send notifications to the Slack from fail2ban
...
action_with_slack_notification = %(banaction)s[name=%(__name__)s, port="%(port)$
slack[name=%(__name__)s]
action = %(action_with_slack_notification)s
...

Using Let's Encrypt with openHAB

You can use a FREE certificate from [Let's Encrypt] (https://letsencrypt.org/) to secure your [openHAB] (http://www.openhab.org/) installation.

This quick information page is based on detail from https://gist.github.com/jpmens/8029383.

To start, get the Let's Encrypt client as shown here https://letsencrypt.org/howitworks/. I checked it out into /root/letsencrypt.

Pick a password for your keystore. Use the commandline in step 9 of [jpmen's tutorial] (https://gist.github.com/jpmens/8029383) to create jetty passwords and update the jetty.xml.

object Host "me.owntracks.alr.st" {
import "owntracks-host"
}
object Host "5s.owntracks.alr.st" {
import "owntracks-host"
}
object Host "sm.owntracks.alr.st" {
import "owntracks-host"
@wpottier
wpottier / jail.local
Created June 17, 2016 09:02
Fail2ban -> slack
# ban & send a notification on slack
action_with_slack_notification = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
slack[name=%(__name__)s, dest="%(destemail)s", protocol="%(protocol)s", chain="%(chain)s", sendername="%(sendername)s"]
# Choose default action. To change, just override value of 'action' with the
# interpolation to the chosen action shortcut (e.g. action_mw, action_mwl, etc) in jail.local
# globally (section [DEFAULT]) or per specific section
action = %(action_with_slack_notification)s