Skip to content

Instantly share code, notes, and snippets.

import eventlet
def defer_f(f, *args, **kwargs):
event = eventlet.event.Event()
eventlet.spawn_n(f, event, *args, **kwargs)
return event
def test_long_foo(event, run_count, *args, **kwargs):
@cfobel
cfobel / Foo.hpp
Last active December 20, 2015 18:39
Cython stack-allocated struct/class
struct Foo {
Foo() : x(0), y(0) {}
Foo(int x, int y) : x(x), y(y) {}
int x;
int y;
};
inline Foo test_return() {
Foo f(7, 4);
@cfobel
cfobel / README.md
Created December 1, 2014 15:02
pygtk2 gtk.Assistant example

This gist includes a pygtk2 port of the gtk.Assistant example available here.

@cfobel
cfobel / gtk_input_greenlet.py
Created December 2, 2014 21:18
Example using greenlets to provide a blocking interface to asynchronously accept values from a GUI.
'''
Example using greenlets to provide a blocking interface to asynchronously
accept values from a GUI.
'''
import gtk
from pygtkhelpers.delegates import WindowView
from greenlet import greenlet
class View(WindowView):
@cfobel
cfobel / color-brewer-qualitative.gpl
Created December 4, 2014 13:34
8 colors light/medium/dark color-brewer-qualitative color palette
GIMP Palette
Name: color-brewer-qualitative
Columns: 3
# This color palette combines the following three palletes developed
# by Cynthia Brewer (see http://colorbrewer2.org/):
# - Dark2_8.gpl
# - Pastel2_8.gpl
# - Set2_8.gpl
179 226 205 light_cyan
253 205 172 light_orange
@cfobel
cfobel / .vimrc.bundles.load
Created December 15, 2014 15:55
Customized vim plugin bundles
" Modeline and Notes {
" vim: set foldmarker={,} foldlevel=0 foldmethod=marker spell:
"
" __ _ _____ _
" ___ _ __ / _/ |___ / __ __(_)_ __ ___
" / __| '_ \| |_| | |_ \ _____\ \ / /| | '_ ` _ \
" \__ \ |_) | _| |___) |_____|\ V / | | | | | | |
" |___/ .__/|_| |_|____/ \_/ |_|_| |_| |_|
" |_|
"
@cfobel
cfobel / show-me-the-numbers
Created December 17, 2014 21:37
Color palette
GIMP Palette
Name: Show me the numbers
Columns: 0
# See here: http://www.amazon.ca/Show-Me-Numbers-Designing-Enlighten/dp/0970601999
# A great book! Please support the author, Stephen Few
140 140 140 light-grey
136 189 230 light-blue
251 178 88 light-orange
144 205 151 light-green
246 170 201 light-pink
@cfobel
cfobel / Tag-v0.1
Created January 15, 2015 13:52
dmf-control-board
Tagger: Ryan Fobel <ryan@fobel.net>
Date: Thu Sep 15 18:38:01 2011 -0400
Version 1.0
commit cc3c0f140dda20c8b971b0a01d4d1723536384f2
Author: Ryan Fobel <ryan@fobel.net>
Date: Wed Jul 6 09:07:03 2011 -0400
Fix autoconnection of DmfControlBoard and function generator
@cfobel
cfobel / netlist_example.cpp
Created March 24, 2015 22:56
netlist_example
#include <thrust/device_vector.h>
#include <thrust/reduce.h>
#include <thrust/copy.h>
#include <thrust/iterator/permutation_iterator.h>
#include <stdint.h>
#include <iterator>
#include <iostream>
#include <iomanip>
#define DUMPN(d_vector,N,dtype,width) \
@cfobel
cfobel / Motor control.ipynb
Created June 12, 2015 15:46
Interactive Firmata motor control notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.