Skip to content

Instantly share code, notes, and snippets.

Avatar

Lawrence Jones lawrencejones

View GitHub Profile
@lawrencejones
lawrencejones / README.md
Last active Nov 6, 2020
Connected data: Using BigQuery to analyse user behaviour in response to webhooks
View README.md

This gist contains code samples for the blog post "Connected data: Using BigQuery to analyse user behaviour in response to webhooks".

https://blog.lawrencejones.dev/

@lawrencejones
lawrencejones / consoles.go
Created Oct 5, 2020
Theatre consoles wrapper
View consoles.go
package cmd
import (
"bytes"
"context"
"encoding/json"
"fmt"
"os"
"strings"
"text/template"
@lawrencejones
lawrencejones / Makefile
Last active Oct 15, 2020
Why you need a service registry
View Makefile
make-it-rain.json: make-it-rain.jsonnet
jsonnet -J $(ANU_ROOT)/utopia/lib -J $(ANU_ROOT)/utopia/jvendor $^ > $@
View argocd-rbac.jsonnet
local registry = import 'registry/index.jsonnet';
// Compute the rbac rules that should be configured in ArgoCD, using the service
// registry to determine who should be given what permissions.
//
// This module can be evaluated concretely, which may help to debug the rbac
// list for ArgoCD.
{
_config:: {
// Operator grants- anyone with admin or operator should be permitted to
View app.jsonnet
local app = import 'app.libsonnet';
app {
_config+:: {
release: 'release-bot',
namespace: 'connect-team',
environment: 'production',
app: 'release-bot',
image: 'eu.gcr.io/gc-containers/gocardless/release-bot',
tag: 'TODO',
@lawrencejones
lawrencejones / _hidden.libsonnet
Created Jun 1, 2020
Theatre auto-generated CRDs
View _hidden.libsonnet
{
local hidden = (import '_hidden.libsonnet'),
rbac:: {
v1alpha1:: {
local apiVersion = { apiVersion: 'rbac/v1alpha1' },
// Computer generated, description unknown
directoryRoleBinding:: {
new():: {},
withMetadata(metadata):: self + { metadata: metadata },
withMetadataMixin(metadata):: self + { metadata+: metadata },
@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)
You can’t perform that action at this time.