Skip to content

Instantly share code, notes, and snippets.

Avatar

Rick van Hattem WoLpH

View GitHub Profile
@WoLpH
WoLpH / benchmark_attribute_access.py
Last active Jan 26, 2022
Benchmark namedtuple vs dataclass vs dict
View benchmark_attribute_access.py
import sys
import math
import random
import timeit
import typing
import dataclasses
import collections
repeat = 5
@WoLpH
WoLpH / google-cookie-consent.user.js
Last active Jul 2, 2022
Google Cookie Consent Remover
View google-cookie-consent.user.js
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 / 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 / mikrotik_dashboard.json
Created Dec 12, 2019
mikrotik exporter prometheus dashboard
View mikrotik_dashboard.json
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
@WoLpH
WoLpH / aida64_prometheus_exporter.py
Last active Dec 7, 2021
This prometheus exports all of your AIDA64 data to a Prometheus server so you can chart all of them using Grafana: https://grafana.com/grafana/dashboards/11339
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
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
View esp32_higrow_plant_moisture_sensor.yaml
esphome:
name: plant_moisture
platform: ESP32
board: esp32dev
wifi:
ssid: "spam"
password: "eggs"
# Enable logging
@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