Skip to content

Instantly share code, notes, and snippets.

View nmcclain's full-sized avatar

Ned McClain nmcclain

View GitHub Profile
@nmcclain
nmcclain / mysql2sqlite.sh
Created March 28, 2012 02:32 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
{
"status":"OK",
"establishments": [
"P44762",
"V13453",
"V9687",
...
]
}
{
"status":"OK",
"EstNumber":"M89",
"Company":"Hillshire Brands Company",
"Street":"4613 Speaker Road",
"City":"Kansas City",
"State":"KS",
"Zip":"66106",
"Phone":"913-233-0399",
"GrantDate":"10\/10\/12",
{
"status":"OK",
"EstNumber":"M278",
"actions":[
{"action":"Food Safety Hazard", "quarter":"Q1 2012"},
{"action":"Unsanitary Conditions", "quarter":"Q1 2012"}
]
}
# Twilio HTTP HAProxy Configuration
# Version: 0.1
global
daemon
log 127.0.0.1 local0 info
maxconn 60000
spread-checks 3
#!/usr/bin/python
import socket
import sys
from optparse import OptionParser
EXIT_OK = 0
EXIT_WARN = 1
EXIT_CRITICAL = 2
@nmcclain
nmcclain / update_aws_route53_ddns
Last active January 3, 2016 19:39
Crude script to update an AWS Route53 entry from cron
#!/usr/bin/php
<?php
# crude script to update an AWS Route53 entry from cron
$hostname = "homer";
$domain = "simpsons.org";
$ip = chop(`curl -s http://www.telize.com/ip`);
$r53ip = chop(`cli53 rrlist $domain | grep $hostname | awk '{print $5}'`);
@nmcclain
nmcclain / aws_route53_IAM_ddns_permissions
Created January 19, 2014 19:35
Minimal R53 permissions needed to support DDNS updates, ala: https://gist.github.com/nmcclain/8509874
{
"Statement":[
{
"Action":[
"route53:ChangeResourceRecordSets",
"route53:GetHostedZone",
"route53:ListResourceRecordSets"
],
"Effect":"Allow",
"Resource":[
@nmcclain
nmcclain / flapjack-Dockerfile
Last active January 4, 2016 07:49
Dockerfile for flapjack. 1. save as "Dockerfile" 2. run "docker build" 3. run "docker run -i -d -p 3080:3080 IMAGEID" 4. profit
FROM ubuntu:12.04
RUN apt-get install -y software-properties-common
RUN echo "deb http://packages.flapjack.io/deb precise main" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y --force-yes flapjack
RUN apt-get install -y wget curl vim git
# customized flapjack config files
ADD assets/flapjack_config.yaml /etc/flapjack/flapjack_config.yaml
ADD assets/redis-flapjack.conf /opt/flapjack/embedded/etc/redis/redis-flapjack.conf
@nmcclain
nmcclain / keybase.md
Last active August 4, 2017 19:45
Keybase proof

Keybase proof

I hereby claim:

  • I am nmcclain on github.
  • I am ned (https://keybase.io/ned) on keybase.
  • I have a public key whose fingerprint is 1F9A B33F 20C3 DDBA 08D1 0E6C FA80 6473 5FF0 0CD9

To claim this, I am signing this object: