Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
host="functional.cafe"
now="$(date -u '+%a, %d %b %Y %H:%M:%S GMT')"
published="$(date -u +'%FT%R:%SZ')"
doc=$(cat <<EOF
{
"@context": "https://www.w3.org/ns/activitystreams",
Uses:
* https://github.com/sos4nt/dynamic-colors
* A simple script to switch all active terminals: https://github.com/sos4nt/dynamic-colors/issues/12
* feh to switch bg
src/terrain.o src/terrain.d : src/terrain.c src/terrain.h src/geometry.h src/common.h \
src/buffer.h src/gl.h src/util.h src/vec3.h src/mat4.h src/delaunay.h \
src/perlin.h src/poisson.h
@jb55
jb55 / config.nix
Last active April 23, 2018 19:05
nix git deploys
{
pkg-json = lib.importJSON /var/git/project/deploy.json;
pkg = (import (pkgs.fetchgit pkg-json) {}).package;
}
packageOverrides = super: {
haskellPackages = super.haskellPackages.override {
overrides = {
some-pkg = pkgs.haskell.lib.overrideCabal super.some-pkg (orig: {
src = fetchFromGithub {};
});
};
};
#! /usr/bin/env nix-shell
#! nix-shell -i racket -p racket
#lang racket
(require racket/pretty)
(define (pretty-write-all)
(define next (read))
@jb55
jb55 / Main.hs
Last active March 17, 2018 16:44
#!/usr/bin/env stack
{- stack script --nix --resolver lts-10.9
--package streaming
--package amazonka
--package amazonka-s3
--package amazonka-core
--package bytestring
--package resourcet
--package conduit
--package conduit-combinators
@jb55
jb55 / test.csv
Last active February 14, 2018 20:20
name age interest age2 age3
bill 29 bitcoin 29 29
vanessa 33 wine 33 33
@jb55
jb55 / output
Last active December 19, 2017 20:54
Simple functional testing with bash
1..4
ok 1 - scalar division
ok 2 - scalar multiplication
not ok 3 - multiply 1 BTC to the smallest unit
#
# got '0 msat', expected '1 msat'
#
ok 4 - lots of msats
@jb55
jb55 / parseCsv.fs
Created April 1, 2011 01:38
Rock solid csv parser
open FParsec.Primitives
open FParsec.CharParsers
type CsvResult = { IsSuccess : bool; ErrorMsg : string; Result : string list list }
// Some simple helpers
let isWs s = Seq.map (isAnyOf "\t ") s
|> Seq.reduce (&&)
let ws = spaces