Skip to content

Instantly share code, notes, and snippets.

View fridgei's full-sized avatar

Ian Fridge fridgei

  • neeva
  • San Francisco
View GitHub Profile
package main
import (
"fmt"
"bytes"
)
const (
FLT = iota
INT = iota
(ns shortener.handler
(:use compojure.core)
(:require [compojure.handler :as handler]
[compojure.route :as route]
[clojure.java.jdbc :as j]))
(def db
{:classname "org.sqlite.JDBC"
:subprotocol "sqlite"
:subname "db/database.db"
\* PEG js grammar for graphite functions *\
start = EXPRS
TARGET = target:[^\(\), ]+ {
return {
'type': 'target',
'data': target.join(''),
'children': null
def deprecated(f):
def wrapped(*args, **kwargs):
print "{func} is DEPRECATED!".format(func=f.__name__)
return f(*args, **kwargs)
return wrapped
import requests
import furl
import json
from operator import itemgetter
class BaseApi(object):
def __init__(self, host):
self.host = host
import requests
import furl
import json
class DescartesException(Exception):
pass
class DescartesApi(object):
import os
class DirectoryScope(object):
def __init__(self, new_directory):
self.old_directory = os.path.abspath(os.getcwd())
self.new_directory = os.path.abspath(new_directory)
def __enter__(self):
import re
diff_re = re.compile(
"@@ \-(?P<removed_start>\d+),(?P<removed_length>\d+) "
"\+(?P<added_start>\d+),(?P<added_length>\d+) @@"
)
class DiffContext:
from time import time
import socket
import struct
import pickle
class GraphiteClient:
def __init__(self,
graphite_host='localhost',
import operator
def version_compare(comparer):
def compare_from(v1):
def compare_to(v2):
return comparer(map(int, v1.split(".")),
map(int, v2.split("."))) and \
not any(v2.endswith(e) for e in ["beta", "alpha"])
return compare_to
return compare_from