Skip to content

Instantly share code, notes, and snippets.

Lawrence Jones lawrencejones

Block or report user

Report or block lawrencejones

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
lawrencejones /
Created Mar 25, 2020
Find indices that require forcemerging

Force-merge analysis

Find indicies that still require force-merging

lawrencejones / main.jsonnet
Created Feb 11, 2020
Custom jsonnet library for ES cluster
View main.jsonnet
local k = import 'vendor/k8s.libsonnet';
k {
_config+:: {
name: 'name',
namespace: 'namespace',
node_storage: '5Gi',
labels: { app: 'elastic-cloud' },
version: '7.5.2',
master_replicas: 3,
lawrencejones /
Created Feb 6, 2020
GoCardless response header changes, from 14th February onward

(a) Request without downcasing opt-in

This is what we'll be serving until February 14th, after which we'll switch to the downcased version by default.

$ curl -v --http1.1 \
    -H "authorization: Bearer $TOKEN" \
    -H 'gocardless-version: 2015-07-06' \
    -H 'content-type: application/json' \
lawrencejones /
Last active Jan 10, 2020
Comparison of Postgres logs


log_min_duration_statement=0, log_statement=none

2020-01-10 09:01:07.456 UTC [9359] LOG:  duration: 0.127 ms  parse <unnamed>: select pg_sleep($1)
2020-01-10 09:01:07.457 UTC [9359] LOG:  duration: 0.078 ms  bind <unnamed>: select pg_sleep($1)
2020-01-10 09:01:07.457 UTC [9359] DETAIL:  parameters: $1 = '2'

2020-01-10 09:01:09.461 UTC [9359] LOG:  duration: 2004.025 ms  execute <unnamed>: select pg_sleep($1)
lawrencejones / manifest.go
Created Nov 16, 2019
Example of validated manifest
View manifest.go
package manifest
import (
// Manifest describes a single Kubernetes manifest. Manifests should only ever be
// constructed using the NewManifest method, to ensure the resource is well-formed.
lawrencejones / config.libsonnet
Last active Nov 12, 2019
external-dsn jsonnet module
View config.libsonnet
_images+:: {
external_dns: "",
_config+:: {
external_dns: {
namespace: "external-dns",
domain_filter: [
lawrencejones / logger.rb
Created Sep 6, 2019
Simple logfmt logger in Ruby
View logger.rb
# frozen_string_literal: true
require "logger"
require "values"
module App
module Logger
class ContextualLogger <, :context)
def log(**kwargs)
lawrencejones / 11
Last active May 17, 2019
Stolon sentinel locking up due to etcd
View 11
λ (lab) ~> kl stolon-main-sentinel-backend-stolon-main-sentinel-78d4d597c2lsv -f
2019-05-16T02:57:57.750Z INFO cmd/sentinel.go:1962 sentinel uid {"uid": "f3e6c1b3"}
2019-05-16T02:57:57.850Z INFO cmd/sentinel.go:80 Trying to acquire sentinels leadership
2019-05-16T07:19:41.806Z ERROR cmd/sentinel.go:100 election loop error {"error": "lost watcher waiting for delete"}
2019-05-16T07:19:51.806Z INFO cmd/sentinel.go:80 Trying to acquire sentinels leadership
2019-05-16T07:25:43.371Z ERROR cmd/sentinel.go:1815 error retrieving cluster data {"error": "context deadline exceeded"}
PC=0x45ae01 m=0 sigcode=0
lawrencejones / 01-disable.bash
Last active May 2, 2019
Upgrade process for PG9.4 -> 11
View 01-disable.bash
#!/usr/bin/env bash
all-databases() {
cd /tmp && sudo -u postgres psql -U pgbouncer pgbouncer -c 'show databases;' -p 6432 | grep -Po '^ gc_\S+'
disable-databases() {
xargs -n1 -I _DATABASE_ sudo -u postgres psql -U pgbouncer pgbouncer -p 6432 -c 'disable _DATABASE_;'
You can’t perform that action at this time.