Skip to content

Instantly share code, notes, and snippets.

View hiredman's full-sized avatar

Kevin Downey hiredman

View GitHub Profile
(defn parse-varint [input]
(letfn [(fold [bytes number input]
(if (.hasRemaining input)
(let [b (.get input)
done? (zero? (bit-and (long (bit-shift-right b 7)) 0xff))
number (.or
number
(biginteger
(bit-shift-left
(bit-and b 127)
(require '[clojure.set :as set])
(def info
[{:a 1
:b 2}
{:a 1
:b 4}
{:a 4
:b 4}])
(do
(prn *ns*)
(require '[clojure.tools.namespace.find :as ns-find]
'[clojure.java.io :as io]
(defn topo [graph]
(when-not (empty? graph)
(lazy-seq
(let [n (first (for [[node s] graph
:when (not (seq s))]
node))]
(assert n "if this fails there is a cycle")
(cons n (topo (into {} (for [[node deps] graph
:when (not= n node)]
[node (dissoc deps n)]))))))))
(defn impl-local-keys [spec-map]
(reify
s/Specize
(specize* [s] s)
(specize* [s _] s)
s/Spec
(conform* [_ m]
(reduce
(fn [ret spec-key]
(let [s (get spec-map spec-key)

The Problems With Clojure AOT Compilation.

  1. The name is not clear.
    • The name is short hand for something, but it can easily be bandied about and ends up being used without understanding what it signifies.
    • The compilation model
      • reader
      • compiler
        • not interpreted
(deftype Lens [get set])
(defn lupdate [^Lens lens v s]
((.-set lens) v s))
(defn view [^Lens lens s]
((.-get lens) s))
(defn lalter [lens fun & args]
(fn [s]
#!/bin/bash
#_ (
true;exec java -jar /home/kevin/.m2/repository/org/clojure/clojure/1.7.0/clojure-1.7.0.jar $0
)
- name: Jenkins
hosts: all
roles:
- java
- docker
- jenkins
- archiva
- nginx
- s3cmd
- pullrequest
@hiredman
hiredman / aleph-proxy.clj
Created August 13, 2015 23:03
aleph-proxy.clj
(require '[aleph.http :as http])
(def main-server
(http/start-server
(constantly {:status 200 :body "yo"})
{:host "localhost"
:port 3467}))
(def proxy-server
(http/start-server