Skip to content

Instantly share code, notes, and snippets.

View j2labs's full-sized avatar

The Ghost Of J2 Labs j2labs

View GitHub Profile
# Round 29: Last hurrah before we're officially old.
Hello Hackers.
Thank you NYU for hosting the meetup. That was our first time at NYU and the space was great.
## Projects
### Gabe Ghearing
# Round 30: Things We Say
Hello Hackers.
Thank you to The Ladders for hosting the meetup. It was our second time there and we love the space. They're hiring, and there are a few hacker school alums over there so we know it's a great place for hackers to earn some dough. Reach out to John Connolly if you're interested: jeconnol@gmail.com
## Projects
### Gabe Ghearing
@j2labs
j2labs / gist:4a0a82b9d064219c15bb
Created August 7, 2014 17:48
fb earnings extrapolation
>>> q1 = 2.91
>>> q5 = q1 + (q1 * .67)
>>> q5
4.8597
>>> distance = q5 - q1
>>> halfway = distance / 2
>>> step = halfway / 2
>>> q1 + step + step + step + step == q5
True
>>> step
@j2labs
j2labs / gist:a870015f4cb00dca0510
Last active August 29, 2015 14:10
sudoku.rb
#!/usr/bin/env ruby
class Solver
B = " "
attr_reader :sudoku_board
def initialize
@sudoku_board = [[B, 4, B, B, B, 5, B, 1, B],
[B, B, B, B, 1, B, 6, B, 9],
[6, B, 1, 9, 3, B, B, B, 4],
@j2labs
j2labs / spider.py
Created November 21, 2014 15:20
Simple python spider
#!/usr/bin/env python
### To use, first install gevent and then requests
###
### $ pip install gevent requests
from gevent import monkey; monkey.patch_all() ### gevent first
import gevent
import json
#!/usr/bin/env python
"""
This script is a python implementation of Danish Munir's perl urdu-segmenter.
http://www.cs.cmu.edu/afs/cs/user/lsl/Nice/Urdu-MT/code/Tools/Sentence_Segmenter/urdu-segmenter.pl
"""
import sys
import re
from optparse import OptionParser
>>> import nltk.data
>>> splitter = nltk.data.load('tokenizers/punkt/english.pickle')
>>> splitter.tokenize('I think Washington D.C. is neato')
['I think Washington D.C.', 'is neato']
>>> splitter.tokenize('I think Washington D. C. is neato')
['I think Washington D. C. is neato']
#!/usr/bin/env python
from BeautifulSoup import BeautifulSoup
import urllib
class MozillaOpener(urllib.FancyURLopener):
version = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3'
urllib._urlopener = MozillaOpener()
#!/usr/bin/perl -w -CD
binmode STDOUT, ":utf8";
binmode STDIN, ":utf8";
no warnings;
#-----Description------------------------------------------------------
#
# Program:urdu-segmenter.pl
# Written by: Danish Munir
def addLike(self, uid=None, post_id=None):
"""
Facebook API call. See http://developers.facebook.com/documentation.php?v=1.0&method=stream.addLike
"""
args = {}
if uid is not None: args['uid'] = uid
if post_id is not None: args['post_id'] = post_id
return self('addLike', args)
def removeLike(self, uid=None, post_id=None):