Skip to content

Instantly share code, notes, and snippets.

View brianray's full-sized avatar
🐍

Brian Ray brianray

🐍
  • Maven Wave Partners
  • Los Angeles | Chicago
View GitHub Profile
@brianray
brianray / Restaurants-near-1871.md
Created December 6, 2012 22:52 — forked from harperreed/Restaurants-near-1871.md
Restaurants near 1871

#Restaurants near 1871

Help curate this list. start filling out the data and links about each place and add places!


##Cheap

  • Protein Bar
    • Phone: (312) 346-7300
    • Address: 222 Merchandise Mart Plaza Chicago, IL 60654
from django.test import TestCase
from core.transforms import filler
import mock
class FillerTest(TestCase):
#@mock.patch("core.transforms.filler._")
def test_filler(self): #, filler_func):
@brianray
brianray / gevent.py
Last active December 24, 2015 12:39
from gevent import spawn, sleep
def g1():
print "g1 enter"
spawn(g2)
print "g1 exit"
def g2():
$ ifconfig | grep "inet addr"
inet addr:10.118.242.82 Bcast:10.118.242.127 Mask:255.255.255.128
inet addr:127.0.0.1 Mask:255.0.0.0
$ sudo iptables -L INPUT -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8000
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
Verifying that +brianray is my openname (Bitcoin username). https://onename.io/brianray
@brianray
brianray / gen_table_corpus.py
Created December 26, 2014 16:43
Generate Confluence Wiki table from NLTK Corpus
from nltk.downloader import Downloader
dl = Downloader()
def format(x, fields, type_name, delim):
x = x.__dict__
out = delim
for col in fields.split(delim):
if col == 'type':
out += type_name
@brianray
brianray / electric_objects.py
Last active August 29, 2015 14:27 — forked from harperreed/electric_objects.py
Electric objects simple API wrapper
import urllib
import requests
import json
import random
"""
here is a wrapper for the *unreleased* electric objects API
Built by Harper Reed (harper@nata2.org) - @harper
Hopefully someday a real API will appear
@brianray
brianray / doit.py
Last active November 29, 2015 22:37
Abstract Base Class Decorator Python
import inspect
def abstractmethod(mthd):
def default_abstract_method(*args, **kwargs):
call_args = inspect.getcallargs(mthd, *args, **kwargs)
arg_spec = inspect.getargspec(mthd)
class_name = call_args['self'].__class__.__name__
error_str = "{}.{}({}) method must be defined"
raise NotImplementedError(error_str.format(class_name,
mthd.func_name,
@brianray
brianray / Password.py
Created December 2, 2015 20:16
fun way to prevent printing of passwords (maybe)
class PasswordStr(object):
"""by: brianhray@gmail.com"""
scrubbed_msg = u"xxxxxSCRUBEDxxxxx"
def __init__(self, original):
self.original = original
def __str__(self):
return str(self.scrubbed_msg)
def __unicode__(self):
return self.scrubbed_msg
startup_message off
vbell off
escape /
defscrollback 5000
hardstatus alwayslastline
hardstatus string '%{= kG}%-Lw%{= kW}%50> %n*%f %t%{= kG}%+Lw%< %{= kG}%-=%D %m/%d/%y | %C:%s %A | %1`%{-}'
screen -t shell 0 bash
screen -t /usr/bin/python /usr/local/bin/ipython notebook --ip=* --notebook-dir=/home/ubuntu --no-browser --port=8888
screen -t htop
screen -t x11 3 bash -c "Xvfb :1 -screen 0 1280x1024x24"