Skip to content

Instantly share code, notes, and snippets.

View gasagna's full-sized avatar

Davide Lasagna gasagna

  • University of Southampton
  • United Kingdom
View GitHub Profile
@danielmatz
danielmatz / zeros_test.jl
Created October 18, 2016 01:57
Comparison of implementations of zeros
using BenchmarkTools
function zeros_calloc{S, N}(T::Type, dims::Vararg{S, N})
data = ccall((:calloc, "libc"),
Ptr{Void},
(Csize_t, Csize_t),
prod(dims), sizeof(T))
data == C_NULL && error("Failed to allocate memory")
ccall(:jl_ptr_to_array,
Array{T, N},
@concHNO3
concHNO3 / gist:2923266
Created June 13, 2012 10:22
Set Helvetica Font in Text and Math in LaTeX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set Helvetica Font in Text and Math in LaTeX %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\familydefault}{\sfdefault}
\usepackage[scaled=1]{helvet}
\usepackage[helvet]{sfmath}
\everymath={\sf}
@hrldcpr
hrldcpr / tree.md
Last active May 1, 2024 00:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!