Skip to content

Instantly share code, notes, and snippets.

@oskar456
oskar456 / acme_acct_thumbprint.py
Created September 1, 2026 19:44
Convert PEM ACME account key into base64url thumprint of the JWK representation used in http-01 challenge
#!/usr/bin/env -S uv run --script
# /// script
# dependencies = [
# "cryptography",
# ]
# ///
import base64
import hashlib
import json
@oskar456
oskar456 / gratuitousna.py
Last active July 15, 2026 12:22
Gratuitous IPv6 Neighbor Advertisement of GUAs using Scapy
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.14"
# dependencies = [
# "scapy>=2.7.0",
# ]
# ///
import socket
import time
@oskar456
oskar456 / README.md
Last active April 30, 2026 17:56
CLAT for Linux using Jool and ipvlan PoC

CLAT for Linux using ipvlan

This proof of concept uses ipvlan feature of Linux to split up main network interface into two in order to use one in a separate namespace with jool-siit performing CLAT translation.

This way, enabling CLAT is least intrusive to the default network namespace - no need to enable forwarding or touch firewall rules.

@oskar456
oskar456 / bh1750.py
Created June 20, 2015 15:26
BH1750 python library
#!/usr/bin/python2
# vim: expandtab ts=4 sw=4
# Inspired by http://www.raspberrypi-spy.co.uk/2015/03/bh1750fvi-i2c-digital-light-intensity-sensor/
import smbus
import time
class BH1750():
""" Implement BH1750 communication. """
@oskar456
oskar456 / analyze_v6_only_preferred.py
Created July 15, 2022 12:14
Analyze IPv6-only preferred (option 108) in DHCP requests
#!/usr/bin/env python3
"""
Analyze a PCAP file containing DHCP Discover messages.
Print stats including number of unique MAC addresses,
number of MAC addresses requesting DHCP option 108
(IPv6-only Preferred) and MAC adresses flapping between
requesting and not requesting it.
To collect PCAP file, tcpdump can be used like this:
@oskar456
oskar456 / wgcf.py
Last active September 27, 2025 02:47
Cloudflare WARP linux client (using wg-quick for actual tunnel setup)
#!/usr/bin/env python3
import subprocess
import json
import os
from pathlib import Path
import requests
from requests.compat import urljoin
@oskar456
oskar456 / oneshot_setup.sh
Created July 5, 2020 17:23
Raspberry Pi Zero USB gadget mode with ethernet and serial
#!/bin/sh
# Enable gadget mode
echo "dtoverlay=dwc2,dr_mode=peripheral" >> /boot/config.txt
systemctl enable setupgadget.service
# alternatively: ln -s /etc/systemd/system/setupgadget.service /etc/systemd/system/basic.target.wants/setupgadget.service
# Enable getty on the virtual serial line
systemctl enable serial-getty@ttyGS0.service
# alternatively: ln -s /lib/systemd/system/serial-getty@.service /etc/systemd/system/getty.target.wants/serial-getty@ttyGS0.service
@oskar456
oskar456 / isholiday.py
Last active March 28, 2025 12:23
Czech public holiday checker
#!/usr/bin/env python3
import datetime
def getholidays(year):
"""Return a set public holidays in CZ as (day, month) tuples."""
holidays = {
(1, 1), #Novy rok
(1, 5), #Svatek prace
(8, 5), #Den vitezstvi
@oskar456
oskar456 / atlas_claimer.sh
Last active February 3, 2025 15:42
Claim 1,000,000 RIPE Atlas credits every time you can
#!/bin/bash
# Dependencies: curl, jq, realpath, date (GNU), at
API_KEY="FIXME"
claim_endpoint() {
local regid=$1
curl -s -H "Content-Type: application/json" \
-H "Accept: application/json" \
#!/usr/bin/env python3
import urllib.request
from collections import defaultdict
DELEGSTATS = "https://ftp.ripe.net/ripe/stats/delegated-ripencc-extended-latest"
def main():
"""