Skip to content

Instantly share code, notes, and snippets.

View benley's full-sized avatar
🐈

Benjamin Staffin benley

🐈
View GitHub Profile
@benley
benley / binding_helper.aurora.py
Created August 6, 2015 21:15
aurora client binding hooks madness (unfinished proof of concept)
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):
[Default Applications]
x-scheme-handler/http=chromium.desktop;
x-scheme-handler/https=chromium.desktop;
x-scheme-handler/ftp=chromium.desktop;
x-scheme-handler/chrome=chromium.desktop;
application/x-extension-htm=chromium.desktop;
application/x-extension-html=chromium.desktop;
application/x-extension-shtml=chromium.desktop;
application/x-extension-xhtml=chromium.desktop;
application/x-extension-xht=chromium.desktop;
@benley
benley / gist:e4cc4ca8f1630cd609e5
Created August 3, 2015 04:06
chromium build failure
ninja: Entering directory `out/Release'
[1/3] CC obj/sandbox/linux/suid/chrome_sandbox.process_util_linux.o
[2/3] CC obj/sandbox/linux/suid/chrome_sandbox.sandbox.o
[3/3] LINK chrome_sandbox
ninja: Entering directory `out/Release'
ninja: error: '../../native_client/toolchain/linux_x86/nacl_x86_newlib/nacl_x86_newlib.json', needed by 'gen/tc_irt/lib64/libppapi_proxy_nacl.a', missing and no known rule to make it
builder for ‘/nix/store/qmnrn1f2mja2qvjyp4sn2d6p34czink3-chromium-44.0.2403.89.drv’ failed with exit code 1
cannot build derivation ‘/nix/store/gqfyx6xg2kvac6w1jbp6if3f0yvp0zf6-chromium-beta-44.0.2403.89.drv’: 1 dependencies couldn't be built
#!/usr/bin/env python
"""Generate authorized_keys for Github users/teams/organizations."""
from __future__ import print_function
import github
from pyglib import app
from pyglib import gflags
from pyglib import log
gflags.DEFINE_string(
{ pythonPackages }:
let
buildPythonScript = { src, ... }@args:
let
name = args.name or (removeSuffix ".py" (baseNameOf src));
setup.py = builtins.toFile "setup.py" ''
import setuptools
setuptools.setup(
name = "${name}",
@benley
benley / middleware.wsgi
Last active February 24, 2017 10:33
wsgi middleware for basic Prometheus monitoring instrumentation
"""WSGI middleware for basic Prometheus monitoring instrumentation."""
import prometheus_client
import werkzeug.wrappers
Counter = prometheus_client.Counter
Histogram = prometheus_client.Histogram
INF = float('inf')
@benley
benley / hydra.aurora
Created June 1, 2015 09:08
Hydra on aurora
include('lib/nix.aurora')
include('lib/structs.aurora')
include('hydra.secrets')
class Logo(Struct):
url = Required(String)
filetype = Default(String, 'png')
GRAVATAR = Logo(
url = "https://secure.gravatar.com/avatar/13ddbf022b98acb2e32dbe8d72b81b22.jpg",
##### DPI STUFF
# Fonts: 192dpi
Xft/DPI 196608
### Use either this:
#Gdk/UnscaledDPI 196608
#Gdk/WindowScalingFactor 1
### *or* this:
{ config, lib, pkgs, ... }:
services.mesos.master = {
enable = true;
zk = "zk://zookeeper.example.com:2181/mesos";
extraCmdLineOptions = [
"--cluster=name_your_cluster"
];
quorum = 2 # floor((number of mesos masters)/2) + 1
};
let
lib = import <nixpkgs/lib>;
docker_registry = https://docker-registry.example.com;
master_zk_url = zk://zookeeper.example:2181/mesos;
attributes = {
os = "nixos";
host = null; # hostname
rack = "1"; # us-east-1a etc