Skip to content

Instantly share code, notes, and snippets.

View esc's full-sized avatar
:octocat:
doing open source

Emergency Self-Construct esc

:octocat:
doing open source
View GitHub Profile
@GaelVaroquaux
GaelVaroquaux / 00README.rst
Last active September 15, 2023 03:58
Copy-less bindings of C-generated arrays with Cython

Cython example of exposing C-computed arrays in Python without data copies

The goal of this example is to show how an existing C codebase for numerical computing (here c_code.c) can be wrapped in Cython to be exposed in Python.

The meat of the example is that the data is allocated in C, but exposed in Python without a copy using the PyArray_SimpleNewFromData numpy

@esc
esc / bloscpack_new_header.rst
Created June 27, 2012 20:37
Bloscpack new header

RFC for the new Bloscpack Header

Author

Valentin Haenel

Contact

valentin.haenel@gmx.de

The following 32 bit header is proposed for bloscpack as of version 0.2.0. The design goals of the new header format are to contain as much information as possible to achieve interesting things in the future and to be as general as possible such that the new persistence layer of CArray is compatible with

@minrk
minrk / piphub.py
Created April 23, 2013 19:44
piphub - simple shortcut for installing projects from GitHub
#!/usr/bin/env python
"""
piphub - shortcut for user-only editable install from GitHub
usage:
piphub org[/repo] [name]
`name` only needs to be specified if it differs from `repo`.
If the organization, repo, and name all have the same value (e.g. ipython),
@vincentdavis
vincentdavis / gist:8588879
Last active January 4, 2016 07:29
De Bruijn sequence
def debruijn(k, n):
"""
De Bruijn sequence for alphabet size k (0,1,2...k-1)
and subsequences of length n.
From wikipedia Sep 22 2013
"""
a = [0] * k * n
sequence = []
def db(t, p,):
if t > n: