Skip to content

Instantly share code, notes, and snippets.

View gist:03deee7598fc26c52a140525d1a6dee6
Input
<xml><abstract><section>A <i>severe heart</i> attack</section><section>stroke</section></abstract><meta>foo bar</meta></xml>
Output
<xml><abstract><section>A <i>severe <ann term_id="1" term="mesh:heart_attack">heart</ann></i><ann term_id="1" term="mesh:heart_attack"> attack</ann></section><section><ann term_id="2" term="mesh:stroke">stroke</ann></section></abstract><meta>foo bar</meta></xml>
@wagjo
wagjo / core.clj
Created Dec 2, 2016
CLJ-1912 benchmark
View core.clj
(ns clj1912.core
(:require [criterium.core :refer :all]))
(defn new=
"Equality. Returns true if x equals y, false if not. Same as
Java x.equals(y) except it also works for nil, and compares
numbers and collections in a type-independent manner. Clojure's immutable data
structures define equals() (and thus =) as a value, not an identity,
comparison."
{:inline (fn [x y] `(. clojure.lang.Util equiv ~x ~y))
View gist:0bbe3bb57e23e4e5acc4053ce21b6ef8
wagjo@wagjo-dell ~/bla $ git clone --depth 1 https://github.com/zombodb/zombodb.git
Cloning into 'zombodb'...
remote: Counting objects: 467, done.
remote: Compressing objects: 100% (394/394), done.
remote: Total 467 (delta 103), reused 223 (delta 42), pack-reused 0
Receiving objects: 100% (467/467), 144.57 MiB | 787.00 KiB/s, done.
Resolving deltas: 100% (103/103), done.
wagjo@wagjo-dell ~/bla/zombodb/docker $ docker-compose --version
docker-compose version 1.9.0-rc4, build 181a4e9
View Job description.md

We’re looking to hire a (senior) software developer (F/M) interested in Clojure(Script), machine learning, natural language processing and medicine. This project is about transforming the way decisions are made about new drugs and treatments. Currently, the safety and efficacy of treatments is assessed with Randomised Controlled Trials (clinical trials), typically these trials work by splitting a patient population in two random groups: one group is given the new treatment, the other a placebo or an old treatment. The hope is that this gives an unbiased, real world, estimate of how well a treatment works.

Unfortunately, a lot of biasses are in play, and to combat them many of these trials are conducted and published each year. To give a good overview of what works and what doesn’t, experts attempt to screen and summarise/synthesise all available evidence and trials in thorough documents called systematic reviews. These systematic reviews form the cornerstone of what is called “Evidence Based Medicine”, and i

@wagjo
wagjo / gist:8436799909af2d77df5e
Created Jan 18, 2016
Automatic whitespace cleanup upon save in Emacs
View gist:8436799909af2d77df5e
(add-hook 'before-save-hook
(lambda ()
(whitespace-cleanup)
(delete-trailing-whitespace)))
@wagjo
wagjo / gist:8290237
Last active Jan 2, 2016
Bug in nrepl?
View gist:8290237
;; AOT before loading (e.g. with :aot :all in project.clj)
;; $ lein deps :tree
;; [clojure-complete "0.2.3" :exclusions [[org.clojure/clojure]]]
;; [org.clojure/clojure "1.5.1"]
;; [org.clojure/tools.nrepl "0.2.3" :exclusions [[org.clojure/clojure]]]
(ns ccc.core
(:gen-class))
(defprotocol P)
View gist:7640187
Type Error (user:1:5) Polymorphic function clojure.core/merge could not be applied to arguments:
Polymorphic Variables:
k36143
v36144
Domains:
nil *
(clojure.lang.IPersistentMap k v) (clojure.lang.IPersistentMap k v) *
(Option (clojure.lang.IPersistentMap k v)) *
@wagjo
wagjo / gist:6743885
Created Sep 28, 2013
reducible slurp
View gist:6743885
(require '[clojure.java.io :as jio])
(deftype Slurp [filename]
clojure.core.protocols/CollReduce
(coll-reduce [this f1]
(clojure.core.protocols/coll-reduce this f1 (f1)))
(coll-reduce [_ f1 init]
(with-open [#^java.io.Reader r
(apply jio/reader filename nil)]
(loop [ret init
View 01-original.c
// original
int CheckExtension (char *filename, char *ext)
{
char *s;
if (!filename) return(0);
if (strlen(filename) == 0) return(0);
s = strrchr(filename,'.');
if (!s) return(0);
if (!strcmp(s,ext)) return(1);
@wagjo
wagjo / gist:6442931
Created Sep 4, 2013
benchmarking string splitting
View gist:6442931
;; machine: amd64 Linux 2.6.32-48-server 16 cpu(s)
;; Java HotSpot(TM) 64-Bit Server VM 23.25-b01
;;
;; == without lazy seq realization
;; regex split: 258.567183 ms
;; parallelized regex split: 65.053176 ms - lazy seqs are not realized!
;; correct reduce: 623.541446 ms
;; correct fold: 252.817020 ms
;;
;; == lazy seq realization with (into [] %)