Skip to content

Instantly share code, notes, and snippets.

View chtlp's full-sized avatar

Linpeng Tang chtlp

View GitHub Profile
@chtlp
chtlp / test_cffi_mkl.py
Last active August 29, 2015 13:55
numpa support for c pointers
import os
import ctypes
import doctest
from numba import *
import numba
import cffi
import numpy as np
@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 / preamble.tex
Created January 5, 2014 22:40
Latex preamble
% packages
\usepackage[scaled=0.92]{helvet} % set Helvetica as the sans-serif font
\renewcommand{\rmdefault}{ptm} % set Times as the default text font
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
% recommended: get mtpro lite
@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
if self.grad_op == 'id':
grad_op = λ x: x
elif self.grad_op == 'sign':
grad_op = λ x: (x > 0) * 1.0 - (x < 0) * 1.0
elif self.grad_op == 'rand':
grad_op = λ x: ((x > 0) * 1.0 - (x < 0) * 1.0) * \
random_value(shape=x.eval().shape, low=0.0, high=1.0, type=floatX,
random_generator=self.rgen)
else:
raise NotImplementedError("unknwon grad_op")
@chtlp
chtlp / gist:7105682
Created October 22, 2013 18:34
python rq test
{
"metadata": {
"name": "rq-test"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
{
"metadata": {
"name": "pdp_spieces_public"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@chtlp
chtlp / stats
Last active December 25, 2015 09:49
statistical experiments
{
"metadata": {
"name": "stats"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@chtlp
chtlp / pdp_species
Last active December 24, 2015 22:59
{
"metadata": {
"name": "pdp_spieces_public"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@chtlp
chtlp / wordnet_stat.ipynb
Last active December 24, 2015 00:59
wordnet data set statistics
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.