Skip to content

Instantly share code, notes, and snippets.

View benley's full-sized avatar
🐈

Benjamin Staffin benley

🐈
View GitHub Profile
$ bazel build //...
........
INFO: Found 42 targets...
Unhandled exception thrown during build; message: Multiple entries with same key: =/Users/bstaffin/src and =/Users/bstaffin/src
INFO: Elapsed time: 3.933s
java.lang.IllegalArgumentException: Multiple entries with same key: =/Users/bstaffin/src and =/Users/bstaffin/src
at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:136)
at com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket(RegularImmutableMap.java:98)
at com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:84)
at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:295)
pants binary src/main/python/apache/aurora/executor:thermos_executor
import.im6: unable to open X server `' @ error/import.c/ImportImageCommand/368.
import.im6: unable to open X server `' @ error/import.c/ImportImageCommand/368.
from: too many arguments
/Users/bstaffin/.cache/pants/setup/bootstrap/0.0.70/bin/pants: line 10: syntax error near unexpected token `('
/Users/bstaffin/.cache/pants/setup/bootstrap/0.0.70/bin/pants: line 10: ` sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])'
local toInt(x) = if x > (std.floor(x) + 0.5) then std.floor(x) + 1 else std.floor(x);
local sum(xs) = std.foldl(function(a,b) a+b, xs, 0);
local headn(x) = std.floor(x/10);
local tailn(x) = toInt(((x/10) - headn(x)) * 10);
local sumdigits(x) = if x < 10 then x else sumdigits(headn(x)) + tailn(x);
local splitrev(x) = if x<10 then [x] else [tailn(x)] + splitrev(headn(x));
local luhn(x) =
local xs = splitrev(x);
(sum(xs[::2]) + sum([sumdigits(n*2) for n in xs[1::2]])) % 10 == 0;
@benley
benley / shittylife.hs
Last active May 8, 2024 21:58
conway's game of 💩
-- conway's game of 💩
-- shittily written by benley
module Main where
import Control.Concurrent
import Data.Array.Unboxed
import System.Environment
data Cell = Live | Dead deriving Eq
// Render any jsonnet value (except functions) to TOML format.
local
inlineTable(body) =
"{" +
std.join(", ", ["%s = %s" % [escapeKeyToml(k), renderBody(body[k])] for k in std.objectFields(body)]) +
"}",
renderArray(body) =
local
let pkgs = import <nixpkgs> {}; in
pkgs.lib.overrideDerivation pkgs.apacheKafka
(xx: {
buildInputs = xx.buildInputs ++ [ pkgs.extradep1 pkgs.extradep2 ];
})
let
pkgs = import <nixpkgs> {};
default = pkgs.callPackage (import ./default.nix);
in
pkgs.stdenv.mkDerivation {
name = "fake";
buildInputs = [
default
pkgs.extradep1
let
pkgs = import <nixpkgs> {};
default = pkgs.callPackage ./default.nix { };
in
pkgs.stdenv.mkDerivation {
name = "fake";
buildInputs = [
default
pkgs.extradep1
{ lib, bundlerEnv, stdenv }:
let
name = "hiera-eyaml-2.1.0";
env = bundlerEnv {
inherit name;
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
gemset = ./gemset.nix;
@benley
benley / linkerd.conf.yml
Last active November 8, 2016 10:27
example: linkerd config for aurora job backends
# Example linkerd.conf for aurora jobs
admin: { port: '31218' }
namers:
- kind: io.l5d.serversets
prefix: /zk/dal09
zkAddrs:
- { host: zk1.dal09.prod.example.com, port: '2181'}
- { host: zk2.dal09.prod.example.com, port: '2181'}