Skip to content

Instantly share code, notes, and snippets.

View benley's full-sized avatar
🐈

Benjamin Staffin benley

🐈
View GitHub Profile
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;
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])'
$ 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)
diff --git a/debian/aurora-executor.thermos.init b/debian/aurora-executor.thermos.init
index 24a59d2..3a62cb9 100755
--- a/debian/aurora-executor.thermos.init
+++ b/debian/aurora-executor.thermos.init
@@ -35,15 +35,18 @@ fi
[ -r /etc/default/thermos ] && . /etc/default/thermos
-ARGS="--root=/var/run/thermos
+ARGS="--mesos-root=${MESOS_ROOT:-/var/lib/mesos}
#!/usr/bin/env bash
# Generate a Docker image from a Nix store path.
set -e
USAGE='USAGE: ./nixdock <storepath> [<entrypoint>] [<dockertag>]'
if [[ $# -lt 1 || $# -gt 3 ]]; then
echo "$USAGE" >&2; exit 1
elif [[ "$1" == "--help" ]]; then
echo "$USAGE"; exit 0
import subprocess
from apache.aurora.client.binding_helper import (BindingHelper,
CachingBindingHelper)
from apache.aurora.client.config import GlobalHookRegistry
from pystachio.matcher import Any, Matcher
from twitter.common import log
class NixHelper(CachingBindingHelper):
@benley
benley / Happy-Hacking-Keyboard-Professional-2.kbd.json
Last active December 19, 2015 21:50
Happy Hacking Keyboard Professional 2
[
{
"name": "Happy Hacking Keyboard Professional 2"
},
[
{
"a": 6
},
"Esc\n\n\n\nPower",
{
{
"cluster": "devcluster",
"environment": "devel",
"name": "hello_world",
"role": "vagrant",
"service": true,
"task": {
"constraints": [
{
"order": [
@benley
benley / default.nix
Created August 24, 2015 03:48
npm2nix nix nix nix
{ npm2nix ? { outPath = ./.; name = "npm2nix"; }
, pkgs ? import <nixpkgs> {}
}:
let
nodePackages = import "${pkgs.path}/pkgs/top-level/node-packages.nix" {
inherit pkgs;
inherit (pkgs) stdenv nodejs fetchurl fetchgit;
neededNatives = [ pkgs.python ] ++ pkgs.lib.optional pkgs.stdenv.isLinux pkgs.utillinux;
self = nodePackages;
generated = ./package.nix;
#!/bin/bash
# Build, export, and publish the Nix dependencies of an Aurora job.
# Then use the aurora commandline utility to launch it.
#
# This should really be an Aurora client hook, or at least a
# better-integrated wrapper script.
set -e
attr=${1:?USAGE: $0 <attribute>}
shift