Skip to content

Instantly share code, notes, and snippets.

Avatar

Rick van Hattem WoLpH

View GitHub Profile
@WoLpH
WoLpH / hcsr04.ino
Created Dec 30, 2018
Simple arduino HC-SR04 (HCSR04) distance detection using interrupts for low latency measurements
View hcsr04.ino
#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
View esp32_higrow_plant_moisture_sensor.yaml
esphome:
name: plant_moisture
platform: ESP32
board: esp32dev
wifi:
ssid: "spam"
password: "eggs"
# Enable logging
View aida64_prometheus_exporter.py
import re
import mmap
import typing
import hashlib
import logging
import argparse
import datetime
import ipaddress
import dataclasses
import xml.etree.cElementTree as ET
@WoLpH
WoLpH / colortest.py
Last active Jun 20, 2020
Testing 256 color shells using background colors and automatic shell width detection
View colortest.py
#!/usr/bin/env python
from __future__ import print_function
import os
import shutil
import subprocess
def get_width(default=80):
'''Attempt to detect console width and default to 80'''
View decode_kubernetes_secrets.py
#!/usr/bin/env python3
'''
A very simple kubernetes secrets dump tool. You can use it like this:
# kubectl get secret -o yaml -A | python decode_secrets.py
'''
import sys
import yaml
import base64
@WoLpH
WoLpH / whitelist_ssl_certificates_chrome.sh
Last active May 30, 2020
Easily whitelisting SSL certificates in Chrome under OS X
View whitelist_ssl_certificates_chrome.sh
#!/usr/bin/env bash -e
HOST=$(echo "$1" | sed -E -e 's/https?:\/\///' -e 's/\/.*//')
if [[ "$HOST" =~ .*\..* ]]; then
echo "Adding certificate for $HOST"
echo -n | openssl s_client -connect $HOST:443 -servername $HOST \
| sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \
| tee "/tmp/$HOST.cert"
sudo security add-trusted-cert -d -r trustRoot \
@WoLpH
WoLpH / inline_search.user.js
Last active Mar 29, 2020
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.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 / add_to_nzbget.user.js
Created Feb 25, 2020
Add nzbindex results to nzbget server
View add_to_nzbget.user.js
// ==UserScript==
// @name add-to-nzbget
// @namespace http://wol.ph
// @version 0.1
// @description Add nzbs to nzbget
// @author You
// @match https://www.nzbindex.com/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// @grant GM_addStyle
// @grant GM_unsafeWindow
@WoLpH
WoLpH / barman_exporter.conf
Last active Jan 29, 2020
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
You can’t perform that action at this time.