This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2014–2016 SlamData Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:latest | |
ENV TERM="vt100" \ | |
APK="apk add --no-cache" \ | |
EDGEREPO="http://dl-3.alpinelinux.org/alpine/edge/testing" | |
WORKDIR /root | |
RUN $APK bash curl-dev gmp-dev libuv-dev ncurses-dev openssl-dev \ | |
&& $APK --virtual .build-deps apk-tools file git g++ meson re2c \ | |
&& $APK --repository $EDGEREPO libsigsegv-dev \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
DB="/opt/local/var/macports/registry/registry.db" | |
QUERY="select ports.name,files.path | |
from files | |
inner join ports | |
on files.id=ports.id AND files.path GLOB '/opt/local/bin/*'" | |
sqlite3 -list -separator ' ' "$DB" "$QUERY" \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Test { | |
type List[A] = Option[Cons[A]] | |
final case class Cons[A](hd: A, tl: Option[Cons[A]]) { | |
def nth(n: Int): A = if (n == 1) hd else tl.get nth n - 1 | |
} | |
def list[A](xs: A*): List[A] = if (xs.isEmpty) None else Some(Cons(xs.head, list(xs.tail: _*))) | |
def single[A](hd: A): Cons[A] = Cons(hd, None) | |
// (nth (rest (cons 1 nil)) 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Use google's date range and "verbatim" simultaneously | |
# Paul Phillips <[email protected]> | |
# | |
NAME="$(basename "$0")" | |
read -r -d '' USAGE << EOM | |
usage: $NAME [-s days] [-e days] [search terms] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Skull fracture. | |
Trench engulfment. | |
Worker electrocuted. | |
Worker fatally shot. | |
Worker was murdered. | |
Worker died in falll. | |
Possible heart attack. | |
Worker died in a fall. | |
Worker fell from lift. | |
Worker killed in fall. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
property("longs are evenly-distributed") = | |
forAll { (seed: Seed, b: Base) => | |
val base = b.value | |
def countZeros(s0: Seed, i: Int, seen0: Int): Int = | |
if (i <= 0) seen0 else { | |
val (x, s1) = s0.long | |
val n = (x & 0x7fffffff).toInt % base | |
val seen = if (n == 0) seen0 + 1 else seen0 | |
countZeros(s1, i - 1, seen) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("addition") { | |
it("is communicative") { | |
forAll { (x: Int, y: Int) => | |
(x + y) should equal (y + x) | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("addition") { | |
it("is communicative") { | |
forAll { (x: Int, y: Int) => | |
(x + y) should equal (y + x) | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
set -euo pipefail | |
# set -x | |
export PROJECT SCOPE | |
# This setup echos the times to stderr as they accrue, then | |
# prints the whole list sorted by time to stdout when complete. |