Skip to content

Instantly share code, notes, and snippets.

View harlowja's full-sized avatar

Joshua Harlow harlowja

  • Waymo
  • Campbell
  • 23:34 (UTC -07:00)
View GitHub Profile
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@harlowja
harlowja / nested_fsm2.py
Created July 31, 2014 02:00
nested_fsm2
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@harlowja
harlowja / nested_test.py
Created July 31, 2014 02:03
nested_test.py
from taskflow.types import fsm
import six
a = fsm.FSM("start")
a.add_state('start')
b = fsm.FSM("boop")
b.add_state("boop")
b.add_state("dink")
$ git clone https://github.com/stackforge/doc8
$ cd doc8
$ virtualenv test
$ source test/bin/activate
$ pip install -r requirements.txt
$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import restructuredtext_lint as rl
@harlowja
harlowja / close.py
Created August 25, 2014 17:49
Iter close
import six
def do_stuff():
for i in range(0, 10):
yield i
g = do_stuff()
@harlowja
harlowja / nosetests_many.py
Created August 31, 2014 18:07
many runner
import sys
from pkg_resources import load_entry_point
import time
for i in range(0, 500):
print("===" * 3)
print("Run number %s" % (i + 1))
print("===" * 3)
c = load_entry_point('nose', 'console_scripts', 'nosetests')
p = c(exit=False)
@harlowja
harlowja / logviewer.py
Created September 4, 2014 04:49
logviewer.py
import argparse
import contextlib
import logging
import re
import readline
import sys
import termios
import tty
import html5lib
@harlowja
harlowja / redis.py
Created October 13, 2014 17:05
Redis-tooz-thing
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@harlowja
harlowja / project_release.py
Created October 27, 2014 17:46
project_release.py
import os
import pwd
import subprocess
import sys
from oslo.concurrency import processutils
from Cheetah.Template import Template
@harlowja
harlowja / vsprint.py
Created December 9, 2014 06:27
virtual sprint
from Cheetah.Template import Template
from delorean import Delorean
import parawrap
def expand_template(contents, params):
if not params:
params = {}
tpl = Template(source=str(contents), searchList=[params])
return tpl.respond()