Skip to content

Instantly share code, notes, and snippets.

Rick van Hattem WoLpH

Block or report user

Report or block WoLpH

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View esp32_higrow_plant_moisture_sensor.yaml
esphome:
name: plant_moisture
platform: ESP32
board: esp32dev
wifi:
ssid: "spam"
password: "eggs"
# Enable logging
@WoLpH
WoLpH / to_json.sql
Created Apr 6, 2012
Some functions to convert arrays/hstore to json :)
View to_json.sql
CREATE OR REPLACE FUNCTION escape_json (text) RETURNS text AS $$
SELECT replace($1, '''', '\'''); $$ LANGUAGE SQL IMMUTABLE;
CREATE OR REPLACE FUNCTION to_json(text) RETURNS text AS $$
SELECT escape_json($1) $$ LANGUAGE SQL IMMUTABLE;
CREATE OR REPLACE FUNCTION to_json(KEY text, value text) RETURNS text AS $$
SELECT '''' || to_json($1) || ''': ''' || to_json($2) || ''''; $$ LANGUAGE SQL IMMUTABLE;
@WoLpH
WoLpH / inline_search.user.js
Last active Oct 2, 2019
Automatic javascript in-page search and highlight
View inline_search.user.js
// ==UserScript==
// @name Find - In-line search highlighter
// @namespace https://wol.ph
// @version 1.1
// @description Automatic javascript in-page search and highlight
// @author wolph
// @grant GM_addStyle
// @grant GM_unsafeWindow
// @grant GM_getValue
// @grant GM_setValue
View django_debug_toolbar_settings.py
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
@WoLpH
WoLpH / update_wan_ip.rsc
Created Mar 25, 2017
Mikrotik script to detect WAN IP updates and call scripts if it changes.
View update_wan_ip.rsc
:global wanInterface "wan1"
:global wanIP "$wanIP"
# Get the current IP on the interface
:local currentIPtemp [/ip address get [find interface="$wanInterface" disabled=no] address];
# IP without netmask
:local currentIP [:pick $currentIPtemp 0 ([:len $currentIPtemp]-3)];
:if ($currentIP != $wanIP) do={
@WoLpH
WoLpH / ibood.js
Created Jul 16, 2019
Show ibood prices for expired deals
View ibood.js
// ==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 / barman_exporter.conf
Last active Jul 11, 2019
Prometheus exporter for barman
View barman_exporter.conf
# 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 / activetable.js
Last active Jul 4, 2019 — 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
View activetable.js
// 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;";
View sonarr_with_websockets.nginx.conf
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;
You can’t perform that action at this time.