Skip to content

Instantly share code, notes, and snippets.

View cipri-tom's full-sized avatar

Ciprian Tomoiaga cipri-tom

View GitHub Profile
@cipri-tom
cipri-tom / dc_utils.py
Last active January 21, 2021 16:15
DiskCache sqlerror when throttled / memoized
##################################################################
### Overriding DiskCache's decorators to make them pickle-able ###
##################################################################
import diskcache as dc
from functools import update_wrapper
import time
ENOVAL = dc.core.ENOVAL
@cipri-tom
cipri-tom / etree_test.ipynb
Last active March 3, 2017 12:38
etree bug function namespace prefix
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cipri-tom
cipri-tom / Makefile
Last active August 29, 2015 14:11
LuaJIT and C OpenMP trials
# make with different optimisation levels:
# make O_LEVEL=2 will make with -O2
CC=gcc
O_LEVEL=0
OMP=-fopenmp
CFLAGS=-std=c99 -Wall -pedantic $(OMP) -O$(O_LEVEL)
NL=10
SZ=64
@cipri-tom
cipri-tom / scaleA4pdf
Created December 8, 2014 12:38
Scaling PDFs with GhostScript under linux
#! /bin/bash
# modified from SO: http://stackoverflow.com/a/25932668/786559
input=$2
output=$(echo $2 | sed s/.pdf/_scaled.pdf/)
if [ $# -ne 2 ] ; then
echo "Bad arguments!"
exit
fi
local function printf(s, ...)
io.write(s:format(...))
end
local ffi = require("ffi")
ffi.cdef[[
typedef void (*cb)(void);
void set_v(int n, void (*)(void ));
void set_i(int n, void (*)(int ));
void set_d(int n, void (*)(double));