Skip to content

Instantly share code, notes, and snippets.

View ryanwitt's full-sized avatar

Ryan Witt ryanwitt

  • New York, NY
View GitHub Profile
def collect_ranges(s):
"""
Returns a generator of tuples of consecutive numbers found in the input.
>>> list(collect_ranges([]))
[]
>>> list(collect_ranges([1]))
[(1, 1)]
>>> list(collect_ranges([1,2,3]))
[(1, 3)]
@ryanwitt
ryanwitt / install-nodejs.sh
Created April 11, 2015 21:07
Node.js install script for LInux
#!/bin/sh
VERSION=0.12.2
PLATFORM=linux
ARCH=x64
PREFIX=/usr/local
mkdir -p "$PREFIX" && \
curl http://nodejs.org/dist/v$VERSION/node-v$VERSION-$PLATFORM-$ARCH.tar.gz \
| tar xzvf - --strip-components=1 -C "$PREFIX"
@ryanwitt
ryanwitt / RedisTools.py
Created November 10, 2015 18:15 — forked from agconti/RedisTools.py
A class for checking redis queues and managing orphan jobs.
class RedisTools:
'''
A set of utility tools for interacting with a redis cache
'''
def __init__(self):
self._queues = ["default", "high", "low", "failed"]
self.get_redis_connection()
def get_redis_connection(self):

Keybase proof

I hereby claim:

To claim this, I am signing this object: