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:e3a273636b7d5a542172
Created Aug 18, 2015
emacs keybinding for setting window width
View gist:e3a273636b7d5a542172
(defun set-window-width (n)
"Set the selected window's width."
(adjust-window-trailing-edge (selected-window) (- n (window-width)) t))
(defun set-70-columns ()
"Set the selected window to 80 columns."
(interactive)
(set-window-width 70))
(global-set-key "\C-x`" 'set-70-columns)
@wagjo
wagjo / gist:27ce6a34d5d5257a0790
Last active Sep 24, 2015
JWT Parsing in Dunaj
View gist:27ce6a34d5d5257a0790
(ns foo.core
(:api dunaj)
(:require [dunaj.host.int :refer [i== iDOT]]
[dunaj.host.array :as dha]
[dunaj.format.base64 :refer [base64-safe]]
[dunaj.coll.recipe :refer [concat*]]
[dunaj.concurrent.port :refer [reduce! onto-chan!]]))
(def+ ByteColl [java.lang.Byte]) ;; type signature
View gist:2112f0a9345e8c154fb0
;;;; transducer parser
;; channel that parses input bytes into utf8 chars
(def c (chan 10 (parse utf8)))
;;=> #'foo.baz/c
;; vector of utf8 encoded characters
(def v [-16 -99 -109 -105 -16 -99 -109 -82 -16 -99 -109 -75 -16 -99 -109 -75 -16 -99 -109 -72 32 -16 -99 -108 -128 -16 -99 -109 -72 -16 -99 -109 -69 -16 -99 -109 -75 -16 -99 -109 -83])
;;=> #'foo.baz/v
View gist:9212ca5e3a395f839707
(defprotocol IReducing
"A value protocol for augmented reducing functions."
(-init
"Returns default initial unwrapped value."
[this])
(-finish
"Returns final wrapped result, and performs flushing or cleaning
of internal state. Returned wrap should have cleaned state,
so that eventual subsequent calls to -finish will perform
correctly.
@wagjo
wagjo / gist:30000277f6923ac8d88f
Last active Aug 29, 2015
Wrapping reducer vs reducer with atom
View gist:30000277f6923ac8d88f
(ns redtest.core
(:require [clojure.core.reducers]
[clojure.core.protocols :refer
[CollReduce coll-reduce]]))
;; state is kept in a ret
(deftype WrapState [ret n])
(deftype WrapTake [coll n]