Skip to content

Instantly share code, notes, and snippets.

View hiredman's full-sized avatar

Kevin Downey hiredman

View GitHub Profile
user=> (s/valid? even? "42")
IllegalArgumentException Argument must be an integer: 42 clojure.core/even? (core.clj:1383)
user=> (pst)
IllegalArgumentException Argument must be an integer: 42
clojure.core/even? (core.clj:1383)
clojure.core/even? (core.clj:1378)
clojure.spec.alpha/spec-impl/reify--1987 (alpha.clj:875)
clojure.spec.alpha/valid? (alpha.clj:755)
clojure.spec.alpha/valid? (alpha.clj:751)
user/eval17 (NO_SOURCE_FILE:5)
(require '[clojure.set :as set])
(def info
[{:year 2017
:month 4
:data "x"}
{:year 2017
:month 4
:data "y"}
(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 (disj deps n)]))))))))
(defun clojure-repl-buffer (source-buffer)
(let* ((repl-name (concat "*"(buffer-name source-buffer)
" repl*"))
(buf (get-buffer repl-name)))
(if buf

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

function map(func, array)
local new_array = {}
for i,v in ipairs(array) do
new_array[i] = func(v)
end
return new_array
end
function fix(u)
return u(u)
(deftype PtrNode [l ptr word-size]
clojure.lang.IReduceInit
(reduce [t fun base]
(loop [fun fun
base base
t t
k identity]
(if t
(recur fun
base
(require '[clojure.java.shell :as shell]
'[clojure.java.io :as io])
(import '(java.util.concurrent SynchronousQueue))
(defn pings [host output]
(future
(let [proc (.start
(ProcessBuilder.
["ping" "-Dni" "120" host]))]
;; create a class with two long fields and single method 'do' that
;; decrements one field and increments the other whenever called
(def c
(let [cv (clojure.asm.ClassWriter.
clojure.asm.ClassWriter/COMPUTE_MAXS)
cname "some/package/Class"
ctype (clojure.asm.Type/getObjectType cname)
ctor (clojure.asm.commons.Method. "<init>" clojure.asm.Type/VOID_TYPE (into-array clojure.asm.Type []))]
(-> (doto cv
(.visit clojure.asm.Opcodes/V1_5
#!/bin/sh
set -euo pipefail
IFS=$'\n\t'
cvc4 --lang=smt << EOF
(set-option :produce-assignments true)
(set-logic ALL_SUPPORTED)
(declare-const frac Int)