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
mysql -u $USER -p$PASS -e 'select * from information_schema.TABLE_CONSTRAINTS where CONSTRAINT_TYPE="FOREIGN KEY"' -B | awk '{if (NR!=1) print("ALTER TABLE "$2"."$5" DROP FOREIGN KEY "$3";")}' | mysql -u $USER -p$PASS |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
font: 14px sans-serif; | |
} | |
.axis path, .axis line { | |
fill: none; |
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 | |
# Prints out how many seconds ago this EC2 instance was started | |
# It uses Last-Modified header returned by EC2 metadata web service, which as far | |
# as I know is not documented, and hence I assume there is no guarantee | |
# that Last-Modified will be always set correctly. | |
# if this fails for some non-ec2 instance, then | |
# try to stat a file that might be from os-install time | |
# Use at your own risk. | |
python <<EOP | |
from datetime import datetime;import urllib2; |
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
MongoDB upstart scripts for Ubuntu. | |
Run following commands after installing upstart scripts: | |
ln -s /lib/init/upstart-job /etc/init.d/mongoconf | |
ln -s /lib/init/upstart-job /etc/init.d/mongodb | |
ln -s /lib/init/upstart-job /etc/init.d/mongos | |
To start services use: |
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
ssh hostname 'openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero' | pv > /dev/null |
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
wget http://stedolan.github.io/jq/download/linux64/jq | |
aws ec2 describe-instances --filters "Name=tag:Name,Values=$NAME" \ | |
"Name=instance-state-name,Values=running" \ | |
| jq -r \ | |
".Reservations[] | .Instances[] | .InstanceId" \ | |
aws ec2 describe-volumes --filters \ | |
"Name=status,Values=available" \ | |
| jq -r ".Volumes[] | .VolumeId" \ |
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
from collections import defaultdict | |
from itertools import imap | |
from boto import dynamodb | |
from magnitude import mg | |
REGION='us-west-1' | |
conn = dynamodb.connect_to_region(REGION) | |
WANT_PROPS = ( |
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
ansible localhost -i <(echo "localhost") -c local -m setup |
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 | |
# original url: http://www.jamescoyle.net/how-to/1073-bash-script-to-create-an-ssl-certificate-key-and-request-csr | |
set -e | |
set -x | |
domain="${1-$(cat /etc/hostname)}" | |
commonname="$domain" | |
# if the domain is a freakin IP it must also specify an IP SAN | |
# hopefully you have a python |
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
# SimpleHTTPServer oneliner | |
openssl req -new -x509 -keyout /dev/stdout -out /dev/stdout -days 365 -nodes -subj "/C=XX/O=Default Company Ltd" 2>/dev/null > yourpemfile.pem ; python -c 'import sys, BaseHTTPServer, SimpleHTTPServer; import ssl; httpd = BaseHTTPServer.HTTPServer(("0.0.0.0", 4443), SimpleHTTPServer.SimpleHTTPRequestHandler); httpd.socket = ssl.wrap_socket (httpd.socket, server_side=True, certfile=sys.argv[1]); httpd.serve_forever()' yourpemfile.pem |
OlderNewer