Skip to content

Instantly share code, notes, and snippets.

@thzinc
thzinc / hap.py
Created October 31, 2023 23:48
Minimum viable POC for mDNS to support HomeKit Accessory Protocol in CircuitPython 9.x with mDNS TXT record support
class Accessory:
aid: int
services: list = []
class Service:
type: str
iid: int
characteristics: list = []
hidden: bool

Implement a circular queue. If you haven’t used that before, a circular queue is a data structure in which the operations are performed based on the “First In First Out” principle, and the last position is connected back to the first position to make a circle.

@thzinc
thzinc / README.md
Last active February 23, 2024 12:46
Use Tesseract to add a text layer to a PDF via OCR

Use Tesseract to add a text layer to a PDF via OCR

(Using macOS)

Dependencies:

  • ImageMagick
  • Tesseract
  • pdfmerge
@thzinc
thzinc / react-native-on-vs-emulator-and-win10.md
Last active February 5, 2019 21:58 — forked from taras-d/react-native-on-vs-emulator-and-win10.md
React native on VS Emulator and Windows 10
04188659672389fd06e1b4d0e35a22d610911c1779f6d815b3cc736f154828e0735e48bcb1a185b0b2e9817014d3cf3b5efe8e7f859e6982d60bcf5d3effff4889
@thzinc
thzinc / FINDINGS.md
Last active November 25, 2017 12:01
Liars’ Poker probability analysis using sampling

TL;DR

I put my sampling analysis into a spreadsheet with charts

It looks like when there are 10 cards in play, the probabilities for three of a kind, flushes, and straights all converge. However, when there are between 6 and 9 cards in play, the probabilities match standard poker rules, so statistically, it's best to avoid flushes before 10 cards in play.

Also interesting to note, there's almost always a pair among the cards in play, even in a 6-card game.

@thzinc
thzinc / PackageApplication
Created October 9, 2017 20:57
PackageApplication script from Xcode 8.2.1
#!/usr/bin/perl
#
# PackageApplication
#
# Copyright (c) 2009-2012 Apple Inc. All rights reserved.
#
# Package an iPhone Application into an .ipa wrapper
#
use Pod::Usage;
@thzinc
thzinc / mentorship.md
Last active December 28, 2016 05:08
Tech mentorship notes

Truths and realities

  • I am good at software development
  • I have received excellent mentorship from many people
  • I have benefitted from the privilege of being a white, cis het male in Tech

Desires and passions

  • Sharing awesome things with people
  • Getting others excited about tech
  • Seeing my friends make awesome stuff
  • Seeing my friends enjoy what they do
@thzinc
thzinc / README.md
Last active May 10, 2024 05:45
Download all iCloud Photos

Download all iCloud Photos from your account

Thanks to the super-useful PyiCloud module by @picklepete, this script is a way to download all of your photos from iCloud Photos.

On OS X (macOS?), use the icloud utility to save your iCloud password to your keyring. (This keeps it out of the script.) Update the script with your Apple ID email address and run it to download your photos to the current directory.

@thzinc
thzinc / parse.js
Created June 11, 2016 23:47
Script to parse list of barcodes and append additional UPC/ISBN info
var fs = require('fs');
var fileName = process.argv[2];
var barcodes = readFile(fileName, 'utf8')
.then(data => data.split(/\r\n/g))
.then(lines => lines
.slice(1)
.map(line => line.split(/,/g))
.map(a => {
return {