Skip to content

Instantly share code, notes, and snippets.

View butlern's full-sized avatar

Nathan Butler butlern

View GitHub Profile
import argparse
import logging
import mechanize
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("-host", "--hostname", dest="hostname", default="localhost",
help="The hostname of the server")
parser.add_argument("-p", "--port", dest="port", default="4502",
help="The server port")
printjson("Getting db object local")
db = db.getSiblingDB('local')
printjson("Dropping local.temp")
db.temp.drop()
printjson("Saving last oplog entry into local.temp")
db.temp.save( db.oplog.rs.find( { }, { ts: 1, h: 1 } ).sort( {$natural : -1} ).limit(1).next() )
printjson("Printing last oplog entry saved into local.temp")
cursor = db.temp.find()
if ( cursor.hasNext() ){
printjson( cursor.next() );
@butlern
butlern / gist:6cc86aea397407712c11
Created July 28, 2014 01:52
oplog-resize-runlist
1. service mongodb stop
2. mongod --dbpath /mongo/db --port 37017
3. cd /mongo ; mongodump --db local --collection 'oplog.rs' --port 37017
4. mongo --port 37017 ~/oplog-resize.js
5. mongo --port 37017
> use admin
> db.shutdownServer()
6. service mongodb start
7. mongo # Verify Oplog is new size
> db.printReplicationInfo()
require 'facter'
require 'time'
require 'yaml'
require 'json'
if Facter.value("ec2_instance_id") != nil
# Inspired by: http://puppetlabs.com/blog/facter-part-3-caching-and-ttl
#
# facts cache directory/file on puppet agent:
facts_cache_dir='/etc/puppet/facts.d'
### Keybase proof
I hereby claim:
* I am butlern on github.
* I am nateb2112 (https://keybase.io/nateb2112) on keybase.
* I have a public key ASDllm6RUwub5vpCnhlIQywdqc2QDjRV5DnwS9fBc220pQo
To claim this, I am signing this object:
#!/usr/bin/python3
import parquet as pq
import sys
from io import BytesIO
# Purpose: Read parquet files fro stdin to pipeline in MemSQL
# Read binary input from stdin