Skip to content

Instantly share code, notes, and snippets.

@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.

04188659672389fd06e1b4d0e35a22d610911c1779f6d815b3cc736f154828e0735e48bcb1a185b0b2e9817014d3cf3b5efe8e7f859e6982d60bcf5d3effff4889
@thzinc
thzinc / README.md
Last active September 6, 2024 05:11
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

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 / 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