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 | |
# Extract a subproject's master branch from a specified repo into a new | |
# repository in the target directory, preserving history. | |
# usage: git-subdir-newrepo.sh path/to/repo newrepo_path subproject_path | |
# Based on stuff I found here: | |
# http://airbladesoftware.com/notes/moving-a-subdirectory-into-a-separate-git-repository | |
EXPECTED_ARGS=3 | |
E_BADARGS=65 |
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
""" | |
Taken from my suggestion at: | |
https://groups.google.com/forum/#!msg/tweepy/OSGRxOmkzL4/yaNT9fL9FAIJ | |
Note that this is an incomplete snippet; you'll need to create the API auth object. | |
""" | |
import simplejson as json | |
import tweepy |
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/python | |
"""Print stats about stdin per-line timings.""" | |
import signal | |
import sys | |
import time | |
start = time.time() | |
count = 0 | |
try: |
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 | |
""" | |
Get the 'external' IP address using httpbin.org JSON API. | |
(http://httpbin.org/ip) | |
Author: Michael Curry (thatmichaelcurry [at] gmail) | |
Requires requests 2 or higher. |
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 | |
set -o errexit | |
# Author: David Underhill | |
# Version: 1.0 (01-Apr-2009) | |
# Script to permanently delete files/folders from your git repository. To use | |
# it, cd to your repository's root and then run the script with a list of paths | |
# you want to delete, e.g., git-delete-history path1 path2 | |
if [ $# -eq 0 ]; then |
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
/** | |
* Make w-shingles from a source string or array. | |
* @param {string} collection The collection (array or string) to shingle. | |
* @param {string} size The shingle size (4 for 4-shingles, etc.) | |
* @return {array} An array of shingles. | |
*/ | |
function shingle(collection, size) { | |
var shingles = []; | |
for (var i=0; i<collection.length-size+1; i++) { | |
shingles.push(collection.slice(i, i+size)); |
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
#============================================================== | |
# .picasa.ini FILE STRUCTURE | |
# | |
# reverse-engineered by Franz Buchinger <[email protected]> | |
# licensed to the public domain | |
# | |
# Picasa Version(s): 3.8.0 | |
# | |
# Changelog: | |
# v0.1: initial release |
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
""" | |
Simple view decorator for flask and mongoengine/pymongo to auto-retry with delay on | |
pymongo.errors.AutoReconnect exception. | |
""" | |
from functools import wraps | |
import time | |
from pymongo.errors import AutoReconnect | |
import flask |
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 | |
def is_heroku(): | |
"""Hack to return true if we're running inside a Heroku container. | |
Tested on Cedar stack. | |
""" | |
return os.environ.get('PYTHONHOME', '').find('.heroku') != -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
""" | |
Convert a CFFI cdata structure to Python dict. | |
Based on http://stackoverflow.com/q/20444546/1309774 with conversion of | |
char[] to Python str. | |
Usage example: | |
>>> from cffi import FFI | |
>>> ffi = FFI() |
OlderNewer