Skip to content

Instantly share code, notes, and snippets.

View binwiederhier's full-sized avatar

Philipp C. Heckel binwiederhier

View GitHub Profile
@binwiederhier
binwiederhier / README.md
Created August 8, 2026 08:32
Fix for mautrix-discord bot reconnect loop / Discord token resets since 2026-08-07 (websocket close 4002: Discord rejects beeper/discordgo QoS heartbeat on bot connections)

Fix: mautrix-discord bot reconnect loop / token resets since 2026-08-07 (websocket close 4002)

Since 2026-08-07 ~17:00 UTC, mautrix-discord bridges using a bot token fail to stay connected to Discord. The gateway connection dies about one second after READY, the bridge reconnect-loops every few seconds, and after ~1000 connection attempts Discord force-resets the bot token and emails you:

It appears your bot has connected to Discord more than 1000 times within a short time period. Since this kind of behavior is usually a result of a bug we have gone ahead and reset your bot's token.

@binwiederhier
binwiederhier / weather_alert.py
Last active November 29, 2023 01:43
Alerts via ntfy.sh with a "pipe freeze alert" when the temperature in the next 3 days falls below a threshold
#!/usr/bin/env python3
import json
from datetime import datetime
import requests
latitude = 25.2510383
longitude = 55.2936404
threshold = -4
ntfy_url = "https://ntfy.sh/mytopic"
import json
import os
import requests
def download_file(url, file_path):
response = requests.get(url)
with open(file_path, 'wb') as file:
file.write(response.content)
def find_new_entries(current_file, previous_file):
module bla
go 1.18
require github.com/urfave/cli/v2 v2.4.8
require (
github.com/BurntSushi/toml v1.1.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
#!/bin/bash
PATH="$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/phil/.bin"
RSYNC_ROOT_EXCLUDES="
--exclude /cdrom/
--exclude /dev/
--exclude /exports/
--exclude /proc/
--exclude /run/
--exclude /sys/
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
apt-get install debootstrap
fdisk /dev/sdb
o
n
<return>
<return>
<return>
w
# apt-add-repository ppa:zfs-native/stable
# apt-get update
# apt-get install ubuntu-zfs
# apt-get install debootstrap
HOST=vm1
DISKS="/dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21UNSAG310692M"
zpool create \
-f \
@binwiederhier
binwiederhier / README.md
Created January 13, 2016 00:22
Unattended single disk resize
  1. Create /usr/share/initramfs-tools/hooks/parttools as above
  2. Run update-initramfs -u
  3. Reboot
  4. Type e on the Grub2 boot menu entry
  5. Add break=mount to the kernel line
  6. In initramfs, run this (assuming /dev/sda1 is the to-be-resized disk):
e2fsck -f /dev/sda1
resize2fs /dev/sda1 20G
# ./resilver
[So 4. Okt 22:02:28 BST 2015] Activating slow mirror ... OK
[So 4. Okt 22:02:39 BST 2015] Waiting 60 seconds for resilvering to start ... OK
[So 4. Okt 22:03:39 BST 2015] Waiting for resilvering to finish ..................................... OK
[So 4. Okt 22:05:22 BST 2015] Activating slow mirror ... OK