Skip to content

Instantly share code, notes, and snippets.

@pao
pao / ccall_wrapper.jl
Created September 19, 2012 12:46 — forked from dcampbell24/gist:3470851
julia ccall macro
macro ccallWrap(lib, fnSym, retType, argTypes)
args = [gensym() for i in 1:length(argTypes.args)]
fnArgs = [:($(args[i])::$(argTypes[i]))
for i in 1:length(argTypes)]
:(($fnSym)($fnArgs...) = ccall(dlsym($lib, $fnSym), $retType, $argTypes, $args...))
end
@pao
pao / glm.jl
Created March 29, 2012 22:57
Implementing Generalized Linear Models in Julia
type Link
name::String
linkFun::Function
linkInv::Function
muEta::Function
end
type Dist
name::String
variance::Function
@pao
pao / PKbench.jl
Created March 29, 2012 20:00
Benchmarking some Julia functions derived from R functions
# in http://dmbates.blogspot.com/2012/03/pk-models-in-r-and-in-julia.html I describe
# the motivation behind these functions. The test data is extracted from an R data set
# Use semicolons between elements to ensure this is a vector
Time = [0; 0.25; 0.57; 1.12; 2.02; 3.82; 5.1; 7.03; 9.05; 12.12; 24.37; 0; 0.27; 0.52; 1; 1.92; 3.5; 5.02; 7.03; 9; 12; 24.3; 0; 0.27; 0.58; 1.02; 2.02; 3.62; 5.08; 7.07; 9; 12.15; 24.17; 0; 0.35; 0.6; 1.07; 2.13; 3.5; 5.02; 7.02; 9.02; 11.98; 24.65; 0; 0.3; 0.52; 1; 2.02; 3.5; 5.02; 7.02; 9.1; 12; 24.35; 0; 0.27; 0.58; 1.15; 2.03; 3.57; 5; 7; 9.22; 12.1; 23.85; 0; 0.25; 0.5; 1.02; 2.02; 3.48; 5; 6.98; 9; 12.05; 24.22; 0; 0.25; 0.52; 0.98; 2.02; 3.53; 5.05; 7.15; 9.07; 12.1; 24.12; 0; 0.3; 0.63; 1.05; 2.02; 3.53; 5.02; 7.17; 8.8; 11.6; 24.43; 0; 0.37; 0.77; 1.02; 2.05; 3.55; 5.05; 7.08; 9.38; 12.1; 23.7; 0; 0.25; 0.5; 0.98; 1.98; 3.6; 5.02; 7.03; 9.03; 12.12; 24.08; 0; 0.25; 0.5; 1; 2; 3.52; 5.07; 7.07; 9.03; 12.05; 24.15]
# Or use the columnization indexing trick, this also work
@pao
pao / ubiquity_addons.js
Created January 22, 2010 01:51 — forked from folarb/x
CmdUtils.makeSearchCommand({
names: ["addons"],
icon: "https://addons.mozilla.org/favicon.ico",
author: {
name: "Patrick O'Leary",
email: "patrick.oleary@gmail.com"
},
description: "Searches Mozilla Add-ons for your words",
help: "Doesn't show experimental add-ons (like ubiquity) yet. Enter (part of) the name or the description of an add-on. The first 5 results will be displayed in the preview, hit return to go to the search page",
url: "https://addons.mozilla.org/en-US/firefox/search?q={QUERY}",