Skip to content

Instantly share code, notes, and snippets.

@maxried
maxried / 00-deb822
Last active November 14, 2022 08:10
Common deb822 for Ubuntu
These are a few new-style deb822 sources files. Just drop them into /etc/apt/sources.list.d. No need to import any key. Meant for use with Ubuntu, Debian 11 doesn't support embedded keys.
#!/bin/sh
if [ "$#" -eq 0 ] ; then
cat <<EOF
{
"data":
[
{
$(for a in `dmsetup status | grep -E "^.+: [0-9]+ [0-9]+ cache .+$" | cut -d: -f1`; do echo " \"{#DEVICE_NAME}\": \"$a\"" ; done)
}
#!/usr/bin/env python3
from ipaddress import IPv4Network, collapse_addresses
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from typing import List
def main():
parser = ArgumentParser(description='Create excluding IPv4 routing tables, and simplify IPv4 routing tables.',
formatter_class=RawDescriptionHelpFormatter,
@maxried
maxried / $README.md
Last active January 12, 2024 10:43
Automatically Sign Kernels After Installation

This script goes into /etc/kernel/postinst.d. You have to make it executable by root, e.g. chown root:root /etc/kernel/postinst.d/00-signing ; chmod u+rx /etc/kernel/postinst.d/00-signing. It assists you with automatically signing freshly installed kernel images using the machine owner key in a way similar to what dkms does. This is mainly useful if you want to use mainline kernels on Ubuntu on Secure Boot enabled systems. This needs shim-signed to be set up. If you have questions this one might help you: While I made this for Ubuntu 20.04, it should work on current Debian based distributions. YMMV.

@maxried
maxried / README.md
Created June 18, 2020 06:24
Unbrick Your ISDT C4 or Compatible Devices

I'm not responsible if you set anything on fire, or hurt someone, or anything bad that happens after you used this guide. Broken chargers are dangerous devices, escpecially if you charge Lithium batteries.

Also, keep in mind that if you use this on a charger that is actually incompatible, you certainly break it. If you use this on a charger that is a branded version of the ISDT C4, it will be become an unbranded version. If this is not what you desire, e.g. as it will void your warranty, don't use it. (Though, if you're reading this, I guess the warranty is already gone...)

Using the old Windows updater for the ISDT C4 you can try to unbrick your ISDT C4 or compatible devices. If the updater refuses to update your device because of The device not support., you can force it to by opening the file Config\config.ini, changing the configuration variable Privacy=01 to Privacy=FF, saving, and restarting the updater. The title bar of the updater should now read (Factory mode). It will now recognize y

#!/usr/bin/env bash
ZABBIX_URL="https://zabbix"
ZABBIX_USER="api-user-that-has-admin-and-rw-access-to-the-items-to-check.-frontend-access-is-not-necessary."
ZABBIX_PASS="password"
if [ ! "$*" ]; then
echo "$0 <item-id> <item-id> ..."
exit 255
fi
@maxried
maxried / $Zabbix-Docker-Build.md
Last active September 29, 2020 13:22
Compile latest Zabbix for Debian from the Repositories using Docker

If you need to compile your own deb packages for Zabbix, this gist may help you.

My motivation was that there are no official repositories for Debian ARM. If you run Debian on your Raspbery Pi and want to have an up to date Zabbix Agent or Proxy, the official Zabbix repositories won't be of much help. Either you install the 32 bit version Raspbian version, which might come with broken dependencies on your geniune Debian installation, or you use the ancient Zabbix version from the official Debian repositories. Unfortunately you have to have Docker installed to run this, but I didn't want to clutter the storage on my Raspberry Pi. It

@maxried
maxried / README.md
Created January 17, 2020 14:46
Wireguard in initrd

These scripts allow you to have a wireguard connection in your initrd. Make sure you have wireguard installed on your system and a busybox which supports ip, nslookup. If it does not work, change the copy_exec line for busybox in the hook and replace it with a better one. It reads /etc/wireguard/initramdisk.conf and expects at least one comment specifying all ip addresses like so: # Address = 1.2.3.4/12. Tested on Ubuntu 19.10.

#!/usr/bin/env bash
oid=""
community=""
host=""
label=""
unit=""
while getopts "C:H:o:l:u:" o; do
case "${o}" in
@maxried
maxried / decode_post_datamtrix.py
Last active August 27, 2019 07:55 — forked from 5263/decode_post_datamtrix.py
Doppeltes case label
#!/usr/bin/env python
import sys
import datetime
frankierart={
0x01:'Stampit 2003',
0x02:'0x02???',
0x03:'Frankit',
0x05:'Filiale',
0x07:'Frankierservice Infopost/Infobrief',
0x08:'Premiumadress',