Skip to content

Instantly share code, notes, and snippets.

@albertz
albertz / bin2c.c
Created January 2, 2012 16:29
bin2c
#include <stdio.h>
#include <assert.h>
int main(int argc, char** argv) {
assert(argc == 2);
char* fn = argv[1];
FILE* f = fopen(fn, "r");
printf("char a[] = {\n");
unsigned long n = 0;
while(!feof(f)) {
@albertz
albertz / imageio-colorspace.patch
Created January 2, 2012 17:14
SDL_image ImageIO color space fix
diff -r 5e26e77b30bf IMG_ImageIO.m
--- a/IMG_ImageIO.m Sat Dec 31 13:34:24 2011 -0500
+++ b/IMG_ImageIO.m Mon Jan 02 18:10:20 2012 +0100
@@ -212,8 +212,25 @@
CGContextRef bitmap_context;
CGBitmapInfo bitmap_info;
- CGColorSpaceRef color_space = CGColorSpaceCreateDeviceRGB();
-
+
@albertz
albertz / gist:2758545
Created May 20, 2012 15:35
evol demo
def evaluiere(vec):
# ...
return 1.0
# http://en.wikipedia.org/wiki/Evolutionary_algorithm
# http://en.wikipedia.org/wiki/Genetic_algorithm
# genetischer Algo:
@albertz
albertz / Multiprocessing.h
Created April 2, 2013 08:33
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/Multiprocessing.h
/*
File: CarbonCore/Multiprocessing.h
Contains: Multiprocessing interfaces
The contents of this header file are deprecated.
Copyright: © 1995-2011 DayStar Digital, Inc.
*/
/*********************************************************************************************
@albertz
albertz / semaphore-osx.c
Created April 2, 2013 11:18
This is a reimplementation of `semaphore-osx.c` from PulseAudio to use POSIX named semaphores. See [this bug](https://bugs.freedesktop.org/show_bug.cgi?id=63014). It is also used by the Homebrew PulseAudio formular, see [this report](https://github.com/mxcl/homebrew/pull/18838).
/***
This file is part of PulseAudio.
Copyright 2006 Lennart Poettering
Copyright 2013 Albert Zeyer
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License,
or (at your option) any later version.
az@albertzeyermbp ~> brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/mxcl/homebrew.git
HEAD: 143d5474b59f5094b9e3d1eff3aedfe4e5c68241
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit sandybridge
OS X: 10.9-x86_64
Xcode: 5.0.1
GCC-4.2: build 5666
#!/usr/bin/env python3
import os, sys, re
import argparse
from datetime import datetime
import tempfile
import shutil
parser = argparse.ArgumentParser()
parser.add_argument('--histfile',
@albertz
albertz / TaskSystem.py
Last active September 24, 2019 15:31
Multiprocessing with real subprocess (fork+exec), not just fork
"""
Here are all subprocess, threading etc related utilities,
most of them quite low level.
"""
from threading import Lock, currentThread
import sys
import os
from StringIO import StringIO
@albertz
albertz / crnn.config
Created October 22, 2015 11:11
crnn enc-dec attention copy
{
"task": "train",
"train": {"class": "CopyTaskDataset", "nsymbols": 100, "num_seqs": 500, "minlen_epoch_factor": 1, "maxlen_epoch_factor": 1},
"dev": {"class": "CopyTaskDataset", "nsymbols": 100, "num_seqs": 50, "minlen_epoch_factor": 1, "maxlen_epoch_factor": 1},
"num_inputs": 100,
"num_outputs": {"data": [100,1], "classes": [100,1]},
"sparse_input": true,
"batch_size": 1000,
"num_epochs": 100,

Keybase proof

I hereby claim:

  • I am albertz on github.
  • I am albertzeyer (https://keybase.io/albertzeyer) on keybase.
  • I have a public key whose fingerprint is 1BF6 6B32 629D 084D DE13 2D2E 6494 081B 6084 4F60

To claim this, I am signing this object: