Skip to content

Instantly share code, notes, and snippets.

View coordt's full-sized avatar

Corey Oordt coordt

View GitHub Profile
@coordt
coordt / check_for_updates.py
Created April 8, 2011 18:39
Check locally installed packages against one or more package indexes for updates and list them.
#!/usr/bin/env python
"""
Use pip to get a list of local packages to check against one or more package
indexes for updated versions.
"""
import pip
import sys, xmlrpclib
from cStringIO import StringIO
from distutils.version import StrictVersion, LooseVersion
AWSTemplateFormatVersion: 2010-09-09
Description: Test Server Infrastructure
Parameters:
ParentVPCStack:
Description: 'Stack name of parent VPC stack based on vpc/vpc-*azs.yaml template.'
Type: String
Default: 'TestVPC'
ParentSSHBastionStack:
Description: 'Optional but recommended stack name of parent SSH bastion host/instance stack based on vpc/vpc-ssh-bastion.yaml template.'
Type: String
---
AWSTemplateFormatVersion: 2010-09-09
Description: Test Server Infrastructure
Parameters:
ParentVPCStack:
Description: Stack name of parent VPC stack based on vpc/vpc-*azs.yaml template.
Type: String
Default: 'TestVPC'
ParentSSHBastionStack:
Description: 'Optional but recommended stack name of parent SSH bastion host/instance stack based on vpc/vpc-ssh-bastion.yaml template.'
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from fabric.api import cd, run, sudo, prefix, task, env, quiet, warn_only
from fabric.contrib.files import exists, sed
from fabric.tasks import Task
# The information to connecting to the server: `testserver` is contained
# in the local user's `~/.ssh/config` file
@coordt
coordt / testinstances.py
Last active December 24, 2015 22:49
This is a set of Fabric tasks to create and manage dynamic test instances on a server.
"""
Tasks for managing a test server
"""
import os
from fabric.api import cd, env, prefix, run, sudo, task
from fabric.contrib.files import exists, sed
from fabric.context_managers import hide
from fabric.colors import green, red
@coordt
coordt / apache2-template.conf
Created May 10, 2012 13:41
Apache template for an application test
<VirtualHost *:80>
ServerAdmin test@test.com
ServerName $$$$PROJECT_NAME$$$$
ServerAlias media-$$$$PROJECT_NAME$$$$
ServerAlias $$$$PROJECT_NAME$$$$.test.education.nationalgeographic.com
DocumentRoot $$$$PROJECT_HOME$$$$$$$$PROJECT_NAME$$$$/media
WSGIDaemonProcess $$$$PROJECT_NAME$$$$ user=webdev group=webdev \
processes=3 threads=1 maximum-requests=1000 \
python-path=$$$$PROJECT_HOME$$$$$$$$PROJECT_NAME$$$$/example/virtualenv/lib/python2.6/site-packages
@coordt
coordt / wsgi.py
Created May 10, 2012 13:40
A WSGI file for an application with an example project for testing on a server
"""
Default template for WSGI definition. Assumes virtualenv is in the same
directory as this file, and is called virtualenv
"""
import os, sys, site
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__)))
site.addsitedir('virtualenv/lib/python2.6/site-packages')
@coordt
coordt / bootstrap.py
Created May 10, 2012 13:54
Basic virtualenv bootstrap.py script
#!/usr/bin/env python
## WARNING: This file is generated
#!/usr/bin/env python
"""Create a "virtual" Python installation
"""
# If you change the version here, change it in setup.py
# and docs/conf.py as well.
virtualenv_version = "1.6.3"
@coordt
coordt / fields.py
Created March 5, 2012 16:08
Django MultiSelectField
"""
A model field and widget that allows selecting multiple items from a static
list of choices. Based on http://djangosnippets.org/snippets/1200/
"""
from django.db import models
from django.core import exceptions
from django import forms
from django.utils.text import capfirst
class MultiSelectFormField(forms.MultipleChoiceField):
@coordt
coordt / mkvoot.py
Created October 19, 2011 13:47
Vootstrap Maker
#!/usr/bin/env python
import textwrap, virtualenv
def adjust_options(options):
voot_opts = {
'no_site_packages': not options.use_site_packages,
'unzip_setuptools': not options.zip_setuptools,
'use_distribute': not options.setuptools,
}