Skip to content

Instantly share code, notes, and snippets.

View poggenpower's full-sized avatar

Thomas Laubrock poggenpower

View GitHub Profile
@poggenpower
poggenpower / gist:4677935acebd0b13d36895357f15f14e
Last active October 28, 2025 16:47
Python Logging boilerplate
import logging
import logging.handlers
logging.basicConfig(level=logging.INFO)
logFormatter = logging.Formatter("%(asctime)s [%(filename)s:%(lineno)s - %(funcName)20s() ] [%(levelname)-5.5s] %(message)s")
#file_path = os.path.splitext(os.path.realpath(__file__))[0]
# fileHandler = logging.handlers.TimedRotatingFileHandler("{0}.log".format(file_path), when="d", interval=1, backupCount=5 )
# fileHandler.setFormatter(logFormatter)
@poggenpower
poggenpower / url2qr.py
Last active October 5, 2025 09:25
LibreOffice replace url by QR Code
import uno
import os
import tempfile
import sys
from com.sun.star.text.TextContentAnchorType import AS_CHARACTER
# this script is looking for all URLs matching URL_SEARCH_PREFIX and replace it with a QR code.
# See notes for dependencies.
# Define the link prefix to search for (RegEx search)
@poggenpower
poggenpower / .gitignore
Last active November 3, 2023 14:59
API wrapper for AQUA CSP
.aqua-token
payload*
post*
data*
@poggenpower
poggenpower / README.MD
Last active August 22, 2022 09:37
Viessmann to mqtt forwarder

Viessmann to MQTT forwarding

The files below is part of a larger framework and won't really run indpendent from it, but should be easy to convert into a standalone version.

External modules

Two external modules are requirend

  1. https://github.com/somm15/PyViCare for talking Viessmannn API
  2. https://github.com/poggenpower/mqtt_tree for wrapping MQTT communication (requires paho.mqtt.client) install via pip install git+https://github.com/poggenpower/mqtt_tree
@poggenpower
poggenpower / crawl.py
Created January 9, 2022 16:20
PyViCare crawl all values
import re
from PyViCare.PyViCare import PyViCare
# make sure call back URL in the Oauth client is set to: vicare://oauth-callback/everest
client_id = "42cfdf4e473fd436*************"
email = "[email protected]"
password = "********************"
vicare = PyViCare()
vicare.initWithCredentials(email, password, client_id, "token.save")
@poggenpower
poggenpower / default-duid.md
Last active August 27, 2022 19:38
Convert default-duid from dhclient6.leases to hex for DHCP Server assigments

DUID reset and conversion

Using DHCPv6 in ipv6 you don't assign setting per MAC but per DUID. On many linux flavours you will find the DUID in the firtst line of /var/lib/dhcp/dhclient6.XXXX.leases as default-duid where XXXX is the name of the interface. e.g. default-duid "\000\001\000\001'\305H\356\016\265<\373[\372"; a string with octal escaped bytes if it is not a printable ACSI charakter.

converting the DUID

Almost all DHCPv6 servers expect the DUID in hex notation. Following python3 script will convert it:

duid = "\000\001\000\001'\305H\356\016\265&lt;\373[\372"