Skip to content

Instantly share code, notes, and snippets.

View crimeminister's full-sized avatar
💭
🔥 🐶🎩☕️🔥

Robert Medeiros crimeminister

💭
🔥 🐶🎩☕️🔥
View GitHub Profile
...
# Fake a fuse install
RUN apt-get install libfuse2
RUN cd /tmp ; apt-get download fuse
RUN cd /tmp ; dpkg-deb -x fuse_* .
RUN cd /tmp ; dpkg-deb -e fuse_*
RUN cd /tmp ; rm fuse_*.deb
RUN cd /tmp ; echo -en '#!/bin/bash\nexit 0\n' > DEBIAN/postinst
RUN cd /tmp ; dpkg-deb -b . /fuse.deb
;; Datomic example code
;; demonstrates various update scenarios, using a news database
;; that contains stories, users, and upvotes
;; grab an in memory database
(use '[datomic.api :only (q db) :as d])
(def uri "datomic:mem://foo")
(d/create-database uri)
(def conn (d/connect uri))

A little Clojure configuration reader

This is a handy bit of code I've written more than once. I thought I'd throw it in here so I can refer back to it later. Basically, it lets you read a config file to produce a Clojure map. The config files themselves can contain one or more forms, each of which can be either a map or a list. Maps are simply merged. Lists correspond to invocations of extension points, which in turn produces a map, which is merged along with everything else.

An Example

Consider the following files:

names.edn

@crimeminister
crimeminister / gist:4046630
Created November 9, 2012 16:21 — forked from AlexBaranosky/gist:3898489
Clojure joda DateTime instant reader
(ns groupon.joda-instant-reader
(:require [clojure.instant :as i])
(:import org.joda.time.DateTime))
(defmethod print-method org.joda.time.DateTime
[^org.joda.time.DateTime d ^java.io.Writer w]
(#'i/print-date (java.util.Date. (.getMillis d)) w))
(defmethod print-dup org.joda.time.DateTime