This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
NewerOlder