Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
DATE=$(date "+%Y/%m/%d %M:%H:%S")
AMO_PYTHON_ROOT=/data/amo_python
cd $AMO_PYTHON_ROOT;
pushd src/preview/zamboni
git pull -q origin master
<?php
$wgExtensionFunctions[] = 'efVideoSetUp';
function videoCreateAttrs($args) {
$attrs = array();
foreach($args as $key => $value) {
$attrs[] = sprintf('%s="%s"', $key, htmlspecialchars($value));
}
return implode(" ", $attrs);
name = 'fxfeeds'
port = 50000
ip = '63.245.209.124'
public_port = '443'
config = """probe tcp %(name)s-probe
port %(port)s
interval 3
@oremj
oremj / nagios-send-msg.py
Created February 18, 2010 23:55
nagios-send-sms.py
#!/usr/bin/python
import sys
from urllib import quote
from urllib2 import urlopen
SMS_URL = "http://host/sendmsg"
SMS_PASSWD = ""
SMS_USER = ""
#!/usr/bin/python
from urllib2 import urlopen, URLError
metrics = ['ReqPerSec', 'BytesPerSec', 'BytesPerReq', 'BusyWorkers', 'IdleWorkers']
def get_metrics():
try:
u = urlopen('http://localhost/server-status?auto')
except:
#!/usr/bin/python
from optparse import OptionParser
import multicommandlib
if __name__ == "__main__":
parser = OptionParser()
parser.add_option("-l", "--list",
action="store_true",
help="list systems in group")
parser.add_option("-g", "--list-groups",
#!/bin/bash
#
# chkconfig: 35 68 38
# description: Starts celeryd
#
# @author Jeremy Orem <[email protected]>
# @author Dave Dash <[email protected]>
#
DJANGO_PROJECT_DIR=/data/amo_python/www/preview/zamboni
@oremj
oremj / fuzzy_group_by.py
Created May 26, 2010 17:32
fuzzy_group_by
def fuzzy_group_by(keys, items, key, dist=None):
"""Returns a dictionary with all items mapped to dates
keys: list of items that can be used as keys in dict
items: items which will be mapped to a key
key: a function computing a key value for each element in items
dist: returns distance between objects (default: lambda x, y: abs(x - y))
"""
if not dist:
dist = lambda x, y: abs(x - y)
import re
import sys
# [03/Jun/2010:21:58:08 -0700] "GET /ja/thunderbird/downloads/file/75384/xpi/lightning-1.0b1-tb+sm-win.xpi?src=category HTTP/1.1" 200 9
def avg(l):
return sum(l) / len(l)
@oremj
oremj / memcached.py
Created June 9, 2010 07:46
memcached ganglia module
import socket
import time
class MemcacheStats:
CACHE_TIME = 4
def __init__(self):
self.cache = ()