Skip to content

Instantly share code, notes, and snippets.

View dkvasnicka's full-sized avatar

Daniel Kvasnička dkvasnicka

View GitHub Profile

Keybase proof

I hereby claim:

  • I am dkvasnicka on github.
  • I am dkvasnicka (https://keybase.io/dkvasnicka) on keybase.
  • I have a public key ASCzKqMENpeKa_hmnrf1upvL9TxL_a3TpGVvUTY7f7aAkgo

To claim this, I am signing this object:

@dkvasnicka
dkvasnicka / Dockerfile
Last active February 26, 2021 11:31
Racket Jupyter kernel setup for Deepnote.com
FROM gcr.io/deepnote-200602/templates/deepnote
RUN sudo apt-get update && \
sudo apt-get install -y libzmq5
# Derived from https://github.com/jackfirth/racket-docker which is
# licensed under the MIT license.
ENV RACKET_INSTALLER_URL=http://mirror.racket-lang.org/installers/7.8/racket-7.8-x86_64-linux-natipkg.sh
ENV RACKET_VERSION=7.8
(let [rng (doall (range 1000000))]
(time (reduce + (map * rng rng))))
@dkvasnicka
dkvasnicka / gist:5908493
Last active December 19, 2015 05:59
Dot product. Run using https://github.com/eholk/harlan
(module
(extern nanotime () -> u64)
(define (main)
(let ((v1 (iota 1000)) (v2 (iota 1000)))
(let ((start (nanotime))
(result
(reduce +
(kernel ((x v1) (y v2))
@dkvasnicka
dkvasnicka / gist:5692932
Last active December 17, 2015 23:58
Currying in CL
(defun curryplus (x)
(lambda (y) (+ x y)))
(funcall (curryplus 2) 3) ; = 5
@dkvasnicka
dkvasnicka / gist:5691519
Created June 1, 2013 19:45
Currying in Racket
#lang racket
(define (curryplus x)
(lambda (y) (+ x y)))
((curryplus 2) 3) ; = 5
@dkvasnicka
dkvasnicka / gist:5691514
Created June 1, 2013 19:43
Currying in Clojure
(defn curryplus [x]
#(+ x %))
((curryplus 2) 3) ; = 5
@dkvasnicka
dkvasnicka / app.rkt
Created May 26, 2013 17:49
Primitive RESTful hello world in Racket. Run racket (racket -il xrepl) and load the file (,rr app.rkt). Browse to http://localhost:8000/hello/whatever Uses Spin https://github.com/dmacdougall/spin No buildfile needed or anything... Racket requires the library from disk or downloads it from the central repo (PLaneT) if needed. Übercool.
#lang racket
(require (planet dmac/spin))
(get "/hello/:name" (lambda (req) (string-append "Hello, " (params req 'name))))
(run)