Skip to content

Instantly share code, notes, and snippets.

ninjin

Block or report user

Report or block ninjin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am ninjin on github.
  • I am ninjin (https://keybase.io/ninjin) on keybase.
  • I have a public key whose fingerprint is 0966 2F9F 3FDA C22B C22E 4CE1 D430 2875 00E6 483C

To claim this, I am signing this object:

@ninjin
ninjin / gist:6495e639a23ddfc76e30
Created Aug 26, 2014
`ContiguousView`s Into a Single Contiguous `Array`
View gist:6495e639a23ddfc76e30
using ArrayViews
using Devectorize
immutable Model
data::Vector{Float64}
a::ContiguousView{Float64,2}
b::ContiguousView{Float64,1}
end
function Model(d)
@ninjin
ninjin / gist:1c1455cff4b276806f8c
Created Aug 8, 2014
Dispatch using type parameters
View gist:1c1455cff4b276806f8c
#!/usr/bin/env julia
# Interesting approach to dispatch using type parameters by Tim Holy:
#
# https://groups.google.com/d/msg/julia-users/NXVgZGeKsUI/_8mOOEZEYgUJ
#
# Author: Pontus Stenetorp <pontus stenetorp se>
# Version: 2014-08-08
immutable Foo{T}
@ninjin
ninjin / gist:fb86072f5265d5138186
Created May 20, 2014
Temporary File Usage in Julia
View gist:fb86072f5265d5138186
a = tempname()
b = tempname()
try
run(`echo -e 'Foo\nBar\nBaz'` |> a)
run(`echo -e 'Foo\nBar\nQux'` |> b)
run(ignorestatus(`diff -u $a $b`))
finally
# Assumes that the first rm call does not fail.
rm(a)
rm(b)
@ninjin
ninjin / gist:b0d45157694a82123d16
Last active Aug 29, 2015
Performance Test for Feature Structure Population and Mapping
View gist:b0d45157694a82123d16
#!/usr/bin/env julia
# Measure the creation/hashing time of a variety of feature structures.
#
# Author: Pontus Stenetorp <pontus stenetorp se>
# Version: 2014-05-13
#
# String Templating (population):
# elapsed time: 0.187136465 seconds (29590584 bytes allocated)
# elapsed time: 0.170848446 seconds (29543784 bytes allocated)
@ninjin
ninjin / gist:e2fe72a62837953b5470
Created May 13, 2014
Performance Test for Feature String to Feature ID Mapping
View gist:e2fe72a62837953b5470
#!/usr/bin/env julia
# Performance test for string hashing, mimicking the feature string to feature
# vector index mapping process.
#
# Author: Pontus Stenetorp <pontus stenetorp se>
# Version: 2014-05-13
#
# Function callback:
# elapsed time: 12.394747173 seconds (440342780 bytes allocated)
@ninjin
ninjin / gist:d6d32b230c18c3edbb6f
Created May 12, 2014
Join strings into a RopeString
View gist:d6d32b230c18c3edbb6f
# There is no convenience function for this operation in Base.
function rope(args...)
rstr = RopeString("")
for arg in args
rstr = RopeString(rstr, arg)
end
return rstr
end
You can’t perform that action at this time.