Skip to content

Instantly share code, notes, and snippets.

*.pyc
// valid values for each: 0-2, where 0 is "do nothing"
#define SIGNAL_MODE 1
#define RAISE_MODE 2
#include <signal.h>
#include <stdio.h>
void handler(int _)
{
// In general it is not safe to call stdio functions from a signal
@o11c
o11c / gen.py
Created February 25, 2014 22:58
generators for control flow
def split_logic():
print('hello')
yield
print('world')
yield # just to suppress the exception in the second .next
gen = split_logic()
gen.next()
print('event')
gen.next()
@o11c
o11c / .gitignore
Last active August 29, 2015 13:56
A "pure" (and flexible) implementation of fizzbuzz.
/fizzbuzzplus
host: irc.freenode.net
port: 6667
nick: elanore^
// password is optional
//pass: hunter2
// join can be repeated
join: #themanaworld
join: #themanaworld-dev
deprecated: implicit 'next statement' label
line 3072 : "No.", '-';
deprecated: unreachable statement
line 3073 : 'c'lose;
Loading NPCs [0]: npc/functions/banker.txt
deprecated: implicit fallthrough
@o11c
o11c / output
Created April 8, 2014 04:29
<3 py.test
% py.test-3 test_fail.py
============================= test session starts ==============================
platform linux -- Python 3.3.5 -- pytest-2.5.1
collected 1 items
turtle/test/test_fail.py F
=================================== FAILURES ===================================
______________________________ TestFail.test_fail ______________________________
@o11c
o11c / endian-test.c
Created April 30, 2014 05:49
Compilers are stupid
#include <endian.h>
#include <string.h>
unsigned load_neutral_big(unsigned char *p)
{
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] << 0);
}
unsigned load_neutral_little(unsigned char *p)
{
[19:30:56.34] init 1
[19:30:56.34] init 2
[19:30:56.34] init 3
[19:30:56.34] configPath: /home/ben//.config/mana/mana/test.xml
[19:30:56.34] Warning: Failed to load features.xml: Path not found
[19:30:56.34] Error loading features.xml
[19:30:56.34] init 2
[19:30:56.34] Couldn't open configuration file: features.xml
[19:30:56.34] init 4
[19:30:56.34] Initializing resource manager...
@o11c
o11c / gist:b4952efe0d74daecdeeb
Created July 5, 2014 04:59
pkg-config files
389-ds-base-dev: /usr/lib/x86_64-linux-gnu/pkgconfig/dirsrv.pc
amora-cli: /usr/lib/pkgconfig/libamora.pc
audacious-dev: /usr/lib/x86_64-linux-gnu/pkgconfig/audacious.pc
audacious-dev: /usr/lib/x86_64-linux-gnu/pkgconfig/audclient.pc
autogen: /usr/lib/x86_64-linux-gnu/pkgconfig/autoopts.pc
banshee: /usr/lib/pkgconfig/banshee-collection-indexer.pc
banshee: /usr/lib/pkgconfig/banshee-core.pc
banshee: /usr/lib/pkgconfig/banshee-hyena-data-sqlite.pc
banshee: /usr/lib/pkgconfig/banshee-hyena-gui.pc
banshee: /usr/lib/pkgconfig/banshee-hyena.pc