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
# `get_hosts $stack` returns the ips of the instances in the named stack | |
# the "-t -t" extra-args works around the issue of running sudo without a tty | |
# the "--force-formatter" tells chef-solo to still output what it's doing even though it has no tty | |
stack=1234 | |
pssh --host="`get_hosts $stack`" --timeout=0 --inline --par=10 --extra-args='-t -t -o StrictHostKeyChecking=no' --user=ec2-user 'if tail -1 /var/log/chef.log | grep FATAL; then sudo chef-solo -c /etc/chef/solo.rb -j /etc/chef/node.json --force-formatter; fi' |
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
<div class="textwidget"><span id="nextmeeting">The next meeting will be held at Linden Street Brewery </span><span id="nojavascript">on the second Thursday of the month</span>. Social starts at 7:00pm, meeting starts at 7:30pm. | |
<script> | |
// First, checks if it isn't implemented yet. | |
if (!String.prototype.format) { | |
String.prototype.format = function() { | |
var args = arguments; | |
return this.replace(/{(\d+)}/g, function(match, number) { | |
return typeof args[number] != 'undefined' | |
? args[number] |
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 | |
for i in $(eval echo {1..$1}) | |
do | |
echo $(date +"%T") | |
if ! curl -v "https://accounts.firefox.com" -o /dev/null &>/tmp/c.out; then | |
cat /tmp/c.out | |
else | |
echo "success" | |
fi |
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
#!/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
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" |
OlderNewer