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 | |
## this is a quick and dirty script to automagically install the latest chromium build on OSX 10.5 | |
## you can set this up as a nightly cron job, or run manually from the command line | |
# USAGE: | |
# save script to your home directory aka /Users/$USER/ | |
# open up a command prompt (aka /Applications/Utilities/Terminal) | |
# run manually from the command line whenever you want the most recent chromium build | |
# $ sh get_latest_chromium.sh | |
# start it as a nightly task (runs at 1am or edit the plist below) |
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 | |
# Calculate the ratio of ingredients needed for the perfect quantity of pizza dough | |
# | |
# $ pizza.py --target-oz=49 | |
# target: 49.00oz 1389gram | |
# flour: 800 grams (400 x 2) | |
# water: 520 grams | |
# salt: 16 grams | |
# sugar: 12 grams |
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
#include <string.h> | |
#include <uthash.h> | |
// this is an example of how to do a LRU cache in C using uthash | |
// http://uthash.sourceforge.net/ | |
// by Jehiah Czebotar 2011 - jehiah@gmail.com | |
// this code is in the public domain http://unlicense.org/ | |
#define MAX_CACHE_SIZE 100000 |
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 | |
""" | |
This is a script that updates hipchat hooks on github repository to only have a small set of actions they trigger based on. | |
created by Jehiah Czebotar 2013 | |
Usage: | |
update_github_hipchat_hook.py --repo=jehiah/json2csv --access_token={{...}} | |
""" |
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
# This is a simple way to run multiple things in parallel in a bash | |
# script without making things too complicated | |
# it's modeled after (and uses) the bash `wait` command | |
# TIP: to do more complicated steps in parallel put them in a function | |
function wait_run_in_parallel() | |
{ | |
local number_to_run_concurrently=$1 | |
if [ `jobs -np | wc -l` -gt $number_to_run_concurrently ]; then | |
wait `jobs -np | head -1` # wait for the oldest one to finish |
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
#!/bitly/local/bin/python | |
import tornado.options | |
import logging | |
import sys | |
if __name__ == "__main__": | |
tornado.options.define("frequency", type=int) | |
tornado.options.parse_command_line() | |
for line in sys.stdin: |
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 os | |
import httplib | |
import tornado.web | |
class ErrorHandler(tornado.web.RequestHandler): | |
"""Generates an error response with status_code for all requests.""" | |
def __init__(self, application, request, status_code): | |
tornado.web.RequestHandler.__init__(self, application, request) | |
self.set_status(status_code) | |
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 | |
# Show the rate of swapping (in number of pages) between executions | |
OK=0 | |
WARNING=1 | |
CRITICAL=2 | |
UNKNOWN=-1 | |
EXITFLAG=$OK | |
WARN_THRESHOLD=1 |
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 | |
# Copyright bitly, Aug 2011 | |
# written by Jehiah Czebotar | |
DATAFILE="/var/tmp/nagios_check_forkrate.dat" | |
VALID_INTERVAL=600 | |
OK=0 | |
WARNING=1 | |
CRITICAL=2 |
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
def compare(a, b): | |
""" | |
Compare two version strings. | |
:return -1, 0, 1 | |
:rtype: int | |
""" | |
a = map(_cast_int, a.split('+', 2)[0].split('.')) | |
b = map(_cast_int, b.split('+', 2)[0].split('.')) |