Skip to content

Instantly share code, notes, and snippets.

View jbaiter's full-sized avatar

Johannes Baiter jbaiter

View GitHub Profile
@jbaiter
jbaiter / gist:1176293
Created August 28, 2011 05:58
Simple Wizard
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Wizard</class>
<widget class="QWizard" name="Wizard">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
-- xmonad config used by Vic Fryzel
-- Author: Vic Fryzel
-- http://github.com/vicfryzel/xmonad-config
import System.IO
import System.Exit
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.SetWMName
@jbaiter
jbaiter / gist:2789684
Created May 25, 2012 18:27
Missing files
system/lib/bluez-plugin/audio.so
system/lib/bluez-plugin/input.so
system/lib/bluez-plugin/network.so
system/lib/egl/libGLES_android.so
system/lib/libEGL.so
system/lib/libETC1.so
system/lib/libFFTEm.so
system/lib/libGLESv1_CM.so
system/lib/libGLESv2.so
system/lib/libRS.so
@jbaiter
jbaiter / ex17.c
Created May 25, 2012 18:50
Segfaults when run normally, runs fine in Valgrind
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
char *names_addr = 0;
char *mails_addr = 0;
struct Address {
@jbaiter
jbaiter / gist:5815446
Last active December 18, 2015 16:59
Generic function that applies `func` (which doesn't have to be imported in the module!) for every set of arguments in `args` and `kwargs` concurrently.
def run_multicore(func, m_args, m_kwargs, num_procs=None):
""" Run `func` once for each set of arguments in `m_args` and `m_kwargs`, using
either `num_procs` worker processes or as many as CPU cores are
available.
"""
class Worker(Process):
def __init__(self, func, queue):
super(Worker, self).__init__()
self.func = func
self.queue = queue
@jbaiter
jbaiter / example.html
Last active December 20, 2015 03:08
<html>
<head>
<title>bookreader example</title>
<link rel="stylesheet" type="text/css" href="BookReader/BookReader.css"/>
<script type="text/javascript" src="http://www.archive.org/includes/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="BookReader/jquery-ui-1.8.5.custom.min.js"></script>
<script type="text/javascript" src="BookReader/dragscrollable.js"></script>
<script type="text/javascript" src="BookReader/jquery.colorbox-min.js"></script>
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
#!/usr/bin/env python3.4
import argparse
import gzip
import json
import operator
import random
import sys
from collections import defaultdict
from itertools import chain
execve("/home/jojo/.bin/exercism", ["exercism", "upgrade"], [/* 68 vars */]) = 0
arch_prctl(ARCH_SET_FS, 0xb9fdc8) = 0
sched_getaffinity(0, 8192, [f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...]) = 64
mmap(0xc000000000, 65536, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xc000000000
munmap(0xc000000000, 65536) = 0
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fae48c40000
mmap(0xc820000000, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xc820000000
mmap(0xc81fff8000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xc81fff8000
mmap(0xc000000000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xc000000000
mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fae48c30000