Skip to content

Instantly share code, notes, and snippets.

View barrucadu's full-sized avatar

Michael Walker barrucadu

View GitHub Profile
> {-# 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 [email protected]); 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
#!/usr/bin/env python
"""
A one-off script to migrate documents from the ES5 metasearch index to ES6.
This is necessary because trying to republish all best bets from search-admin frequently fails due to transient network issues.
Requires two Elasticsearch clients: client5 and client6. These use different versions of the python client.
client5 fetches a page of docs from the old index, and client6 POSTs them to the new index. Simple!
"""