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 csv | |
import pprint | |
import re | |
import sys | |
import time | |
import calendar | |
import datetime | |
import requests |
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 json | |
import os | |
import sys | |
import requests | |
import envoy | |
GITHUB_TOKEN = os.environ.get('GITHUB_TOKEN') | |
if GITHUB_TOKEN is None: | |
raise Exception('Missing GITHUB_TOKEN from os.environ') |
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
from sqlalchemy import engine | |
from sqlalchemy import event | |
class DbStats(): | |
def __init__(self): | |
self.clear() | |
def clear(self): | |
self.total_queries = 0 | |
self.total_time = 0 |
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
from threading import Thread, Semaphore | |
class FirstToReturn: | |
def __init__(self): | |
self._tasks = [] | |
self._results = [] | |
self._signal = Semaphore() | |
def run(self, fn, *args, **kwargs): |
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
function halpme() { curl -s "http://explainshell.com/explain/$1" --data-urlencode "args=${@:2}" -G | sed -n '/<table id="help"/,/<\/table>/p' | sed 's/ *//' | sed 's/<[^>]*>//g' | grep -v "^$" } | |
# EX: | |
# ~ ❯ halpme tar -xzf | |
# The GNU version of the tar archiving utility | |
# -x, --extract, --get | |
# extract files from an archive | |
# -z, --gzip, --gunzip --ungzip | |
# -f, --file ARCHIVE | |
# use archive file or device ARCHIVE |
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, os.path | |
import lib | |
import types | |
def init(): | |
#walk lib and import modules | |
module_set = set([os.path.splitext(module)[0] for module in os.listdir('lib') if not module.startswith('__init__')]) | |
module_set = [m for m in module_set] | |
mods = __import__('lib',globals(), locals(), module_set, -1) | |
return mods, module_set |
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 | |
# | |
# Requirements: | |
# argparse==1.2.1 | |
# pymongo==2.1 | |
# redis==2.4.10 | |
import redis | |
import pymongo | |
import argparse |
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
require 'rubygems' | |
require 'mongo' | |
module MongoPubSub | |
QUEUES_COLLECTION = 'queues' | |
class EndSubscriptionException < Exception; end | |
class Publisher | |
def initialize(queue_name, mongo_connection) | |
# Initialize queue collection as a capped collection | |
if not mongo_connection[QUEUES_COLLECTION].collection_names.include?(queue_name) |
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
[alias] | |
prunelocal = !sh -c 'git branch -d `git branch --merged | grep -v "^*" | tr -d "\\n"`' | |
pruneorigin = !sh -c 'git push origin `git branch -r --merged | grep \"^ origin/\" | grep -v "/master$" | sed "s/origin./:/g" | tr -d "\\n"`' |
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 urllib2 | |
import simplejson | |
API_URL = 'http://api.forrst.com/api/' | |
VERSION = 'v1' | |
# Compose the base URL - maybe at __init__ ? | |
URL = API_URL + VERSION | |
class Forrst: |
NewerOlder