Skip to content

Instantly share code, notes, and snippets.

View chtlp's full-sized avatar

Linpeng Tang chtlp

View GitHub Profile
// g++ simple.cpp -shared -o libsimple.dylib
#include <stdio.h>
class Simple {
int id_;
public:
Simple(int id);
~Simple();
@chtlp
chtlp / fun.cpp
Created August 8, 2014 06:54 — forked from kizzx2/fun.cpp
// fun.cpp
extern "C"
{
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
#include <iostream>
import scala.util.continuations._
class Generator[A] extends Iterator[A] with (A => Unit @ suspendable) {
private var a: Option[A] = None
private var k: Option[Unit => Unit] = None
def next = {
val a0 = a.get
val k0 = k.get
a = None
@chtlp
chtlp / wscript
Created June 25, 2014 20:46 — forked from jsimmons/wscript
#! /usr/bin/env python
# encoding: utf-8
# Joshua Simmons 2010
def configure(conf):
pass
def build(bld):
pong = bld(
features = 'c cprogram',
@chtlp
chtlp / example.pyx
Created January 25, 2014 17:07 — forked from pv/example.pyx
import numpy as np
import scipy.linalg.blas
cdef extern from "f2pyptr.h":
void *f2py_pointer(object) except NULL
ctypedef int dgemm_t(
char *transa, char *transb,
int *m, int *n, int *k,
double *alpha,
@chtlp
chtlp / 0_reuse_code.js
Created January 5, 2014 22:39
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console