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
<VirtualHost 204.246.122.74:80> | |
ServerAdmin root@localhost | |
DocumentRoot "/var/www" | |
RewriteEngine On | |
RewriteCond %{ENV:REDIRECT_STATUS} !=503 | |
RewriteRule ^(.*)$ /$1 [R=503,L] | |
ErrorDocument 503 /maint.html | |
Alias /maint.html /var/www/html/maint.html |
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
<html><head><title>This site is undergoing planned maintenance</title></head><body><h1>This site is undergoing planned maintenance</h1><p>This maintenance which begain Saturday February 22nd should conclude around 2pm</p></body></html> |
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
#!/usr/bin/env python | |
import ConfigParser | |
import argparse | |
import logging | |
import os | |
def type_loglevel(level): | |
try: | |
result = getattr(logging, level.upper()) |
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
#!/bin/bash | |
if grep -- ' PRIVATE KEY-' "$1" >/dev/null; then | |
modulus="`openssl rsa -noout -modulus -in "$1" | md5sum | awk '{print $1}'`" | |
elif grep -- '-BEGIN CERTIFICATE REQUEST-' "$1" >/dev/null; then | |
modulus="`openssl req -noout -modulus -in "$1" | md5sum | awk '{print $1}'`" | |
elif grep -- '-BEGIN CERTIFICATE-' "$1" >/dev/null; then | |
modulus="`openssl x509 -noout -modulus -in "$1" | md5sum | awk '{print $1}'`" | |
else | |
modulus="unknown" |
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
# http://stackoverflow.com/a/39418771/168874 | |
from datetime import tzinfo, timedelta, datetime | |
import time as _time | |
ZERO = timedelta(0) | |
STDOFFSET = timedelta(seconds=-_time.timezone) | |
if _time.daylight: | |
DSTOFFSET = timedelta(seconds=-_time.altzone) | |
else: |
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
stack=1234 | |
hostlist="`get_hosts $stack`" | |
pssh -O StrictHostKeyChecking=no \ | |
--print \ | |
--user ec2-user \ | |
--host "$hostlist" \ | |
--timeout=0 \ | |
--par=20 \ | |
'while true; do if ! tail -1 /var/log/chef.log | sed -e "s/^/`hostname`/" | grep -v "`date +%Y-%m-%d`.*Report handlers complete"; then tail -1 /var/log/chef.log | grep "`date +%Y-%m-%d`.*Report handlers complete"; break; fi; sleep 2; done' |
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
# The key to using pssh and sudo is the `--extra-args='-t -t' trick | |
pssh -H "`cat hostlist.txt`" \ | |
--user ec2-user \ | |
--timeout=0 \ | |
--inline \ | |
--par=10 \ | |
--extra-args='-t -t -o StrictHostKeyChecking=no' \ | |
'sudo cat /etc/shadow' |
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
function multiscp { | |
hostlist=$1 | |
filename=$2 | |
tempfiletemplate="/tmp/`basename $0`-XXXXXX" | |
pidlistfile="`mktemp $tempfiletemplate`" | |
exitstatus=0 | |
for host in $hostlist; do | |
scp $filename $host: & | |
echo "$!" >>$pidlistfile | |
done |
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
sudo true && curl -L https://www.opscode.com/chef/install.sh | sudo bash | |
sudo yum install -y git | |
sudo mkdir -p /var/chef/cookbooks | |
sudo chown root:wheel /var/chef/cookbooks | |
sudo chmod g+w /var/chef/cookbooks | |
cd /var/chef/cookbooks | |
git init | |
touch .gitignore | |
git add .gitignore | |
git commit -m "initial commit" |
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 boto.ec2 | |
import sys | |
from pprint import pprint | |
all_regions = [x.name for x in | |
boto.ec2.connect_to_region('us-east-1').get_all_regions()] | |
instances=[] | |
for region in all_regions: | |
instances.extend(boto.ec2.connect_to_region(region).get_only_instances()) |