Skip to content

Instantly share code, notes, and snippets.

@wizardofozzie
wizardofozzie / hkuris.py
Created November 2, 2025 09:57
decode or encode HomeKit uris
#!/usr/bin/env python3
# hkuri.py — encode/decode HomeKit "X-HM://" URIs
import argparse
import json
import re
import string
import sys
BASE36 = string.digits + string.ascii_uppercase
@wizardofozzie
wizardofozzie / wake-up-light-alarm-with-sunrise-effect.yaml
Last active November 12, 2023 06:24 — forked from peltsippi/wake-up-light-alarm-with-sunrise-effect.yaml
Home Assistant Blueprint: Wake-up light alarm with sunrise effect
blueprint:
name: Wake-up light alarm with sunrise effect
description: 'A wake-up light alarm with a brightness and color temperature sunrise
effect. Note: Requires date_time_iso sensor in configuration, not manually executable!'
domain: automation
input:
light_entity: light.bedroom_lights
name: Wake-up light entity
description: 'The light to control. Turning it off during the sunrise will keep
it off. Color temperature range is auto-detected.'
@wizardofozzie
wizardofozzie / bip39
Last active October 16, 2021 10:47
BIP39 codes & words
#!/usr/bin/python
import binascii, re, json, copy, sys
from binascii import hexlify, unhexlify
from bitcoin.main import *
# SEE https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
ELECTRUM_ENG_V1_WORDLIST = [
'like','just','love','know','never','want','time','out',
'there','make','look','eye','down','only','think','heart',
# Copyright 2014 Chris Cohen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
"""
Example of how calculations on the secp256k1 curve work.
secp256k1 is the name of the elliptic curve used by bitcoin
see http://bitcoin.stackexchange.com/questions/25382
"""
p = 2**256 - 2**32 - 977
  1. Learn Python the Hard Way - Great introductory course to python and programming
  2. The Python Guide - After you have a cursory idea of python, this is great
  3. Code Like a Pythonista: Idiomatic Python - For learning the "pythonic" way of doing things
  4. Tango with Django - Great intro to building python web applications
  5. Intro to Flask, TDD, and jQuery
  6. Selenium's Page Object Pattern for testing websites
  7. The Python Yield Keyword Explained - Good precursor to the generator tricks
  8. Incredible guide on Python's __ (underscore) methods - Must read for anyo
#New sierpinski fractal animation:
#Code is sloppy, I'll probably clean it up later:
# coding: utf-8
from images2gif import writeGif
from PIL import Image, ImageDraw, ImageChops
import console
@wizardofozzie
wizardofozzie / BitStats.py
Last active October 29, 2015 00:34
BitStats.py receives new transactions from Blockchain.info and displays overall stats about them.
import websocket, thread, time, json, datetime, sys, os
def set_exit_handler(func):
if os.name == "nt":
try:
import win32api
win32api.SetConsoleCtrlHandler(func, True)
except ImportError:
version = ".".join(map(str, sys.version_info[:2]))
raise Exception("pywin32 not installed for Python " + version)
@wizardofozzie
wizardofozzie / 1_TxIds.txt
Last active September 9, 2015 13:03 — forked from brianddk/1_TxIds.txt
Check which TX confirmed on their own, and which haven't
Transactions:
504658563f231e71f79312e96da2cc13e779875ac262269b1b8f9f04e527dfc9
a1faf7b6db5bb4ef4a39911ca54152df57758e128cd19fbf16178aea59e06c87
b1346f1ab63dc90cb592028e1f7283f02b54e46afb35b9145ad91ac2a55877be
e61458c302d75b8e0925d4bb0da5466c0a76d60dce506cc766b2d3f160b1d0a5
Addresses:
1BwJgbMKb7nz4GZ3uTDTbpovzznTrBbyJE
1DnJ4rzDpSG5GJsXNyXE7f17rky8wc1RLT
1Q6M9Vyuv5RyeuqpgJfCUCWrM2yrSb45BD
@wizardofozzie
wizardofozzie / 0_Readme.md
Last active September 9, 2015 13:01 — forked from brianddk/0_Readme.md
Use PyBitcoinTools to make CPFP transaction with tip to bounty

More later...