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
@WoLpH
WoLpH / barman_exporter.conf
Last active Apr 23, 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 / dreamscreen_sidekick_emulator.py
Last active Mar 3, 2019
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
View dreamscreen_sidekick_emulator.py
#!/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 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 etc.yaml
# - alias: close curtains
# trigger:
# - event: sunset
# platform: sun
# condition: []
# action:
# - data:
# entity_id: cover.qubino_zmnhod1_flush_shutter_dc_level
# service: automation.turn_off
@WoLpH
WoLpH / non_blocking_read.py
Created Sep 19, 2018
Read all available data from file handle and return (with optional timeout)
View non_blocking_read.py
def read(fh, timeout=0):
output = []
while select.select([fh], [], [], timeout)[0]:
output.append(fh.read(1))
return ''.join(output)
@WoLpH
WoLpH / colortest.py
Last active Oct 26, 2018
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'''
@WoLpH
WoLpH / sj1221.ino
Created Apr 2, 2018
SJ1221 led strip test
View sj1221.ino
/* vim: ts=8
Example code for the SJ1221 control protocol
Based on: http://wp.josh.com/2014/05/11/ws2812-neopixels-made-easy/
*/
// Change this to be at least as long as your pixel string (too long will work fine, just be a little slower)
#define PIXELS 96*11 // Number of pixels in the string
// color multiplier since we've got 0-4096 instead of 0-256
@WoLpH
WoLpH / main.py
Last active Jan 18, 2018 — forked from jorenham/main.py
Best exception handling in Python
View main.py
import sys
import webbrowser
def main():
return 42/0
def excepthook(type_, value, traceback):
webbrowser.open_new_tab('https://stackoverflow.com/search?q=[python] {} {}'.format(type_, value))
@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={
View __init__.py
# -*- coding: utf-8 -*-
#
# This file is a plugin for EventGhost.
# Copyright (C) 2012 Walter Kraembring <krambriw>.
#
# ALL RIGHTS RESERVED. The development of this software is based on information
# provided by RFXCOM and is protected under Netherlands Copyright Laws and
# Treaties and shall be subject to the exclusive jurisdiction of the Netherlands
# Courts.
# This pluginís source code and other versions eventually based on it may be
You can’t perform that action at this time.