Skip to content

Instantly share code, notes, and snippets.

View mrchilds's full-sized avatar

Wesley Childs mrchilds

View GitHub Profile
@mrchilds
mrchilds / gist:6611158
Created September 18, 2013 15:45
Test Runner
import argparse
import multiprocessing
import os
import sys
import unittest
class RunTests():
"""
Test wrapper to allow for local or remote (via saucelabs) tests to be run in
parallel.
@mrchilds
mrchilds / gist:6611165
Created September 18, 2013 15:45
Example setup
def setUp(self):
if 'remote_saucelabs' in os.environ:
desired_capabilities = []
##--tc=name:Dev-run --tc=browser:firefox
browser = copy.copy(webdriver.DesiredCapabilities.FIREFOX)
browser['name'] = config['name']
desired_capabilities += [browser]
self.driver = webdriver.Remote(
desired_capabilities=desired_capabilities,
@mrchilds
mrchilds / S3 Size
Created November 21, 2013 17:47
S3 Bucket Size
# Crude but does the job
from boto.s3.connection import S3Connection
conn = XXX
rs = conn.get_all_buckets()
# Get bucket
bucket_name = 'XXX'
@mrchilds
mrchilds / gist:7871446
Created December 9, 2013 12:20
Example....
def pre_staging_restart_services():
"""
Restart celery and gunicorn services
Used by newer staging environments
"""
# Install requirements
with virtualenv():
run('pip install -r /srv/CustomMade/requirements.txt')
@mrchilds
mrchilds / gist:8315307
Created January 8, 2014 11:16
Update Route53 script
# Adapted from: http://blog.domenech.org/2012/11/automatically-manage-your-aws-ec2.html
# External IPs are not useful internally in AWS. Change to CNAME with public DNS. This ensures you don't pay for extra bandwidth as if will resolve to an internal IP when inside AWS and an external IP when outside in the real world
#!/bin/bash
logger start-up-name.sh Started
#More environment variables than we need but... we always do that
export AWS_CREDENTIAL_FILE=/opt/aws/apitools/mon/credential-file-path.template
export AWS_CLOUDWATCH_HOME=/opt/aws/apitools/mon