Skip to content

Instantly share code, notes, and snippets.

@schorschii
schorschii / find_downgradable_packages.py
Last active September 16, 2025 15:28
This is the apt downgrade logic of the mintupgrade GUI tool - useful if you want to upgrade many computers via CLI. After changing apt's sources.list and executing `apt dist-upgrade`, you need to downgrade some packages, e.g. base-files to show the correct Mint version in system info dialog (/etc/lsb-release).
#!/usr/bin/python3
import apt
import apt_pkg
import aptsources.sourceslist
import subprocess
# Returns a tuple containing two lists
# The first list is a list of orphaned packages (packages which have no origin)
# The second list is a list of packages which version is not the official version (this does not
#!/bin/python3
# This script creates KEYDB.cfg file content (~/.config/aacs/KEYDB.cfg)
# for your personal backup by parsing the cached keys which are
# automatically stored by libaacs in ~/.cache/aacs when a Bluray disc
# could be successfully decrypted with a valid host certificate.
# The decrypted individual disc keys can be used to play the disc at any time later,
# even if your host certificate gets revoked in your drive
# (by inserting a disc with new MKB [MediaKeyBlock] version).
@schorschii
schorschii / netgear-ip-set.py
Last active May 21, 2025 11:49
(Re-)Configure the IP address of NETGEAR print servers.
#!/usr/bin/python3
# With this script, you can configure a new IP address for NETGEAR PS101(v2) print servers.
# Just connect the print server via Ethernet to your computer and execute the script,
# it will send an UDP packet over all of your network interfaces:
# ./netgear-ip-set.py PSxxxxxx 192.168.0.25 255.255.255.0 192.268.0.1
#
# Replace PSxxxxxx with your device name as printed on the back label of your device.
# It is not necessary to know the old IP address or to be in the same IP subnet with your computer;
# the NETGEAR device just needs to be in the same physical network or VLAN.
@schorschii
schorschii / sid_to_uid.py
Last active January 9, 2025 13:43
SSSD's AD objectSID to Linux UID mapping algorithm, implemented in Python
#!/bin/python3
import sys
SSS_IDMAP_DEFAULT_LOWER = 200000
SSS_IDMAP_DEFAULT_UPPER = 2000200000
SSS_IDMAP_DEFAULT_RANGESIZE = 200000
def murmur3_32(data, seed = 0):
@schorschii
schorschii / Github-Sponsorship-Created-Webhook.txt
Last active July 1, 2024 15:47
Github Sponsorship Webhook Example (when a new sponsorship was created)
{
"action": "created",
"sponsorship": {
"node_id": "xxx",
"created_at": "2024-06-14T15:34:44+00:00",
"sponsorable": {
"login": "<github-username>",
"id": 123,
"node_id": "xxx",
"avatar_url": "xxx",
@schorschii
schorschii / Schorschii's OpenLDAP Setup.md
Last active June 14, 2025 12:54
OpenLDAP Cheat Sheet

OpenLDAP Cookbook

Tested under Ubuntu 22.04

Abbreviations

  • "slapd" = Stand-alone LDAP Daemon
  • "CN" = Common Name (name of an LDAP object)
  • "DN" = Distinguished Name (definite path to an LDAP object)
  • "OU" = Organizational Unit (container for LDAP objects, e.g. a department of your company)
  • "LDIF" = LDAP Data Interchange Format
  • Class = "template" for an LDAP object
@schorschii
schorschii / index.php
Last active January 30, 2024 15:26
Simple WordPress plugin to set the "envelope sender" correctly, so that e.g. Gmail accepts them. Just create a folder "wp-content/plugins/fix-mail-sender" and put this file there. Don't forget to activate the plugin and enjoy. Note: if you are on Hetzner, you need to create a mailbox "[email protected]" too to make it work. Don't ask why.
<?php
/**
* Plugin Name: Fix Mail Sender
* Plugin URI: https://georg-sieber.de
* Description: Sets the envelope sender correctly to the "From" header address to enable mail delivery to Gmail from managed webservers.
* Version: 1.0
* Author: Georg Sieber
* Author URI: https://georg-sieber.de
* License: free
*/
@schorschii
schorschii / sato-graphic-converter.php
Last active November 27, 2023 14:07
SATO Label Printer SBPL Graphic Converter
<?php
# SATO Graphic Converter, (c) Georg Sieber 2023, https://github.com/schorschii
# open source implementation of the SATO label printer graphic format,
# generates SBPL command to print arbitrary graphic given as parameter
# supports hex and binary (more performant) format
# usage: php sato-graphics-converter.php 192.168.1.50 image.jpg 250 100
# important: the printer won't print if the image location is not on your label size, so please choose appropriate X/Y coordinates
@schorschii
schorschii / HPUnlocker.py
Last active September 15, 2025 00:07
HP Unlocker: Remove admin passwords from HP UEFI/BIOS images. Need help? Contact me for professional BIOS repair services in Germany: https://georg-sieber.de/?page=blog-bios
#!/usr/bin/python3
# Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
import mmap, shutil, sys
if len(sys.argv) != 2:
print('Please provide a HP BIOS image .bin file as first parameter!')
sys.exit(1)
path = sys.argv[1]
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.provider.ContactsContract;
import android.util.Log;