Skip to content

Instantly share code, notes, and snippets.

View barrucadu's full-sized avatar

Michael Walker barrucadu

View GitHub Profile
I've got three nodes in an AWS VPC: a jumpbox accessible by external SSH (configuration file: jumpbox.nix), a
k8s master node (configuration file: k8s-master.nix) and a k8s worker node (configuration file: k8s-slave.nix)
in a private subnet (with all traffic allowed between them).
All these .nix files, and the deploy.sh file, are copied to ~/nixos on the jumpbox and then deploy.sh run to set
everything up.
DNS is set up so that these domains resolve to the right machines:
- k8s-master.govuk-k8s.test
- k8s-slave.govuk-k8s.test
> {-# LANGUAGE GADTs #-}
>
> import Prelude hiding (filter, null)
> import qualified Data.List as L
> import qualified Data.Set as S
>
> data FlexiSet a where
> EqSet :: Eq a => [a] -> FlexiSet a
> OrdSet :: Ord a => S.Set a -> FlexiSet a
>
:root {
--main-bg-color: #3c3a3f;
--main-text-color: #fbf2e9;
/* etc */
}
body {
font-family: sans-serif;
font-size: 14px;
line-height: 1.5;
for hash in $(git log --format='%H' --no-merges --author=mike@barrucadu.co.uk); do
msg_len=$(git show --format='%B' --no-patch $hash | wc -c)
full_len=$(git show --format='%B' $hash | wc -c)
echo -e "$(echo "($full_len - $msg_len) / $msg_len" | bc -l)\t$(git show --oneline --no-patch $hash)"
done | sort -h
#!/usr/bin/env stack
{- stack
script
--nix --no-nix-pure
--resolver lts-14.7
--package boxes,containers,Decimal,hledger-lib,text,time
-}
{-# OPTIONS_GHC -Weverything -Wno-implicit-prelude -Wno-missing-export-lists -Wno-unsafe #-}
#!/usr/bin/env bash
bucket="govuk-integration-elasticsearch6-manual-snapshots"
archive_path="$HOME/govuk-data-sync/elasticsearch-6"
echo "Replicating elasticsearch"
if [[ -e $archive_path ]]; then
echo "Skipping download - remove ${archive_path} to force"
else
#!/usr/bin/env nix-shell
#! nix-shell -i python3 -p "python3.withPackages (ps: [ps.requests ps.tabulate])"
import csv
import math
import os
import requests
from tabulate import tabulate
@barrucadu
barrucadu / analyse.py
Created August 13, 2019 10:42
Python 2 scripts, but they do the job. Variables refer to ES2 because this is a small tweak on the original script (https://gist.github.com/brucebolt/ec211868299b8efbdde7877e9a2d3c10)
import csv
import re
results_es2 = {}
results_es5 = {}
with open('results.txt', 'rb') as f:
rows = csv.reader(f, delimiter='\t')
next(rows, None)
for row in rows:

The roles are: 2i A, 2i B, CR, 2ndline A, 2ndline B

Hard constraints

A rota will always satisfy all of these:

  1. In every week:
    1. Each role must be assigned to exactly one person.
    2. For the 2i rota:
  2. 2i A must be able to do 2i
diff --git a/Makefile b/Makefile
index ce97448..406bd72 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,6 @@
-GOVUK_ROOT_DIR ?= "${HOME}/govuk"
+GOVUK_ROOT_DIR ?= $(HOME)/govuk
+GOVUK_DOCKER_DIR ?= $(GOVUK_ROOT_DIR)/govuk-docker
+GOVUK_DOCKER ?= $(GOVUK_DOCKER_DIR)/bin/govuk-docker