Skip to content

Instantly share code, notes, and snippets.

View jbaiter's full-sized avatar

Johannes Baiter jbaiter

View GitHub Profile
@jbaiter
jbaiter / scantailor_multicore.py
Last active June 6, 2016 11:34
Script to run ScanTailor on multiple CPU cores
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2013 Johannes Baiter <johannes.baiter@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
from __future__ import division
import timeit
from StringIO import StringIO # needed for PIL
import requests
from pylab import *
from jpegtran import JPEGImage as jpegtranImage
from wand.image import Image as wandImage
from PIL import Image as pilImage
from __future__ import division
import timeit
from StringIO import StringIO # needed for PIL
import requests
from pylab import *
from jpegtran import JPEGImage as jpegtranImage
from wand.image import Image as wandImage
from PIL import Image as pilImage
@jbaiter
jbaiter / gist:9538491
Created March 13, 2014 22:31
Small jpegtran/PyPy benchmark
# Requires jpegtran-cffi
[1] import jpegtran
[2] %timeit -n10 -r5 jpegtran.JPEGImage('someimage.jpg').exif_thumbnail.as_blob()
import logging
import threading
import time
import RPi.GPIO as GPIO
from spreads.plugin import HookPlugin, TriggerHooksMixin
from spreads.util import DeviceException
@jbaiter
jbaiter / gist:4f385a20d7c56410fb10
Last active August 29, 2015 14:04
Installing spreads on a virgin Raspbian installation
Become root:
$ su
Add spreads repository:
echo "deb http://spreads.jbaiter.de/raspbian wheezy main" >> /etc/apt/sources.list
Update system to newest packages:
$ apt-get update
$ apt-get upgrade
@jbaiter
jbaiter / gist:d816c28fe0a73086e1e5
Last active August 29, 2015 14:05
Laser plugin sketch
from spreads.plugin import HookPlugin, CaptureHooksMixin
class LaserPlugin(HookPlugin, CaptureHooksMixin):
def __init__(self, config):
self._counter = 0
self._interval = config['interval'].get(int)
def capture(self, devices, path):
counter += 1
if self._counter % self._interval != 0:
#!/bin/bash
pip -q install -e $GIT_DIR/..

Keybase proof

I hereby claim:

  • I am jbaiter on github.
  • I am jbaiter (https://keybase.io/jbaiter) on keybase.
  • I have a public key whose fingerprint is 5B56 6828 8ADF 7ACC 6C91 6102 F105 9F94 7961 6773

To claim this, I am signing this object:

==12012== Memcheck, a memory error detector
==12012== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==12012== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==12012== Command: /home/jojo/.envs/jpegtran/bin/python2.7-dbg blowup.py /home/jojo/scans/cryptonomicon/data/raw
==12012==
==12012== Invalid read of size 4
==12012== at 0x48EE26: PyObject_Free (obmalloc.c:989)
==12012== by 0x48F9EC: _PyObject_DebugFreeApi (obmalloc.c:1507)
==12012== by 0x48F7EF: _PyMem_DebugFree (obmalloc.c:1429)
==12012== by 0x47EECB: dictresize (dictobject.c:676)