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 / carbon.conf
Created September 4, 2013 14:41
Single graphite box carbon.conf file that spreads load across four cache daemons for increased write performance and cache effectiveness
[cache]
GRAPHITE_STORAGE_DIR = /var/lib/graphite/
GRAPHITE_ROOT = /opt/graphite/
CONF_DIR = /etc/carbon/
LOG_DIR = /var/log/carbon/
PID_DIR = /var/run/carbon/
LOG_UPDATES = False
WHISPER_AUTOFLUSH = True
@gmr
gmr / pip.rb
Created February 5, 2014 00:40
Replacement python_pip Chef provider that calls out to package index servers to get the latest version for candidate_version, reducing duplicate downloads and unneeded restarts.
#
# Author:: Seth Chisamore <schisamo@opscode.com>
# Cookbook Name:: python
# Provider:: pip
#
# Copyright:: 2011, Opscode, Inc <legal@opscode.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@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 / build-primary.sh
Last active August 29, 2015 14:00
RabbitMQ in Depth Vagrant provisioning shell script for primary VM
#!/bin/bash
# Remove puppet and chef from ubuntu/trusty
apt-get remove -y -qq chef puppet
# Remove unused packages
apt-get autoremove -y -qq
# Add the vagrant node primary addresses
echo "
@gmr
gmr / inventory.py
Created April 28, 2014 00:40 — forked from epc/inventory.py
#!/usr/bin/env python
""" Process URL for intersphinx targets and emit html or text """
def validuri(string):
return string
from sphinx.ext.intersphinx import read_inventory_v2
from posixpath import join
import pprint
import argparse
import logging
from tornado import gen, ioloop, web
import queries
class WidgetRequestHandler(web.RequestHandler):
def initialize(self):
self.session = queries.TornadoSession()
@gmr
gmr / dump.py
Last active August 29, 2015 14:02
Dump N messages into a linefeed delimited file from a queue
import rabbitpy
MSG_COUNT = 100
FILENAME = 'messages.dump'
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
with conn.channel() as channel:
queue = rabbitpy.Queue(channel, 'example')
count = 0
with open(FILENAME, 'wb') as handle:
@gmr
gmr / vagrant-destroy
Created June 16, 2014 19:52
Vagrant VMWare Fusion NFS exports issue
VAGRANT_LOG=debug vagrant destroy -f
INFO global: Vagrant version: 1.6.3
INFO global: Ruby version: 2.0.0
INFO global: RubyGems version: 2.0.14
INFO global: VAGRANT_EXECUTABLE="/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/bin/vagrant"
INFO global: VAGRANT_LOG="debug"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/Applications/Vagrant/bin/../embedded"
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_DETECTED_OS="Darwin"
INFO global: VAGRANT_INSTALLER_ENV="1"
@gmr
gmr / Logfile
Last active August 29, 2015 14:02
Errors on startup with fresh database
=INFO REPORT==== 16-Jun-2014::22:44:20 ===
Starting RabbitMQ %%VSN%% on Erlang R16B03-1
Copyright (C) 2007-2014 GoPivotal, Inc.
Licensed under the MPL. See http://www.rabbitmq.com/
=INFO REPORT==== 16-Jun-2014::22:44:20 ===
node : rabbit@gmr-home
home dir : /Users/gmr
config file(s) : (none)
cookie hash : J7HY1En7UzrPxhwINZe5SA==
@gmr
gmr / dlx-example.py
Last active August 29, 2015 14:02
Example of using a dead-letter exchange to delay the processing of messages that are rejected for any reason
import datetime
import rabbitpy
import uuid
ROUTING_KEY = 'message.foo'
with rabbitpy.Connection('amqp://localhost:5672/%2f') as conn:
with conn.channel() as channel:
# The primary exchange is where we normally publish messages