Skip to content

Instantly share code, notes, and snippets.

View adlerweb's full-sized avatar

Florian Knodt adlerweb

View GitHub Profile
adlerweb /
Last active March 14, 2024 13:06
FRITZ!Box Graylog Gateway
#!/usr/bin/env python3
# Free Open Source Software released under GPLv2
# see
# Author: Florian Knodt <>
# Original Author: Tilman Schmidt <>
# Contributor: Peter Pawn @ IP Phone Forum
# inspired by
# Requirements (for example via pip): graypy, requests
adlerweb /
Created September 30, 2023 11:18
Extract target URL from a mandrill tracking link. Based on
import sys
import json
import base64
import argparse
from binascii import Error as BinasciiError
from urllib.parse import urlparse, parse_qs, urlencode, urlunparse, parse_qsl
version = "0.1"
def urlsafe_base64_decode(s):
adlerweb / PKGBUILD
Last active August 28, 2023 23:53
s25rttr 0.9.5 GCC13 aur
#Maintainer: Matthias Mailänder <matthias at mailaender dot name>
#Contributor NiNjA <heinep at gmail dot com>
#Contributor float < at gmx dot de>
#Contributor adlerweb <aur at adlerweb dot info>
pkgdesc="Return to the Roots is a reimplementation of Settlers II (Die Siedler II) by BlueByte Software GmbH. Put the files from the original game in the folder (/usr/share/s25rttr/S2/)"
arch=('i686' 'x86_64')
adlerweb /
Created August 20, 2023 18:16
pip upgrade helper

When updating a venv to a newer python version you need to reinstall all locally install pip packages. This script can be pointed at the previous versions site-packages directory and output a string containing all previously installed packages, suitable to pass to pip install.

(Search-foo: Might help if you are running HomeAssistant inside a venv and, after upgrading python, integrations are not loaded)

adlerweb /
Created August 20, 2023 18:11
HomeAssistant: Convert command_line sensors to new (2023) format
#!/usr/bin/env python3
# pip install pyyaml pyyaml-include
import yaml
from yamlinclude import YamlIncludeConstructor
import os
import sys
base_dir = os.path.expanduser('~') + '/.homeassistant/'
adlerweb / .SRCINFO
Created August 3, 2023 10:40
pkgbase = zfs-linux-rc
pkgver = 2.2.0_rc3_6.4.7.arch1.2
pkgrel = 1
url =
arch = x86_64
license = CDDL
makedepends = linux-headers=6.4.7.arch1-2
depends = kmod
depends = zfs-utils-rc=2.2.0_rc3
depends = linux=6.4.7.arch1-2
adlerweb / .SRCINFO
Created August 3, 2023 09:57
pkgbase = zfs-utils-rc
pkgdesc = Kernel module support files for the Zettabyte File System.
pkgver = 2.2.0_rc3
pkgrel = 1
url =
install = zfs-utils.install
arch = x86_64
groups = archzfs-linux-rc
license = CDDL
makedepends = python
adlerweb /
Created June 18, 2023 19:25
Send SMS to device using API/CURL.
curl -u apikey:<API KEY FROM DASHBOARD API TAB> --include \
--request POST \
--header "Content-Type: application/json" \
--data-binary "{
\"body\": \"Hello world\"
}" \
adlerweb / ha.php
Created October 1, 2022 17:45
Homeassistant/PHP: Read sensor via REST API
function getHA($id) { //ID to read - for example
$key = ''; //Long-lived access token, can be obtained in HomeAssistant UI→Profile
$url = ''; //URL to your HA including trailing /
$opts = [
"http" => [
"method" => "GET",
"header" =>
"Content-Type: application/json\r\n" .
adlerweb /
Last active June 25, 2022 11:18
Unattended deployment of yay on a system. Useful when generating VMs on the fly.
version=$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags '*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3 | tr -d 'v')
tmp=$(mktemp -d)
if [ -d "$tmp" ]
if [ "$(ls -A $tmp)" ]; then
echo "Oops. Temporary directory $tmp is not empty"