Skip to content

Instantly share code, notes, and snippets.

View wolph's full-sized avatar

Rick van Hattem wolph

View GitHub Profile
DEBUG_TOOLBAR = DEBUG
if DEBUG_TOOLBAR:
def show_toolbar(request):
if request.user.is_superuser:
return True
elif request.META['REMOTE_ADDR'] in INTERNAL_IPS:
return True
return False
esphome:
name: plant_moisture
platform: ESP32
board: esp32dev
wifi:
ssid: "spam"
password: "eggs"
# Enable logging
@wolph
wolph / inline_search.user.js
Last active July 10, 2023 10:45
Automatic javascript in-page search and highlight
// ==UserScript==
// @name Find - In-line search highlighter
// @namespace https://wol.ph
// @version 1.2
// @description Automatic javascript in-page search and highlight
// @author wolph
// @grant GM_addStyle
// @grant GM_unsafeWindow
// @grant GM_getValue
// @grant GM_setValue
@wolph
wolph / ibood.js
Created July 16, 2019 15:53
Show ibood prices for expired deals
// ==UserScript==
// @name ibood old prices
// @namespace http://tampermonkey.net/
// @version 0.1
// @description add prices to old/expired ibood deals
// @author You
// @match https://www.ibood.com/*
// @grant none
// ==/UserScript==
@wolph
wolph / activetable.js
Last active July 4, 2019 15:27 — forked from stevesouders/activetable.js
ActiveTable is a bookmarklet that makes any table sortable. It also allows you to remove columns, and it remembers the removed columns for next time. Use alt+click to UNhide all columns (and clear memory). This version sorts numerically if possible and if that's not possible it puts the numbers first and letters after
// ActiveTable - a bookmarklet to make tables sortable and editable
function init() {
var aHrows = getHrows();
var numHrows = aHrows.length;
var aHidden = getHiddenColumns();
ATpopup = document.createElement("div");
ATpopup.style.cssText = "position: absolute; visibility: hidden; padding: 0; font-family: Arial; background-color: rgba(255, 255, 255, 0.9); border-radius: .5em; text-align: center; box-shadow: .05em .05em .5em #00C;";
upstream sonarr {
server 127.0.0.1:1234;
}
server {
server_name sonarr;
include includes.d/restricted.conf;
include includes.d/ssl_server.conf;
include includes.d/proxy.conf;
@wolph
wolph / barman_exporter.conf
Last active December 6, 2023 18:50
Prometheus exporter for barman
# vim: set ft=dosini:
# Supervisord config for the barman exporter
[program:barman_exporter]
environment=PATH=/usr/local/bin:%(ENV_PATH)s
command=/usr/local/bin/env python3 /var/barman/barman_exporter.py
user=barman
autostart=true
stopasgroup=true
killasgroup=true
@wolph
wolph / dreamscreen_sidekick_emulator.py
Last active January 16, 2024 20:12
This script emulates the Dreamscreen sidekick and displays the output on your screen. It requires a shell that supports full-rgb ansi. More info can be found here: http://dreamscreen.boards.net/post/6271/thread
#!/usr/bin/env python
import enum
import types
import aioudp
import struct
import asyncio
import blessings
from datetime import datetime
@wolph
wolph / hcsr04.ino
Created December 30, 2018 18:59
Simple arduino HC-SR04 (HCSR04) distance detection using interrupts for low latency measurements
#include <Arduino.h>
// Uses https://github.com/PaulStoffregen/TimerOne for sending on a regular interval
#include <TimerOne.h>
// ECHO pin, needs to be a pin that supports interrupts!
#define ULTRASONIC_PIN_INPUT 2
// TRIG pin, can be any output pin
#define ULTRASONIC_PIN_OUTPUT 3
// update interval, make sure to keep it above 20ms
#define ULTRASONIC_TIMER_US 50000