This file contains hidden or 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/python | |
import os | |
from datetime import date | |
pem_file = '/path/to/file.pem' | |
cert_file = '/path/to/cert-file.pem' | |
user_id = 'xxxxxxxx' | |
platform = 'i386' # change this on large instance |
This file contains hidden or 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 completion support for core Git. | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]> | |
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# The contained completion routines provide support for completing: | |
# | |
# *) local and remote branch names |
This file contains hidden or 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://www.mail-archive.com/[email protected]/msg31768.html | |
Hi Ahmet, | |
Well after some more testing I am now convinced that you rock :) | |
I like the solution because its obviously way less hacky and more importantly I | |
expect this to be a lot faster and less memory intensive, since instead of a | |
facet prefix or terms search, I am doing an "equality" comparison on tokens | |
(albeit a fair number of them, but each much smaller). I can also have more | |
control over the ordering of the results. I can also make full use of the |
This file contains hidden or 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 force_unicode(s, encoding='utf-8', errors='ignore'): | |
""" | |
Returns a unicode object representing 's'. Treats bytestrings using the | |
'encoding' codec. | |
""" | |
import codecs | |
if s is None: | |
return '' | |
try: |
This file contains hidden or 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
apt-get install python-setuptools python-pip | |
pip install Flask gunicorn | |
ab -n 5000 -c 50 http://ec2-50-16-28-212.compute-1.amazonaws.com/ | |
worker = 1 | |
Concurrency Level: 50 | |
Time taken for tests: 53.365 seconds |
This file contains hidden or 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
# Full credit to: http://jeffmiller.github.com/2011/01/10/ssh-host-color | |
#!/bin/bash | |
# | |
# ssh into a machine and automatically set the background | |
# color of Mac OS X Terminal depending on the hostname. | |
# | |
# Installation: | |
# 1. Save this script to /some/bin/ssh-host-color | |
# 2. chmod 755 /some/bin/ssh-host-color |
This file contains hidden or 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
# Written by Alisdair Sullivan | |
STATE_OR_PROVINCE_CHOICES = [ | |
('AB', 'Alberta'), | |
('BC', 'British Columbia'), | |
('MB', 'Manitoba'), | |
('NB', 'New Brunswick'), | |
('NL', 'Newfoundland'), | |
('NS', 'Nova Scotia'), | |
('NT', 'Northwest Territories'), |
This file contains hidden or 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
user www-data www-data; | |
worker_processes 2; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { |
This file contains hidden or 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 | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
This file contains hidden or 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
# stolen from tarek ziade's bug report | |
# https://bug667846.bugzilla.mozilla.org/attachment.cgi?id=542440 | |
import pymysql | |
import time | |
import threading | |
from wsgiref.simple_server import make_server | |
# set up the greenlet | |
#from gevent import monkey | |
#monkey.patch_socket() |