Skip to content

Instantly share code, notes, and snippets.

View gretel's full-sized avatar
🚀
the jitter does know where it is at none time

Tom Hensel gretel

🚀
the jitter does know where it is at none time
View GitHub Profile
@gretel
gretel / airtag_ha.sh
Last active February 14, 2026 01:19
Extract AirTag private keys from jailbroken iPad (palera1n rootless, iOS 15.x). Gives JSON files to be used with https://github.com/malmeloo/hass-findmy. Runs from Mac over SSH.
#!/bin/bash
# airtag_ha.sh — Extract AirTag private keys from jailbroken iPad (palera1n rootless, iOS 15.x)
# Gives JSON files to be used with https://github.com/malmeloo/hass-findmy. Runs from Mac over SSH.
#
# Usage: ./airtag_ha.sh <IPAD_IP> [--port PORT] [--user USER]
# ./airtag_ha.sh --local <HEX_KEY>
set -euo pipefail
DATA="./data"; RECS="$DATA/records"; NAMES="$DATA/names"; DEC="$DATA/decoded"
@gretel
gretel / zigbee-coord.yaml
Last active November 8, 2025 21:53
ESPHome Configuration for a ZigBee-Coordinator on ZB-GW03 hardware. Condensation of https://github.com/syssi/esphome-zb-gw03 into one file with some changes.
---
# https://gist.github.com/gretel/e7f2aa35206679c62b40aa95dd111d04
# based on https://github.com/syssi/esphome-zb-gw03
substitutions:
devicename: 'hallzigbee'
area: 'Hall'
logger_level: 'INFO'
domain: '.jitter.local'
enable_ipv6: False
@gretel
gretel / direnvrc
Created October 28, 2025 22:01
python3 layout module for https://direnv.net/ - using uv and allows to use a specific python version
layout_uv() {
local python_version="${1:-}"
local should_recreate=0
# Check if we need to recreate venv due to version mismatch
if [[ -d ".venv" && -n "$python_version" ]]; then
local current_version
if [[ -f ".venv/bin/python" ]]; then
current_version=$(.venv/bin/python --version 2>&1 | grep -oE '[0-9]+\.[0-9]+')
elif [[ -f ".venv/Scripts/python.exe" ]]; then
@gretel
gretel / disco.py
Last active October 14, 2025 23:59
Discover zeroconf services; the default is `_esphomelib._tcp.local.` - differently put, a simple (esphome) device browser in python
#!/usr/bin/env python3
""" Discover zeroconf services;
the default is `_esphomelib._tcp.local.`.
"""
import argparse
import logging
from time import sleep
from typing import cast
@gretel
gretel / humanscanner.yaml
Last active May 27, 2025 22:41
ESPHome configuration for a 'Seeed MR60BHA2' presence radar that visualizes detected heart rate with an adaptive brightness LED heartbeat effect
---
substitutions:
devicename: 'humanscanner'
upper_devicename: 'HumanScanner'
logger_level: 'INFO'
esphome:
min_version: 2025.5.0
name: "${devicename}"
comment: 'https://esphome.io/components/seeed_mr60bha2.html'
#!/usr/bin/env python3
"""
pdf2json - Convert PDF documents to structured JSON using Kreuzberg
Usage: pdf2json input.pdf [output.json]
"""
import sys
import os
import json
import asyncio
@gretel
gretel / pdf2json_pymupdf.py
Last active May 14, 2025 10:26
Convert PDF documents to structured JSON (using PyMuPDF)
#!/usr/bin/env python3
"""
pdf2json - Convert PDF documents to structured JSON
Usage: pdf2json input.pdf [output.json]
"""
import sys
import os
import json
import argparse
@gretel
gretel / prepare-commit-msg
Created May 13, 2025 16:50
Git hook that uses LLMs via OpenWebUI to automatically generate conventional commit messages from staged changes
#!/bin/sh
# 1. Save as .git/hooks/prepare-commit-msg in your repository
# 2. Make executable with chmod +x .git/hooks/prepare-commit-msg
# 3. Set required environment variables:
# export OPENWEBUI_API_URL="https://your-openwebui-instance.com"
# export OPENWEBUI_API_TOKEN="your_token_here"
# export OPENWEBUI_API_MODEL="claude-3-7-sonnet" # Optional
# 4. Stage your changes with git add and commit normally with git commit
# Get the commit message from the temporary file
@gretel
gretel / check-for-updates.txt
Last active May 2, 2025 18:27
mikrotik routeros update check script - based on https://ondra.sluka.cz/posts/2023-06-13-mikrotik-check-for-updates/ but more robust
# Check for updates and mail admin if available
:local emailAddress "code@jitter.local"
# Set the update channel and check for updates
/system package update set channel=development
/system package update check-for-updates
# Get current version information
:local currver [/system package update get installed-version]
:local newver [/system package update get latest-version]
@gretel
gretel / Makefile
Last active November 21, 2024 01:10
control 'cm108' based radio interfaces on openbsd (inspired by https://github.com/twilly/cm108)
# CM108 GPIO control utility for OpenBSD
PROG= cm108
SRCS= cm108.c
MAN= # empty, no manpage yet
BINDIR= /usr/local/bin
BINOWN= root
BINGRP= bin
BINMODE= 555