Skip to content

Instantly share code, notes, and snippets.

View tanmaykm's full-sized avatar

Tanmay Mohapatra tanmaykm

  • Bangalore, India
View GitHub Profile
@tanmaykm
tanmaykm / julia_type_tree.txt
Created March 5, 2013 05:49
Type tree of base Julia modules created by julia_types.jl
+- Any
. +- WeakRef
. +- Colon
. +- GetfieldNode
. +- AbstractArray = AbstractArray{T,2}
. . +- Union(AbstractArray{T,1},AbstractArray{T,2})
. . . +- AbstractVecOrMat = Union(AbstractArray{T,1},AbstractArray{T,2})
. . +- Array = Array{T,2}
. . . +- Union(Array{T,1},SubArray{T,1,A<:Array{T,N},I<:(Union(Range1{Int64},Int64,Range{Int64})...,)})
. . . . +- StridedVector = Union(Array{T,1},SubArray{T,1,A<:Array{T,N},I<:(Union(Range1{Int64},Int64,Range{Int64})...,)})
@tanmaykm
tanmaykm / pywebsock.html
Last active July 25, 2019 09:51
Minimal WebSocket Broadcast Server in Python
<!DOCTYPE html>
<html>
<head>
<title>Websocket Demo</title>
<style>
#messages {
border: dotted 1px #444444;
font: 12px arial,sans-serif;
}
@tanmaykm
tanmaykm / compare_numpy_gdal.py
Created November 11, 2013 18:42
Compare numpy and gdal for storing data
import numpy as np
import gdal
import time
ra = np.random.random_sample((1000,1000))
tfile = '/tmp/x'
t1 = time.time()
for i in range(1,5):
@tanmaykm
tanmaykm / circuitscape_gc_stats.txt
Created November 13, 2013 09:30
circuitscape gc debugging
*** calling gc at begin
*** collected 168 objects
*** calling gc at after instantiating cs
gc: collecting generation 2...
gc: objects in each generation: 173 0 15626
gc: done, 133 unreachable, 0 uncollectable, 0.0094s elapsed.
*** collected 4 objects
gc: collecting generation 0...
gc: objects in each generation: 648 0 15794
gc: done, 65 unreachable, 0 uncollectable, 0.0001s elapsed.
@tanmaykm
tanmaykm / hw7.py
Created November 16, 2013 22:02
gene classification
import Orange
train = Orange.data.Table("genestrain")
blind = Orange.data.Table("genesblind")
def create_classifier(cn):
if cn == "nb":
nb = Orange.classification.bayes.NaiveLearner()
nb.name = "nb"
return nb
@tanmaykm
tanmaykm / publisher.jl
Last active August 29, 2015 13:57
Sample ProtoBuf usage
module publisher
using ZMQ
using asset_system
using ProtoBuf
export Publisher, publishEstSysState, close
println("Testing with ZMQ version $(ZMQ.version)")
type Publisher
@tanmaykm
tanmaykm / graph.txt
Created March 21, 2014 10:14
Circuitscape advanced network mode with multiple components
0 1 1
1 2 1
1 3 1
2 4 1
3 4 1
4 7 2
5 6 1
@tanmaykm
tanmaykm / julia_daemon.jl
Created April 15, 2014 12:00
Try creating daemon process in Julia
function daemon()
cpid = ccall(:fork, Cint, ())
if cpid != 0
exit()
else
ccall(:setsid, Cint, ())
cpid = ccall(:fork, Cint, ())
if cpid != 0
exit()
@tanmaykm
tanmaykm / anonperf.jl
Created May 1, 2014 07:20
Julia anon fn performance
function fn_maker{T}(arr::Array{T,1}, len::Int)
function add_fn(pos::Int, val::T)
arr[pos] = val
end
end
function fn_static{T}(arr::Array{T,1}, pos::Int, val::T)
arr[pos] = val
end
@tanmaykm
tanmaykm / results
Last active August 29, 2015 14:02
sort performance
elapsed time: 0.103189028 seconds (0 bytes allocated)
elapsed time: 0.000888531 seconds (0 bytes allocated)
elapsed time: 0.001684563 seconds (0 bytes allocated)
elapsed time: 0.103114518 seconds (0 bytes allocated)
elapsed time: 0.001014195 seconds (0 bytes allocated)
elapsed time: 0.001589316 seconds (0 bytes allocated)
elapsed time: 0.103195119 seconds (0 bytes allocated)
elapsed time: 0.000961692 seconds (0 bytes allocated)
elapsed time: 0.001577562 seconds (0 bytes allocated)