Skip to content

Instantly share code, notes, and snippets.

{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
@jm-g
jm-g / sbt-driver
Last active June 4, 2019 20:12
reproduce a memory leak with sbt reload
#!/usr/bin/expect -f
#exp_internal 1
log_file sbt.log
spawn sbt -no-global -J-Xmx200m -J-Xms200m -J-XX:+ExitOnOutOfMemoryError -Dsbt.version=1.3.0-RC1
# send_log $start
for {set NUM 0} {$NUM <= 200} {incr NUM} {
expect "> "
send "reload\n"
@jm-g
jm-g / CompositeOrdering.scala
Last active December 25, 2018 21:41
Scala Ordering Helper
final class CompositeOrdering[T]( val ord1: Ordering[T], val ord2: Ordering[T] ) extends Ordering[T] {
def compare( x: T, y: T ) = {
val comp = ord1.compare( x, y )
if ( comp != 0 ) comp else ord2.compare( x, y )
}
}
object CompositeOrdering {
def apply[T]( orderings: Ordering[T] * ) = orderings reduceLeft (_ orElse _)
@jm-g
jm-g / update-docker-docs
Last active September 23, 2016 14:58 — forked from jasonmp85/update-docker-docs
Install Docker man pages for your Docker version
#!/bin/bash
# make bash behave
set -euo pipefail
IFS=$'\n\t'
# adapted from: http://stackoverflow.com/a/32239112
# create tmpdir and register cleanup callback
tmpdir=$(mktemp -d ~/.docker-man.XXXXXXXX)
@jm-g
jm-g / IntFieldBug.hs
Created February 4, 2012 12:17
Demonstrate a bug in yesod-form's intField
{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses,
TemplateHaskell, OverloadedStrings #-}
import Control.Applicative
import Data.Text
import Yesod
import Yesod.Form
data HelloWorld = HelloWorld