Skip to content

Instantly share code, notes, and snippets.

View shawnbutts's full-sized avatar

Shawn Butts shawnbutts

View GitHub Profile
################################################################################
# Diamond Configuration File
################################################################################
################################################################################
### Options for the server
[server]
# Handlers for published metrics.
handlers = diamond.handler.netuitive_cloud.NetuitiveHandler, diamond.handler.graphite.GraphiteHandler
#!/usr/bin/env python
import os
import time
import datetime
def get_directory_structure(rootdir, strip=False):
"""
import netuitive
import time
ApiClient = netuitive.Client(api_key='aaaaaaa9956110211e594444697f922ec7b')
MyElement = netuitive.Element()
timestamp = int(time.mktime(time.gmtime()))
@shawnbutts
shawnbutts / 7z+tar.md
Created June 4, 2016 16:53 — forked from kylemanna/7z+tar.md
Archive with tar + 7z + max compression

Overview

7-zip doesn't preserve the Linux/Unix owner/group of files and possibly other details. Use tar instead because it's designed to preserve these things, then just 7zip the tar archive.

Create the archive

tar cf - --exclude=\*.o -v directory | 7z a -si -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on directory.tar.7z
#!/bin/bash
# turn a fresh centos 6 (vagrant) box into a dev box by installing python 2.6, 2.7, 3.5, and go 1.6
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@shawnbutts
shawnbutts / backup-docker-cassandra.sh
Created July 5, 2016 10:56 — forked from tobert/backup-docker-cassandra.sh
Quick & dirty cassandra-in-docker backup script
#!/bin/bash
# A quick & dirty backup script for Cassandra running inside Docker.
# Assumes /var/lib/cassandra is mounted in the container as /var/lib/cassandra because
# docker inspect {{ .Volumes }} is not shell-friendly. (doable, but meh)
# Also assumes Cassandra was started with 'docker run --name cassandra'.
export PATH=$PATH:/home/atobey/bin:/usr/local/bin
set -e
### Keybase proof
I hereby claim:
* I am shawnbutts on github.
* I am shawnbutts (https://keybase.io/shawnbutts) on keybase.
* I have a public key ASDHWHAHABRNm_6TytWGh2d_6FlZFV_zk8EbqqKfgZga7Ao
To claim this, I am signing this object:
@shawnbutts
shawnbutts / startup.log
Last active October 5, 2016 08:18
fluentd-trace01
2016-10-04 18:31:34 +0000 [trace]: plugin/buffer.rb:165:add_metadata: adding metadata instance=9080200 metadata=#<struct Fluent::Plugin::Buffer::Metadata timekey=1475605380, tag=nil, variables=nil>
2016-10-04 18:31:34 +0000 [trace]: plugin/buffer.rb:188:write: writing events into buffer instance=9080200 metadata_size=1
2016-10-04 18:31:34 +0000 [trace]: plugin/buffer.rb:165:add_metadata: adding metadata instance=9080200 metadata=#<struct Fluent::Plugin::Buffer::Metadata timekey=1475605380, tag=nil, variables=nil>
2016-10-04 18:31:34 +0000 [trace]: plugin/buffer.rb:188:write: writing events into buffer instance=9080200 metadata_size=1
2016-10-04 18:31:34 +0000 [trace]: plugin/buffer.rb:165:add_metadata: adding metadata instance=9080200 metadata=#<struct Fluent::Plugin::Buffer::Metadata timekey=1475604360, tag=nil, variables=nil>
2016-10-04 18:31:34 +0000 [trace]: plugin/buffer.rb:165:add_metadata: adding metadata instance=9080200 metadata=#<struct Fluent::Plugin::Buffer::Metadata timekey=1475604360, tag=nil, v
#!/bin/bash
# You need: curl, jq, and ipcalc to run this.
# You should already have cut, sort and uniq if you're on OS X or Linux.
RANGES=$(curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq .prefixes | jq '.[] | select(.region=="us-east-1")' | jq 'select(.service=="EC2")' | jq .ip_prefix | cut -d '"' -f 2 | sort | uniq)
for range in $RANGES
do
MIN=$(ipcalc -bn $range | grep "HostMin" | cut -d ':' -f 2)
@shawnbutts
shawnbutts / kubernetes_on_macOS.md
Created June 4, 2017 22:07 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites