Skip to content

Instantly share code, notes, and snippets.

View rubenhorn's full-sized avatar
:shipit:

Ruben Horn rubenhorn

:shipit:
  • Germany
View GitHub Profile
@rubenhorn
rubenhorn / tp357.py
Created May 5, 2026 22:19
Show measurements from nearby ThermoPro TP357 Hygrometers.
#! /usr/bin/env python3
"""
Show measurements from nearby ThermoPro TP357 Hygrometers.
For more advanced features, use Theengs (https://github.com/theengs/decoder/blob/development/examples/python/ScanAndDecode.py)!
"""
import asyncio
from bleak import BleakScanner
@rubenhorn
rubenhorn / TermuxServer.md
Last active October 31, 2025 13:42
Termux Server

Initial setup

(See also the Termux Wiki)

# Install AutoSSH, OpenSSH and FTP server and tmux
pkg upgrade
pkg install autossh openssh openssh-sftp-server tmux
# Set password for initial connection
passwd
# Find local IP address of device
ifconfig | grep -o 192[0-9\.]*
@rubenhorn
rubenhorn / indivious-to-newpipe.py
Created February 2, 2023 12:49
Convert indivious export to NewPipe export
#! /usr/bin/python3
import json
import sys
import requests
import html
indivious_subs = json.load(sys.stdin).get("subscriptions", [])
@rubenhorn
rubenhorn / get-notified
Last active December 17, 2022 12:28
Personal Push Notifications
#! /bin/sh
HOST="ntfy.sh"
TOPIC="hh2WuvyfG7dN8tQx8ZxLF8wE"
TIMEOUT=10
# Hack to get around issue of output not being piped
while true
do
curl -s $HOST/$TOPIC/json --max-time $TIMEOUT | jq -c 'select(.event == "message")' | while IFS= read -r JSON
@rubenhorn
rubenhorn / frun
Created October 7, 2022 18:22
A simple, fuzzy flatpak launcher
#! /bin/bash
# A simple, fuzzy flatpak launcher
if [ -z "$(which flatpak 2>/dev/null)" ]
then
echo "Flatpak not installed!"
exit 1
fi
@rubenhorn
rubenhorn / eduroam-connect
Created October 6, 2022 11:16
nmcli eduroam script
#! /bin/bash
if [ "$1" == "rm" ]
then
nmcli connection delete eduroam 2>/dev/null
exit
fi
if [ -z "$(nmcli con show | grep eduroam)" ]
then
@rubenhorn
rubenhorn / aws-mfa
Created July 31, 2022 16:25
A simple shell script to generate AWS CLI credentials using MFA
#! /usr/bin/bash
ACCOUNT=$1
USER=$2
OTP=$3
PROFILE=$4
if [ -n "$PROFILE" ]; then
PROFILE="--profile $PROFILE"
fi
@rubenhorn
rubenhorn / firebase-sms-jwt.py
Created March 13, 2022 22:53
Generate Firebase ID token for SMS based authentication
#!/usr/bin/python3
import argparse, requests
url_request_code = (
"https://identitytoolkit.googleapis.com/v1/accounts:sendVerificationCode"
)
url_sign_in_with_phone_number = (
"https://identitytoolkit.googleapis.com/v1/accounts:signInWithPhoneNumber"
)
@rubenhorn
rubenhorn / aws-mfa.py
Last active January 3, 2022 15:55
Simple command line tool for updating AWS MFA session credentials
#!/usr/bin/python3
import json
from pathlib import Path
from subprocess import PIPE, Popen
import sys
"""
Before using this script:
- Configure AWS cli to output JSON (https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-output-format.html)
@rubenhorn
rubenhorn / random-wallpaper.ps1
Created July 6, 2021 08:25
Run from autostart folder using .bat-script with: start /min powershell -File path\to\random-wallpaper.ps1
#====================
# Settings
#====================
$superSampling = 2
$urlTemplate = "https://picsum.photos/{width}/{height}?grayscale"
#====================
# Await connection
#====================
$null = $urlTemplate -match "^https?://([^/]*)/"