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 re | |
import telnetlib | |
import time | |
from collections import Counter | |
hosts = [ | |
('localhost', 11211) | |
] |
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 boto.ec2 import connect_to_region | |
from boto.elasticache import connect_to_region as elasticache_region | |
target = 'sg-name' | |
ec2 = connect_to_region('us-east-1') | |
ec = elasticache_region('us-east-1') | |
sgs = ec2.get_all_security_groups() |
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 sys | |
from boto.ec2 import connect_to_region | |
target_sg = sys.argv[1] | |
ec2 = connect_to_region('us-west-1') | |
target_sg_object = ec2.get_all_security_groups([target_sg])[0] |
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 tornado.httpserver | |
import tornado.ioloop | |
import tornado.web | |
PORT = 10045 | |
class Application(tornado.web.Application): | |
def __init__(self): | |
handlers = [ |
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 | |
type -P chpasswd 2>&1 > /dev/null | |
if [ $? -ne 0 ]; then | |
echo "chpasswd not available" | |
exit 1 | |
fi | |
read -p "Username: " USERNAME |
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/sh | |
# | |
# Logstash Start/Stop logstash | |
# | |
# chkconfig: 345 99 99 | |
# description: Logstash | |
# processname: logstash | |
logstash_bin="java -Djava.net.preferIPv4Stack=true -jar /opt/logstash/logstash-1.0.11pre-monolithic.jar" | |
logstash_log="/opt/logstash/logstash-web.log" |
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 | |
# Tested on Ubuntu 8.04 32 bit | |
# When the memory limit drops below $memory_limit megabytes, bash will ring a bell | |
# and echo the current memory usage. | |
# Set the free memory limit (in megabytes) | |
memory_limit=150 | |
# Check interval (in seconds) |
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
if [ `sudo cat /proc/meminfo | grep MemFree | awk '{print $2;}'` -lt "200000" ]; then sudo /etc/init.d/apache2 restart ; fi | |
-- | |
sudo monit summary | grep -i rabbit | grep running ; if [ "$?" -ne "0" ]; then sudo /etc/init.d/rabbitmq-server stop; sudo /etc/init.d/rabbitmq-server start; sudo monit monitor rabbitmq-server; 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
<?php | |
// Clear django_sessions table | |
date_default_timezone_set("UTC"); | |
$link = mysql_connect("localhost", "username", "password") | |
or die("Couldn't connect to MySQL server.\n"); | |
mysql_select_db("database") |
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
# For http://rosalind.info/problems/subs/ | |
import re | |
import sys | |
string = None | |
substring = None | |
for line in open('rosalind_subs.txt', 'r'): | |
if string is None: |
OlderNewer