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
vagrant ssh -c 'ip a s eth1 | grep "inet " | cut -d " " -f 6 | cut -d/ -f 1' |
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
import sys | |
import boto | |
buckets = sys.argv[1:] | |
if "," in buckets: | |
buckets = buckets.split(",") | |
buckets = [bucket.strip() for bucket in buckets] | |
if not buckets: | |
sys.stderr.write("Usage: {0} <bucket> [[bucket] ...]\n".format(sys.argv[0])) |
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
$ curl -si https://getsentry.com/welcome/ |grep includeSubdomains | |
Strict-Transport-Security: max-age=2592000; includeSubdomains |
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
property FLUSH_TEXT : "Quit and flush" | |
property SET_TEXT : "Set speed" | |
-- be damn carefull what you input here, it will run as root | |
on ipfwLimit(bandwidth) | |
my ipfwFlush() | |
do shell script "ipfw pipe 1 config bw " & bandwidth & "KB" with administrator privileges | |
do shell script "ipfw add 10 pipe 1 tcp from any 80 to me" with administrator privileges | |
do shell script "ipfw add 11 pipe 1 tcp from me to any 80" with administrator privileges |
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
"Memcached cache backend with key prefixing" | |
from django.core.cache.backends.base import InvalidCacheBackendError | |
from django.core.cache.backends.memcached import CacheClass as MemcachedCacheClass | |
from django.utils.encoding import smart_unicode, smart_str | |
class CacheClass(MemcachedCacheClass): | |
def __init__(self, server, params): | |
try: | |
self._key_prefix = smart_str(params['key_prefix']) |
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
import os, sys, re | |
from os.path import join, getsize, exists | |
def median(numbers): | |
s = sorted(numbers) | |
l = len(numbers) | |
if l % 2 == 0: | |
a, b = s[l / 2 - 1 : l / 2 + 1] | |
if a != b: | |
return a + b / 2.0 |
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 | |
if [ $# -ne 2 ] | |
then | |
echo "Usage: $0 <postgresql sql dump> <db_name>" >&2 | |
exit 1 | |
fi | |
db_file=$1 | |
db_name=$2 |
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
var a:XML = <request command="run-command" />; | |
var r:URLRequest = new URLRequest("http://localhost/service.php"); | |
r.data = a; | |
r.method = URLRequestMethod.POST; | |
r.contentType = "text/xml"; | |
var l:URLLoader = new URLLoader(); | |
l.addEventListener(Event.COMPLETE, function(e:Event) { | |
trace("success", l.data); |
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
import os | |
import subprocess | |
import threading | |
from Queue import Queue | |
ITUNES_DIR = os.path.expanduser("~/Music/iTunes/iTunes Music/") | |
KNOWN_EXTENSIONS = ('.mp3', '.aac') | |
AACGAIN_PARAMS = ['-a', '-k', '-d', '3'] | |
AACGAIN_LOCATION = 'aacgain' |
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 send_plain_mail(subject, body, from_mail, to): | |
import smtplib | |
from email.MIMEText import MIMEText | |
from email.Encoders import encode_quopri | |
msg = MIMEText(body, 'plain', 'iso-8859-1') | |
msg['Subject'] = subject | |
msg['From'] = from_mail | |
msg['To'] = to |