Skip to content

Instantly share code, notes, and snippets.

View ohadle's full-sized avatar

Ohad Levinkron ohadle

View GitHub Profile
@ohadle
ohadle / simple_mm.jl
Created May 15, 2017 07:04
Mixed Models performance
using DataFrames, Distributions, GLM, MixedModels
using BenchmarkTools
n_groups = 1000
samples_per_group = 500
function test_mm(n_groups, samples_per_group)
group_offset = rand(n_groups)
@ohadle
ohadle / DTrace ipython
Last active October 24, 2016 20:23
TF test
➜ ~ git:(master) ✗ sudo dtruss -p 45999
SYSCALL(args) = return
write(0x9, "x\0", 0x1) = 1 0
psynch_cvsignal(0x102700148, 0x2600000026100, 0x26000) = 257 0
psynch_cvwait(0x102700148, 0x2600100026100, 0x26000) = 0 0
psynch_cvsignal(0x102700148, 0x2610000026200, 0x26100) = 257 0
psynch_cvwait(0x102700148, 0x2610100026200, 0x26100) = 0 0
select(0x6, 0x7FFF5FBF14D0, 0x7FFF5FBF1450, 0x7FFF5FBF13D0, 0x0) = 1 0
psynch_cvsignal(0x102700148, 0x2620000026300, 0x26200) = 257 0
@ohadle
ohadle / transform.jl
Created October 11, 2016 13:05
Process CSV
data = readcsv(joinpath(file_path, in_file); header=true)
map!(replace_nulls, data[1])
out_f = open(joinpath(file_path, out_file), "w")
write(out_f, join(data[2], ",")) #headers
writecsv(out_f, data[1][1:1, :]) #unclear why this is needed
writecsv(out_f, data[1])
close(out_f)
@ohadle
ohadle / nbrs.jl
Created April 26, 2014 16:11
Import graph from NetworkX JSON to Graphs.jl
using JSON
g_dict = open(JSON.parse, "/home/olevinkr/Documents/julia/nbrs_graph2.json")
using Graphs
#transfer all nodes to ExVertex types
new_vs = Array(ExVertex, length(g_dict["nodes"]))
i = 1
for vertex in g_dict["nodes"]