Skip to content

Instantly share code, notes, and snippets.

View tdhsmith's full-sized avatar

t d h smith tdhsmith

View GitHub Profile
@tdhsmith
tdhsmith / GC-solver-4.js
Created October 4, 2016 02:43 — forked from anonymous/GC-solver-4.js
Thrown-together solver for a geocaching puzzle
var magic = ["equals(caret(175.4, 203.9), caret(gt(37.8, 16.3), 19.5))",
"equals(equals(caret(gt(88.7, 66.4), 101.5), caret(72.3, 39.5)), 37.8)",
"equals(equals(equals(caret(22009.9, 10101.8), 7228.7), 368.7), gt(4138488.0, 4020319.0))",
"equals(caret(2066.8, 668.8), caret(12.9, gt(122.1, 8.4)))",
"equals(equals(caret(9999.9, 10375.2), caret(777.7, 37.9)), gt(96.8, 33.0))",
"equals(equals(equals(caret(98765.7, 3777.5), 667.7), 268.3), caret(586728.2, 412841.8))"];
// unambiguous "caret(22009.9, 10101.8) = 7228.7 = 368.7 = gt(4138488.0, 4020319.0)", ?
// "(98765.7 ^ 3777.5) = 667.7 = 268.3 = (586728.2 ^ 412841.8)" ?
@tdhsmith
tdhsmith / gifiterate.py
Last active June 4, 2018 18:50 — forked from BigglesZX/gifextract.py
Generator to iterate over frames in an animated GIF, correctly handling palettes and frame update modes
import os
from PIL import Image
'''
I searched high and low for solutions to the "extract animated GIF frames in Python"
problem, and after much trial and error came up with the following solution based
on several partial examples around the web (mostly Stack Overflow).
There are two pitfalls that aren't often mentioned when dealing with animated GIFs -
firstly that some files feature per-frame local palettes while some have one global