Skip to content

Instantly share code, notes, and snippets.

View ojas's full-sized avatar

Ojas ojas

View GitHub Profile
#!/usr/bin/env python
import sys
import json
CHUNK_SIZE = 500
def chunks(l, n):
""" Yield successive n-sized chunks from array l
"""
@ojas
ojas / requirements.txt
Last active December 23, 2015 07:29
Hoover's API Snippets
suds==0.4
wsgiref==0.1.2
@ojas
ojas / bir.py
Created August 20, 2013 19:04
Get BIR report from D&B Direct 1.x API
#!/usr/bin/python
"""
Usage:
python bir.py <duns_number>
"""
import sys
import requests
import traceback
@ojas
ojas / with-blocks.py
Created August 9, 2013 21:34
with-blocks in python
class MyClass():
def __init__(self, *args, **kwargs):
print '>> init'
self.label = kwargs.get('label')
def __enter__(self):
print ' >> enter'
return self
def __exit__(self, type, value, traceback):
@ojas
ojas / gist:5489837
Created April 30, 2013 16:22
csvkit examples
csvsql --db sqlite+pysqlite:///test.db -e iso-8859-1 --insert ./test-file-209.csv
@ojas
ojas / Requirements Cat PS1 Reverse Zeno
Created March 28, 2013 14:49
Requirements Cat: PS1: Reverse Zeno Paradox
<sharmaskarma> how can we build before we know the requirement
<sharmaskarma> KNOW THE REQUIREMENT
<ojas> how can you really know the requirement? it's like reverse zeno's
paradox.... you know you must end up at a requirement (at t1), but when you
start (t0) you have no requirement. there must be some point between t0 and t1
where half of the requirement is known, and between t0 and that point where one
half of one half of the requirement is known, and so on...
<ojas> but not matter how far you go back, you can never start w/ zero
requirement. hence, it's impossible to even get a single requirment defined.
QED