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
lawrencejones / README.md
Created Mar 25, 2020
Find indices that require forcemerging
View README.md

Force-merge analysis

Find indicies that still require force-merging

@lawrencejones
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
lawrencejones / gocardless-headers.md
Created Feb 6, 2020
GoCardless response header changes, from 14th February onward
View gocardless-headers.md

(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
lawrencejones / formats.md
Last active Jan 10, 2020
Comparison of Postgres logs
View formats.md

Formats

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
lawrencejones / manifest.go
Created Nov 16, 2019
Example of validated manifest
View manifest.go
package manifest
import (
"fmt"
"github.com/stretchr/objx"
)
// Manifest describes a single Kubernetes manifest. Manifests should only ever be
// constructed using the NewManifest method, to ensure the resource is well-formed.
@lawrencejones
lawrencejones / config.libsonnet
Last active Nov 12, 2019
external-dsn jsonnet module
View config.libsonnet
{
_images+:: {
external_dns: "registry.opensource.zalan.do/teapot/external-dns:v0.5.17",
},
_config+:: {
external_dns: {
namespace: "external-dns",
domain_filter: [
"lawrjone.xyz",
],
@lawrencejones
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 < Value.new(:logger, :context)
def log(**kwargs)
logger.info(context.merge(kwargs))
@lawrencejones
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"}
SIGQUIT: quit
PC=0x45ae01 m=0 sigcode=0
@lawrencejones
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.