Skip to content

Instantly share code, notes, and snippets.

View gmr's full-sized avatar
:octocat:
🐘 🐇 🐍

Gavin M. Roy gmr

:octocat:
🐘 🐇 🐍
View GitHub Profile
@gmr
gmr / bindify.py
Last active January 26, 2024 14:18
Convert tinydns zone files to bind
#!/usr/bin/env python
import collections
import datetime
from os import path
import pickle
import sys
if len(sys.argv) < 2:
print('Usage: bindify.py zonefile')
@gmr
gmr / vpc.yaml
Last active November 4, 2022 13:59
Demonstration CloudFormation YAML template for creating a VPC
AWSTemplateFormatVersion: '2010-09-09'
Description: VPC Network Stack
Metadata: {}
Mappings: {}
Conditions: {}
Outputs: {}
Parameters:
CidrBlock:
AllowedPattern: '((\d{1,3})\.){3}\d{1,3}/\d{1,2}'
Default: 10.0.0.0/16
@gmr
gmr / timespent_ranking.py
Created January 5, 2012 22:09
Reads in a minecraft server log ranking users by time spent
"""
Minecraft Server Log Time Spent Ranking
"""
__author__ = 'Gavin M. Roy'
__email__ = 'gavinmroy@gmail.com'
__since__ = '2012-01-05'
import datetime
import operator
@gmr
gmr / rabbitmq-autocluster_k8s_persistent.bash
Created January 10, 2018 20:24 — forked from pmint93/rabbitmq-autocluster_k8s_persistent.bash
Deploy rabbitmq-autocluster on k8s with persistent storage (EBS)
#!/bin/bash
set -eo pipefail
export KUBE_NAMESPACE=test
export REPLICA_COUNT=3
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1beta1
kind: StatefulSet
@gmr
gmr / quorum-to-classic.py
Created July 18, 2020 19:40
Python CLI application that converts all quorum queues on a RabbitMQ cluster to classic queues with the intent of not loosing any messages or impacting production workloads (aside from disconnecting consumers on a queue)
#!/usr/bin/env python3
import argparse
import json
import logging
import sys
import time
import typing
from urllib import parse
import httpx
@gmr
gmr / consul.lua
Created July 14, 2014 17:03
Dynamic Nginx upstream nodes using Consul
module("resty.consul", package.seeall)
_VERSION = '0.1.0'
function service_nodes(service)
local http = require "resty.http"
local json = require "cjson"
local hc = http:new()
local upstream = ""
We can't make this file beautiful and searchable because it's too large.
loan_amount,city,state,business_type,industry,lender
495.62,KIHEI,HI,Sole Proprietorship,Reupholstery and Furniture Repair,HawaiiUSA FCU
495.00,HONOLULU,HI,Sole Proprietorship,"Photography Studios, Portrait",First Hawaiian Bank
488.75,KANEOHE,HI,Limited Liability Company(LLC),All Other Personal Services,First Hawaiian Bank
425.00,LIHUE,HI,Sole Proprietorship,Taxi Service,Kaua'i Government Employees' FCU
422.50,KAPOLEI,HI,Sole Proprietorship,Taxi Service,First Hawaiian Bank
415.00,HONOLULU,HI,Limited Liability Company(LLC),Janitorial Services,Bank of Hawaii
325.00,HONOLULU,HI,Limited Liability Company(LLC),All Other Transit and Ground Passenger Transportation,Bank of Hawaii
294.57,KAPOLEI,HI,Limited Liability Company(LLC),Offices of Physicians (except Mental Health Specialists),Bank of Hawaii
282.50,HONOLULU,HI,Limited Liability Partnership,Offices of All Other Miscellaneous Health Practitioners,First Hawaiian Bank
CREATE OR REPLACE VIEW redirect_list AS
WITH RECURSIVE recursive_url_relationships (job_id, source, source_url, target, target_url, redirect) AS
(SELECT a.job_id,
a.source,
b.value AS source_url,
a.target,
c.value AS target_url,
a.redirect
FROM url_relationships AS a
JOIN urls AS b ON b.id = a.source
@gmr
gmr / README.md
Last active April 12, 2020 22:06
Chef + Cobbler Integration files

Note: These work for us with Cobbler 2.2.3 and Chef 11.4.0 on CentOS

Quick Install

These are our install steps on CentOS 6:

mkdir -p ~/.chef/plugins/knife/
curl -o ~/.chef/plugins/knife/set_environment.rb https://gist.github.com/gmr/5339326/raw/5bd498d25bc2f4d17f029cdc4a34ed38e461fec2/set_environment.rb
curl -o /usr/lib/python2.6/site-packages/cobbler/modules/install_pre_chef.py https://gist.github.com/gmr/5339326/raw/0b248a8b40e5bac5673bd7df7cfd60185af778bc/install_pre_chef.py

curl -o /usr/lib/python2.6/site-packages/cobbler/modules/delete_post_chef.py https://gist.github.com/gmr/5339326/raw/ae71362ae721c0391f0be2f4b2166f3806e90a91/delete_post_chef.py

{
"$schema": "http://json-schema.org/schema#",
"$id": "https://pglifecycle.readthedocs.io/en/stable/schemata/table.html",
"title": "Table",
"description": "Defines a table",
"type": "object",
"properties": {
"name": {
"title": "Name",
"description": "The table name",