Skip to content

Instantly share code, notes, and snippets.

Michael Blume MichaelBlume

Block or report user

Report or block MichaelBlume

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
from itertools import takewhile, ifilter
def fibs():
fib0 = 1
fib1 = 1
while True:
yield fib0
newfib = fib0 + fib1
fib0 = fib1
fib1 = newfib
View java8_postinst.bash
echo -n "Updating system so it uses the new JDK..."
update-alternatives --quiet --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0/bin/java" 2
update-alternatives --quiet --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0/bin/javac" 2
update-alternatives --quiet --set java /usr/lib/jvm/jdk1.8.0/bin/java
update-alternatives --quiet --set javac /usr/lib/jvm/jdk1.8.0/bin/javac
echo "done."
exit 0
View schema->gen.clj
(ns schema->gen
"Functions for generating test data from schemas."
(:require [four.stateful :as four]
[re-rand :refer [re-rand]]
[schema.core :as sch]
[simple-check.generators :as gen]))
(defn ^:private re-randify-regex
"schema requires ^$ while re-rand forbids them"
View gist:10347711
import Data.Char
translate_char tmap c = helper tmap where
helper [] = c
helper ((c',ct):ps)
| c == c' = ct
| otherwise = helper ps
translate_string tmap = map $ translate_char tmap
View find-in.clj
(defn find-in
([needle haystack] (find-in needle haystack 'x))
([needle haystack varname]
; varname remminds us of how we got the haystack we're looking at from x
; base case
(when (= needle haystack)
View swap_out.clj
(defn swap-out! [a new-val]
(loop []
(let [old-val @a]
(if (compare-and-set! a old-val new-val)
View vimrc
execute pathogen#infect()
let g:paredit_electric_return=0
let g:lisp_rainbow = 1
set nocompatible
" create a backup of files when editing in /tmp
set backupdir=~/tmp
" swap file directory
set dir=/tmp
set background=dark
View read_to_maps.clj
(defn read-to-maps [rows]
(let [headers (->>
(take-while (complement #{""}))
(map keyword))]
(for [row (rest rows)]
(zipmap headers row))))
View gist:aa26fc715cbbdf711290
[java] Compiling clojure.core to /Users/michael.blume/workspace/clojure/target/classes
[java] Exception in thread "main" java.lang.LinkageError: loader constraint violation: loader (instance of clojure/lang/DynamicClassLoader) previously initiated loading for a different type with name "clojure/core/VecNode", compiling:(clojure/gvec.clj:124:1)
[java] at clojure.lang.Compiler.analyzeSeq(
[java] at clojure.lang.Compiler.analyze(
[java] at clojure.lang.Compiler.analyze(
[java] at clojure.lang.Compiler$BodyExpr$Parser.parse(
[java] at clojure.lang.Compiler$FnMethod.parse(
[java] at clojure.lang.Compiler$FnExpr.parse(
[java] at clojure.lang.Compiler.analyzeSeq(
You can’t perform that action at this time.