Skip to content

Instantly share code, notes, and snippets.

@BigglesZX
BigglesZX / gifextract.py
Created November 5, 2012 10:31
Extract frames from 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 -
@jlfwong
jlfwong / progdiff.sh
Created October 3, 2012 20:07
Diff the stdout, stderr and return code of two programs with piped input and arguments
#!/bin/bash
sandbox="$(mktemp -d)"
hasstdin=false
if [ ! -t 0 ]; then
cat <&0 > "$sandbox/stdin.txt"
hasstdin=true
fi
@psobot
psobot / exceptionthread.py
Created April 14, 2012 19:05
Exception-Raising Thread
import Queue
import threading
import sys
__author__ = 'psobot'
class ExceptionThread(threading.Thread):
def __init__(self, *args, **kwargs):
threading.Thread.__init__(self, *args, **kwargs)
self.__status_queue = Queue.Queue()