Skip to content

Instantly share code, notes, and snippets.

View benley's full-sized avatar
🐈

Benjamin Staffin benley

🐈
View GitHub Profile
new_http_archive(
name = "docker_ubuntu",
build_file_content = """
docker_build(
name = "trusty",
tars = ["trusty/ubuntu-trusty-core-cloudimg-amd64-root.tar.gz"],
visibility = ["//visibility:public"]
)
""",
sha256 = "de31e6fcb843068965de5945c11a6f86399be5e4208c7299fb7311634fb41943",
def _get_docker_env(repository_ctx):
"""Get whitelisted environment variables from the local system."""
env = {}
env_whitelist = [
"HTTP_PROXY", "http_proxy",
"HTTPS_PROXY", "https_proxy",
"NO_PROXY", "no_proxy",
]
for k, v in repository_ctx.os.environ.items():
if k in env_whitelist or k.startswith("DOCKER"):
git_repository(
name = "io_bazel_rules_go",
commit = "878185a8d66cb4a3fb93602d8e8bc2f50cd69616",
remote = "https://github.com/bazelbuild/rules_go",
)
load(
"@io_bazel_rules_go//go:def.bzl",
"go_repositories",
"go_repository",
#!/bin/bash
# This script will be run bazel when building process starts to
# generate key-value information that represents the status of the
# workspace. The output should be like
#
# KEY1 VALUE1
# KEY2 VALUE2
#
# If the script exits with non-zero code, it's considered as a failure
"""gen_build_data: generate build_data from various templates.
This does something very simple: concatenates bazel's stable-status and
volatile-status linkstamp data with an optional header and footer.
"""
def _gen_build_data_impl(ctx):
cmd = ["cat"]
inputs = [
ctx.version_file, # volatile-status.txt
# Generated by running `configure --enable-unicode=ucs2` on MacOS 10.11.6
DEFINES_DARWIN = [
"Py_PYCONFIG_H",
"DOUBLE_IS_LITTLE_ENDIAN_IEEE754=1",
"ENABLE_IPV6=1",
"HAVE_ACOSH=1",
"HAVE_ADDRINFO=1",
"HAVE_ALARM=1",
"HAVE_ALLOCA_H=1",
"HAVE_ASINH=1",
@benley
benley / P1b.hs
Last active December 5, 2016 07:25
{-# LANGUAGE TupleSections #-}
module P1b where -- http://adventofcode.com/2016/day/1
import Data.String.Utils (split, strip)
data Direction = North | East | South | West
runbunny :: Integral a => Read a =>
[(a, a)] -- coordinates already visited
@benley
benley / rules.prom
Last active December 15, 2016 19:56
# What's the difference in meaning between these two prometheus rules?
query_version_a =
(
sum
by (source)
(
(
(
rate(cpu_user_seconds_total[3m])
module Parse where
import Control.Monad (void)
import qualified Data.Char
import Text.Megaparsec
import Text.Megaparsec.String
import qualified Text.Megaparsec.Lexer as L
data JsonnetNumber = JInt Integer
| JFloat Double
{ config, lib, ... }:
{
nixpkgs.config.packageOverrides = super: let self = super.pkgs; in
{
myHaskellEnv = self.haskellPackages.ghcWithHoogle
(haskellPackages: with HaskellPackages; [
# libraries
arrows async cgi criterion
# tools