Skip to content

Instantly share code, notes, and snippets.

Step one

curl https://nixos.org/nix/install | sh

Step two

Add the following lines to the end of ~/.zshrc:

source $HOME/.nix-profile/etc/profile.d/nix.sh

execve("/nix/store/4b8pl58v6619ns5il393ibiq7pf1gyls-displaylink-1.1.62/bin/DisplayLinkManager", ["/nix/store/4b8pl58v6619ns5il393i"...], [/* 55 vars */]) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb202b6e000
access("/etc/ld-nix.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/run/opengl-driver/lib/tls/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/run/opengl-driver/lib/tls/x86_64", 0x7ffe36bbfc00) = -1 ENOENT (No such file or directory)
open("/run/opengl-driver/lib/tls/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/run/opengl-driver/lib/tls", 0x7ffe36bbfc00) = -1 ENOENT (No such file or directory)
open("/run/opengl-driver/lib/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/run/opengl-driver/lib/x86_64", 0x7ffe36bbfc00) = -1 ENOENT (No such file or directory)
open("/run/opengl-driver/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such fi
execve("/nix/store/4b8pl58v6619ns5il393ibiq7pf1gyls-displaylink-1.1.62/bin/DisplayLinkManager", ["/nix/store/4b8pl58v6619ns5il393i"...], [/* 83 vars */]) = 0
brk(NULL) = 0x112f000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2562cdd000
access("/etc/ld-nix.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/run/opengl-driver/lib/tls/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/run/opengl-driver/lib/tls/x86_64", 0x7fffab720ed0) = -1 ENOENT (No such file or directory)
open("/run/opengl-driver/lib/tls/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/run/opengl-driver/lib/tls", 0x7fffab720ed0) = -1 ENOENT (No such file or directory)
open("/run/opengl-driver/lib/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/run/opengl-driver/lib/x86_64", 0x7fffab720ed0) = -1 ENOENT (No such file or directory)
'use strict';
const x = (() => {
// This is always >= 0
let nonNegative = 0;
return {
// Return the value

Best thing about Docker

To run something messy with complicated dependencies that was designed for a big distro like Ubuntu and doesn't have a Nix package built for it yet, Docker provides a sledgehammer approach that is simple and reliable.

For things like CI servers, it seems like a good lightweight alternative to VMs.

Worst thing about Docker

Here's a simple way to generate a good password that's easy to remember.

curl 'https://raw.githubusercontent.com/trezor/python-mnemonic/master/mnemonic/wordlist/english.txt' \
  | shuf | head -n 4 | tr '\n' ' '

The password will consist of four random words. The words are pulled from a dictionary with 2048 = 211 entries, so the password's has 44 bits of entropy.

Herein, A, B, and C will always refer to finite sets.

Definition: |A| denotes the cardinality of A.

Definition: A -> B denotes the set of functions from A to B, where a function is a one-to-one mapping from domain A to codomain B.

For example, if A = {1, 2} and B = {4, 5, 6}, then there are exactly nine functions A -> B:

1 -> 4, 2 -> 4        1 -> 5, 2 -> 4        1 -> 6, 2 -> 4
1 -> 4, 2 -> 5        1 -> 5, 2 -> 5        1 -> 6, 2 -> 5
{ nixpkgs ? import <nixpkgs> {}, compiler ? "lts-5_8" }:
(nixpkgs.pkgs.haskell.packages.${compiler}.override {
overrides = self: super: {
projectB = self.callPackage /path-to-project-B {};
};
}).callPackage ./project-A.nix { }
import java.time.{Duration, Instant}
import scalaz._, Scalaz._, effect._, IO._
import org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace
package object test_framework {
sealed trait Test
final case class TestExecution(
name: String,
/**
* Moment.js doesn't have the particular locale-aware format string
* that we need here, so this is an ugly workaround to derive it
* from some related format strings that it does have.
* https://github.com/moment/moment/issues/2505
*/
function getMomentDateFormat() {
var localeData = moment.localeData(moment.locale()),
llll = localeData.longDateFormat('LLLL'),
lll = localeData.longDateFormat('LLL'),