Skip to content

Instantly share code, notes, and snippets.

Chris Corbyn d11wtq

  • Melbourne, Australia
Block or report user

Report or block d11wtq

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
@d11wtq
d11wtq / roman.clj
Last active Aug 29, 2015
Roman numerals
View roman.clj
(ns roman.core)
(defmacro defpairs
"Helper macro to make ordered defs for pairs nicer."
[varname pairs]
`(def ~varname
(partition 2 ~pairs)))
(defpairs digits
["M" 1000
@d11wtq
d11wtq / declare.clj
Last active Aug 29, 2015
Implicit forward declarations for Clojure
View declare.clj
(defn def?
[[a b]]
(if (#{'defn 'def} a) b))
(defmacro progn
[& sexps]
(let [names (->> sexps (filter def?) (map def?))]
`(do
(declare ~@names)
~@sexps)))
@d11wtq
d11wtq / atbash.clj
Last active Aug 29, 2015
Atbash Cipher in Clojure
View atbash.clj
(ns atbash.core
(require [clojure.string :refer [join lower-case]]))
(def lookup
(let [alphabet "abcdefghijklmnopqrstuvwxyz"]
(zipmap alphabet (reverse alphabet))))
(defn encode
[s]
(->> (lower-case s)
@d11wtq
d11wtq / README.md
Last active Aug 29, 2015
Writing int->str (Clojure)
View README.md

int->str

This function computes the English string for any given integer supported by Clojure.

Example

(int->str 110917) ; "one hundred and ten thousand nine hundred and seventeen"
View dependency-injection.clj
(ns example.factory.aws.cloudformation
(:require [clojure.data.json :as json]))
(defn apply-stack-fn
[create-fn update-fn]
(fn apply-stack
[payload]
(try
(create-fn payload)
(catch AlreadyExistsException e
@d11wtq
d11wtq / Spanish.md
Last active Aug 29, 2015
Spanish Study
View Spanish.md

El estudio del castellano

Las conjugaciones de los verbos

Verbo Sujeto Conjugación
View generics.cpp
class ASTNode {
public:
template <class T> virtual T accept(Visitor<T> *visitor);
};
template <class T> class Visitor {
public:
virtual T visit(CallNode *node) = 0;
virtual T visit(BinExprNode *node) = 0;
};
@d11wtq
d11wtq / Dockerfile
Created Mar 7, 2014
Suggested syntax to exclude directories from layers in an image.
View Dockerfile
FROM gentoo
MAINTAINER Bob
EXCLUDE /usr/portage
RUN emerge-webrsync
RUN emerge sys-devel/llvm
RUN emerge sys-devel/clang --autounmask-write
RUN etc-update --automode -5
RUN emerge sys-devel/clang
@d11wtq
d11wtq / spinner.sh
Last active Aug 29, 2015
Bash spinner, WIP.
View spinner.sh
#!/bin/bash
TTY=/dev/tty
spin() {
width=20
delta=1
#fwd_chars=("\\" "|" "/" "-")
#rev_chars=("/" "|" "\\" "-")
fwd_chars=">"
View docker.log
vagrant@local ~ $ docker run -t -i -rm ubuntu bash
Unable to find image 'ubuntu' (tag: latest) locally
Pulling repository ubuntu
5ac751e8d623: Error pulling image (quantal) from ubuntu, Driver devicemapper failed to create image rootfs 511136ea39cc9ea5ea540: Error pulling image (lucid) from ubuntu, Driver devicemapper failed to create image rootfs 511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158: Error mounting '/dev/mapper/docker-8:4-547505-511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158' on '/var/lib/docker/devicemapper/mnt/511136ea3c5a64f264b78b5433619f676bd305a4: Error pulling image (saucy) from ubuntu, Driver devicemapper failed to create image rootfs 511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158: Error mounting '/dev/mapper/docker-8:4-547505-511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158' on '/var/lib/docker/devicemapper/mnt/511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158': invalid argument 03b4d4702f3ba7d4d2698e22c15
You can’t perform that action at this time.