Skip to content

Instantly share code, notes, and snippets.

View dagss's full-sized avatar

Dag Sverre Seljebotn dagss

  • mCASH AS and University of Oslo
  • Oslo
View GitHub Profile
PyHeapExtensibleTypeObject MyProvider_Type =
{
/* PyHeapTypeObject etp_heaptype */
{
/* PyTypeObject ht_type */
{
PyVarObject_HEAD_INIT(0, 0),
"myprovidertype", /*tp_name*/,
sizeof(MyProvider_Object), /* tp_basicsize */
0, /* tp_itemsize */
@dagss
dagss / gist:2908876
Created June 11, 2012 07:18
Notes for NOTUR Python tutorial
An IPython notebook running on Amazon EC2:
http://ec2-54-247-153-111.eu-west-1.compute.amazonaws.com:8888/
Where to find help:
- numpy-discussion: http://www.scipy.org/Mailing_Lists
- cython-users: https://groups.google.com/forum/?fromgroups#!forum/cython-users
- http://scicomp.stackexchange.com
- http://stackoverflow.com/
@dagss
dagss / gist:2862255
Created June 3, 2012 06:38 — forked from anonymous/gist:2862091
simulated hash vtable call
cdef extern from *:
void* malloc(long)
void free(void*)
double sin(double)
from random import randint
from time import clock
cdef extern from "time.h":
cdef struct timespec:
from __future__ import division
import numpy as np
import sys
def simulate(nitems, nslots, nsims=100):
k = int(np.log2(nslots))
assert 2**k == nslots
success_count = 0
for isim in range(nsims):
hashes = np.random.randint(2**32, size=nitems).astype(np.uint64)
/* DO NOT EDIT THIS FILE, IT IS GENERATED */
/*!*/
/*!*/
/*!*/
/*!*/
/*!*/
/*!*/
/*!*/ #include <stdio.h>
/*!*/ #include <string.h>
/*!*/