Skip to content

Instantly share code, notes, and snippets.

Peter Conerly pconerly

Block or report user

Report or block pconerly

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
pconerly /
Last active Sep 19, 2015 — forked from Ashex/
EIP failover
# This script will monitor another HA node and take over an Elastic IP (EIP)
# if communication with the other node fails
# High Availability IP variables
# Other node's IP to ping and EIP to swap if other node goes down
#Specify the Secondary Private IP for this node
pconerly /
Last active Aug 29, 2015
Rolling your own localtunnel
# this file lives in /project/app/management/commands/
# it just spins up a localtunnel and retries it if it fails, until it gets a key command shutdown.
# you need to define some configuartion in your SSH_TUNNEL_USER, SSH_SERVER_IP
# This assumes you're running your website on port 8070
import sys
import time
import subprocess
from django.conf import settings
pconerly / record_nock_to_json_file.js
Created Mar 5, 2015
Record nocks to a json file
View record_nock_to_json_file.js
var nock = require('nock');
var low = require('lowdb');
// lowdb is a great straight-to-json minidb.
var db = low('integration_test_nock_records.json');
writeToFileLog = function(object) {
console.log("writing nock to json....");
pconerly /
Created Sep 17, 2014
Sublime text power-users session

Sublime text:





Language preferences.

import fnmatch
import glob
import os
start_dir = '.'
start_dir = '/Users/peterconerly/src/picmonkey/py/frontend/frontend/static/js/v2'
extension = '*.coffee'
for root, dirnames, filenames in os.walk(start_dir):
pconerly /
Created May 12, 2014
Failing to run Tornado tests
#!/usr/bin/env python
import tornado.httpserver
import tornado.ioloop
import tornado.web
from tornado.options import options
class FooHandler(tornado.web.RequestHandler):
def get(self):
pconerly /
Last active Aug 29, 2015
python's `if __name__ == "__main__"`, but for php.
A slightly fuller example for this stackoverflow question: PHP equivalent of Python's name == “main”?

If you run php import.php the expected output is:

$ php import.php 
I am import.php
I am import.php, and I was run from the command line.
pconerly /
Created May 1, 2013
Using jinja2 with fabric
import os
from fabric.api import *
from jinja2 import Environment, FileSystemLoader
from StringIO import StringIO
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
def config():
# put nginx.conf template into remote nginx folder
You can’t perform that action at this time.