Skip to content

Instantly share code, notes, and snippets.

🐘 🐇 🐍

Gavin M. Roy gmr

🐘 🐇 🐍
Block or report user

Report or block gmr

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
View redirect-list.sql
WITH RECURSIVE recursive_url_relationships (job_id, source, source_url, target, target_url, redirect) AS
(SELECT a.job_id,
b.value AS source_url,,
c.value AS target_url,
FROM url_relationships AS a
JOIN urls AS b ON = a.source
View pglifecycle-table.json
"$schema": "",
"$id": "",
"title": "Table",
"description": "Defines a table",
"type": "object",
"properties": {
"name": {
"title": "Name",
"description": "The table name",
gmr /
Last active Jun 4, 2019
Example usage of pgdumplib to read data from a pg_dump file
import pgdumplib
dump = pgdumplib.load('build/data/dump.compressed')
print('# Header: {}'.format(dump.toc.header))
print('# Database: {}'.format(dump.toc.dbname))
print('# Archive Timestamp: {}'.format(dump.toc.timestamp))
print('# Server Version: {}'.format(dump.toc.server_version))
print('# Dump Version: {}'.format(dump.toc.dump_version))
import gzip
import requests
r = requests.get('')
with open('incident.xml', 'w') as handle:
gmr /
Created Aug 29, 2018
Small Python CLI application for removing any object tags from all objects in a bucket
#!/usr/bin/env python3
import argparse
import logging
import sys
import boto3
LOGGER = logging.getLogger(__name__)
gmr / table_sizes.sql
Last active Feb 6, 2018
A PostgreSQL view that combines the relation size, the size of its indexes, the size of its toast table, and the size of the toast table indexes, combines them to give you a total table size.
View table_sizes.sql
CREATE OR REPLACE VIEW public.table_sizes AS
WITH tables AS (
SELECT a.oid, b.nspname, a.relname, a.reltoastrelid, pg_relation_size(a.oid) AS size
FROM pg_class AS a
JOIN pg_namespace AS b ON b.oid = a.relnamespace
WHERE a.relkind = 'r'
AND b.nspname NOT IN ('pg_catalog', 'information_schema')),
indexes AS (
SELECT i.oid, n.nspname, i.relname AS idxname, c.oid AS reloid, c.relname AS relname,
pg_relation_size(i.oid) AS size
View gist:3c28c9e3a71f5ef9fd83f1867fa6f11f
Time: 3198.725 ms (00:03.199)
Time: 6887.960 ms (00:06.888)
Time: 10622.234 ms (00:10.622)
Time: 13110.130 ms (00:13.110)
Time: 21388.449 ms (00:21.388)
Time: 24127.707 ms (00:24.128)
Time: 28515.858 ms (00:28.516)
Time: 32666.766 ms (00:32.667)
gmr / rabbitmq-autocluster_k8s_persistent.bash
Created Jan 10, 2018 — forked from pmint93/rabbitmq-autocluster_k8s_persistent.bash
Deploy rabbitmq-autocluster on k8s with persistent storage (EBS)
View rabbitmq-autocluster_k8s_persistent.bash
set -eo pipefail
export KUBE_NAMESPACE=test
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1beta1
kind: StatefulSet
View gist:bbc2ed6bdf79c6b6f82aa13bdd9f35de
2017/11/29 14:20:09.628249 [INFO] envconsul v0.7.2 (a508c43)
2017/11/29 14:20:09.629523 [INFO] (runner) creating new runner (once: false)
2017/11/29 14:20:09.630590 [DEBUG] (runner) final config: {"Consul":{"Address":"","Auth":{"Enabled":false,"Username":"","Password":""},"Retry":{"Attempts":12,"Backoff":1000000000,"MaxBackoff":120000000000,"Enabled":true},"SSL":{"CaCert":"","CaPath":"","Cert":"","Enabled":false,"Key":"","ServerName":"","Verify":true},"Token":"","Transport":{"DialKeepAlive":30000000000,"DialTimeout":30000000000,"DisableKeepAlives":false,"IdleConnTimeout":90000000000,"MaxIdleConns":100,"MaxIdleConnsPerHost":2,"TLSHandshakeTimeout":10000000000}},"Exec":{"Command":"/usr/local/bin/","Enabled":true,"Env":{"Blacklist":[],"Custom":["CUSTOM_ENV_VAR=FOUND","PATH=$PATH:/etc/myapp/bin"],"Pristine":false,"Whitelist":[]},"KillSignal":15,"KillTimeout":5000000000,"ReloadSignal":null,"Splay":5000000000,"Timeout":0},"KillSignal":2,"LogLevel":"debug","MaxStale":60000000000,"PidFile"
View example.vcl
director autodirector_ random {
.backend = F_us_east_1_assets_aweberstage_com;
.weight = 100;
.backend = F_us_west_1_assets_aweberstage_com;
.weight = 100;
You can’t perform that action at this time.