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
#!/usr/bin/env python | |
""" Sends Jenkins build duration statistics to Graphite. """ | |
import requests | |
import json | |
from graphite import Graphite # This is our closed-source library but you get the idea. | |
JENKINS_URL='http://jenkins' | |
GRAPHITE_HOST='10.x.x.x' | |
GRAPHITE_PREFIX='jenkins.main.build_time.' |
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
#!/usr/bin/env python | |
# https://gist.github.com/gists/1186406 | |
import httplib2, json, re, sys | |
from optparse import OptionParser | |
parser = OptionParser() | |
parser.add_option("-w", "--warning", dest="warning", type="int", | |
default="50", help="warning threshold") | |
parser.add_option("-c", "--critical", dest="critical", type="int", | |
default="100", help="critical threshold") |
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
#!/usr/bin/env python | |
import socket | |
import sys | |
if len(sys.argv) != 3: | |
print "Usage: %s host:port destfile.jpg" % sys.argv[0] | |
sys.exit(1) | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
host, port = sys.argv[1].split(':') |
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 csv | |
import sys | |
from collections import namedtuple | |
rows = csv.reader(sys.stdin) | |
fields = [field.strip().lower().replace(' ', '_').replace('/', '_') | |
for field in rows.next() if field.strip() != ''] | |
PaypalRecord = namedtuple('PaypalRecord', fields) |
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
#!/usr/bin/env python | |
""" Git post-receive hook to publish commit data to an AMQP topic. | |
apt-get install python-git python-amqplib | |
or: | |
easy_install amqplib gitpython | |
""" | |
import os, sys, json | |
from datetime import datetime | |
from git import * |
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
#!/usr/bin/env ruby | |
require 'fileutils' | |
CA_DIR = '/path/to/ca/keys/' | |
HOST = '1.2.3.4' | |
if not ARGV[0]: | |
raise "Provide a certificate name as an argument" | |
end |
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
# usage: python mirrordir.py ./directory myuser@host:/path | |
import sys, pyinotify, subprocess | |
class Handler(pyinotify.ProcessEvent): | |
def process_IN_CLOSE_WRITE(self, event): | |
subprocess.call(("scp", event.pathname, sys.argv[2])) | |
if __name__ == '__main__': | |
wm = pyinotify.WatchManager() | |
notifier = pyinotify.Notifier(wm, default_proc_fun=Handler()) |
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
#!/usr/bin/ruby | |
# Download NASA MODIS imagery and use it as a desktop background. | |
# You'll need ImageMagick installed for this to work. | |
require 'date' | |
require 'net/http' | |
# Screen width/height | |
X = 2580 | |
Y = 1024 |
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
#0 0x00014883 in Resolver::dispatch (this=0xa06950, rq=@0xb0080424, local_only=false) at /Users/russ/playdar/playdar-daemon/src/resolvers/resolver.cpp:75 | |
#1 0x0008a98b in playdar_request_handler::handle_rest_api (this=0xb0184ee4, qs=@0xb00806b4, req=@0x100b628, rep=@0x100b650) at /Users/russ/playdar/playdar-daemon/src/playdar/playdar_request_handler.cpp:173 | |
#2 0x00091937 in playdar_request_handler::handle_request (this=0xb0184ee4, req=@0x100b628, rep=@0x100b650) at /Users/russ/playdar/playdar-daemon/src/playdar/playdar_request_handler.cpp:78 | |
#3 0x00186b16 in moost::http::connection<playdar_request_handler>::handle_read (this=0x1009600, e=@0xa06950, bytes_transferred=477) at request_handler_base.hpp:27 | |
#4 0x00160006 in boost::asio::asio_handler_invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, moost::http::connection<playdar_request_handler>, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<moost::http::connection |
NewerOlder