This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Package up new box | |
vagrant package --base /Users/<USER>/VirtualBox VMs/<VM-NAME> --output mybox.box | |
vagrant box add foobar mybox.box |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Bash | |
alias pwgen='env LC_CTYPE=C tr -dc "a-zA-Z0-9-_" < /dev/urandom | head -c 15' | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="\[$(tput bold)\]\[$(tput setaf 5)\]⌘ \[$(tput setaf 6)\]\w\[$(tput setaf 3)\]\$(parse_git_branch) \[$(tput sgr0)\]" | |
# Git config... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To use a custom decoractor with fabric | |
# the decorator needs @wraps(func) otherwise | |
from functools import wraps | |
def lock_hubot_aws_changes_when_running(func): | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
print 'do something' | |
result = func(*args, **kwargs) | |
print 'do something' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /etc/passwd | awk -F: '{print "crontab -u "$1" -l"}' |s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mock logging | |
# File - someclass.py | |
class SomeClass(object): | |
def method_man(self): | |
logging.basicConfig(filename='/tmp/somelog.log', | |
level=logging.INFO, | |
format='%(asctime)s | %(message)s', | |
datefmt='%m/%d/%Y %I:%M:%S') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Crude but does the job | |
from boto.s3.connection import S3Connection | |
conn = XXX | |
rs = conn.get_all_buckets() | |
# Get bucket | |
bucket_name = 'XXX' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
NewerOlder