Skip to content

Instantly share code, notes, and snippets.

@inducer
inducer / akteach.sty
Created February 2, 2014 19:19
CS450 style file
\nonstopmode
\usepackage[letterpaper, margin=1in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{url}
\usepackage{hyperref}
\usepackage{keystroke}
\usepackage{tikz}
\usepackage{ifthen}
@inducer
inducer / remove-ipynb-output.py
Created February 27, 2014 14:53
Script to remove output in IPython notebook
#! /usr/bin/env python3
from json import load, dump
import sys
if len(sys.argv) != 3:
print("usage: %s INFILE OUTFILE", file=sys.stderr)
with open(sys.argv[1], "rt") as inf:
@inducer
inducer / closure.py
Created March 7, 2014 04:22
Closures demo
def fake_newton(f):
print f(17)
def main():
target_value = 18
def f(x):
return x - target_value
fake_newton(f)
import numpy
import pycuda.autoinit
import pycuda.driver as drv
from pycuda.compiler import SourceModule
from pycuda.gpuarray import to_gpu
mod = SourceModule("""
typedef struct _pair
{
#! /bin/zsh
setopt -o EXTENDED_GLOB
cp -R /usr/share/texlive/texmf-dist/tex/latex/tcolorbox .
tar cvfz loopy-submission.tar.gz --transform='s,.*/,,' \
loopy.{tex,bib} out/loopy.bbl media/*.pdf *.cls \
tcolorbox/*
rm -Rf tcolorbox
@inducer
inducer / cu-mem-reg.c
Created July 17, 2014 19:13
cuMemHostRegister failure reproducer
#include <cuda.h>
#include <stdio.h>
#include <stdexcept>
#include <iostream>
#define CUDAPP_CALL_GUARDED(NAME, ARGLIST) \
{ \
CUresult cu_status_code; \
cu_status_code = NAME ARGLIST; \
if (cu_status_code != CUDA_SUCCESS) \
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def map_comparison(self, expr, *args, **kwargs):
return type(expr)(
self.rec(expr.left, *args, **kwargs),
expr.operator,
self.rec(expr.right, *args, **kwargs))
def map_logical_not(self, expr, *args, **kwargs):
return type(expr)(
self.rec(expr.child, *args, **kwargs))
@inducer
inducer / export-bug.py
Created July 21, 2012 05:48
OpenCascade export bug
import OCC.gp as gp
import OCC.BRepPrimAPI as brep
import OCC.BRepAlgoAPI as brep_alg
import OCC.Utils.DataExchange.IGES as iges
import OCC.Utils.DataExchange.STEP as step
import OCC.Display.SimpleGui as gui
objs = []
for x in [0, 21]:
ax = gp.gp_Ax2(gp.gp_Pnt(x,0,0), gp.gp_Dir(0,1,0))
@inducer
inducer / README
Created September 3, 2012 22:49
Timing example
Please get your timing code from
https://github.com/hpc12/lec1-demo