Skip to content

Instantly share code, notes, and snippets.

#s(hash-table size 18699 test equal rehash-size 1.5 rehash-threshold 0.8 data (:state-size 2 ("Here" "are") ("the" "the" "the" "the") ("are" "the") ("wrong" "trends" "trends" "trends" "trends") ("the" "trends") ("highlighted" "highlighted" "highlighted" "highlighted") ("trends" "highlighted") ("in" "in" "in" "in") ("highlighted" "in") ("this" "this" "this" "this") ("in" "this") ("document" "field." "space" "space." "edition:" "vibrant" "edition:" "edition" "edition:" "edition:") ("this" "edition:") ("Mobile—As" "•" "•" "Early") ("edition:" "Early") ("warning") ("Early" "warning") ("and" "and") ("warning" "and") ("recovery" "recovery") ("and" "recovery") ("in" "in") ("recovery" "in") ("production" "production") ("in" "production") ("using" "code." "-" "-") ("production" "-") ("We" "We") ("-" "We") ("are" "are") ("We" "are") ("reiterating" "always" "seeing" "strong" "pleased" "especially" "rapidly" "seeing" "interested" "excited" "not" "aware" "a" "also" "interested" "interested" "aware" "placing" "already" "in
(ns russel-quiz
(:require [clojure.math.numeric-tower :as math]
[loom.graph :as graph :refer [digraph]]
[loom.alg :as alg]))
(defn lcm
"Calculate least common multiple of some numbers."
([a b] (math/lcm a b))
([a b & more] (reduce lcm (lcm a b) more)))
@ragnard
ragnard / project.clj
Last active August 29, 2015 14:05
lein-docker
(defproject my-project
...
:plugins [[lein-docker "0.1.0-SNAPSHOT"]]
:docker {:image "ragge/clojure"
:ports {3000 8080}
:env {"SECRET_KEY" "lolcat"}}
...)
(require '[clojure.java.io :as io]
'[clojure.core.protocols :as protocols])
(defn line-reducible
"Given a source as accepted by clojure.java.io/reader, return a
reducible of the lines (as interpreted by clojure.core/line-seq) in
that source."
[source]
(reify
protocols/CollReduce
@ragnard
ragnard / nixos.sh
Last active August 29, 2015 14:13
nixos.sh
# sda1 = 512M EFI VFAT
# sda2 = swap
# sda3 = zfs
mkfs.vfat /dev/sda1
mkswap /dev/sda2
cryptsetup -y -v luksFormat /dev/sda3
cryptsetup open /dev/sda3 cryptroot
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@ragnard
ragnard / gist:a48f337a581a736e01b5
Last active August 29, 2015 14:16
Configuring a component system?
(require
'[schema.core :as s]
'[com.stuartsierra.component :as component])
;;--------------------------------------------------------------------
;; A protocol for components that want configuration. To satisfy
;; protocol, they must provide a schema for their config.
(defprotocol IRequireConfig
(config-schema [this] "return schema of config for this component"))
{ config, pkgs, lib, ...}:
{
# mesos local test cluster
services.zookeeper = {
enable = true;
dataDir = "/data/zookeeper";
};
# Welcome to the InfluxDB configuration file.
# If hostname (on the OS) doesn't return a name that can be resolved by the other
# systems in the cluster, you'll have to set the hostname to an IP or something
# that can be resolved here.
# hostname = ""
bind-address = "0.0.0.0"
# Once every 24 hours InfluxDB will report anonymous data to m.influxdb.com
libs:
rm -rf lib/*
mkdir -p lib
lein classpath \
| tr ':' '\n' \
| grep -Fv ${realpath ${PWD}} \
| xargs -Ijar cp -v jar lib/