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
View even_fibs.py
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
#!/bin/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"
[re]
View gist:10347711
#!/usr/bin/runhaskell
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
; http://an-animal-imagined-by-poe.tumblr.com/post/97790330928/i-have-been-busy-distracted-absent-for-the-past
(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
(or
; base case
(when (= needle haystack)
varname)
View swap_out.clj
(defn swap-out! [a new-val]
(loop []
(let [old-val @a]
(if (compare-and-set! a old-val new-val)
old-val
(recur)))))
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 (->>
rows
first
(take-while (complement #{""}))
(map keyword))]
(for [row (rest rows)]
(zipmap headers row))))
View gist:aa26fc715cbbdf711290
compile-clojure:
[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(Compiler.java:6715)
[java] at clojure.lang.Compiler.analyze(Compiler.java:6499)
[java] at clojure.lang.Compiler.analyze(Compiler.java:6460)
[java] at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5840)
[java] at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5271)
[java] at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3900)
[java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:6706)
You can’t perform that action at this time.