Skip to content

Instantly share code, notes, and snippets.

Avatar

Joshua Harlow harlowja

View GitHub Profile
View remote_tester
import argparse
import getpass
import os
import select
import socket
import sys
import tarfile
import tempfile
import threading
View gist:9c35e443dfa136a4f965
import eventlet
eventlet.monkey_patch(os=False, thread=False)
import time
import threading
LOCK = threading.Lock()
@harlowja
harlowja / gist:6a185742de6d4887efe4
Created Jun 10, 2014
Rpm version mini-webserver
View gist:6a185742de6d4887efe4
#!/usr/bin/python
from BaseHTTPServer import (HTTPServer, BaseHTTPRequestHandler)
from optparse import OptionParser
from rpmUtils.miscutils import splitFilename
from yum import packages
import StringIO
import cgi
@harlowja
harlowja / rpm_compare.py
Created Jun 16, 2014
Rpm comparator test
View rpm_compare.py
from yum import packages
def to_envra(name, version, arch="noarch", epoch=0):
pieces = version.split(".")
version_segments = []
release_segments = []
in_release = True
for segment in version.split("."):
if segment.isdigit() and in_release:
View slow_queue_test.py
import time
import threading
import sloq
THREADS = 5
RATE = 1
WORK_UNITS = 100
WORK_DELAY = 0.1
View test.py
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class BaseStorage(object):
def ensure_atom(self, atom):
def set_atom_state(self, atom_name, state):
View gist:975533763a276bfe7fb2
import a
class B(a.A):
pass
def itersubclasses(cls, _seen=None):
"""Generator over all subclasses of a given class in depth first order."""
View gist:d5c536de8d8f72377760
from taskflow.types import fsm
from taskflow import states as st
m = fsm.FSM(st.UNDEFINED)
m.add_state(st.UNDEFINED)
m.add_state(st.RESUMING)
m.add_state(st.REVERTED)
m.add_state(st.SCHEDULING)
View fsm_test.py
from taskflow.types import fsm
from taskflow import states as st
m = fsm.FSM(st.UNDEFINED)
def on_enter(new_state, event):
print("Entering new state '%s' in "
"response to event '%s'" % (new_state, event))
View gist:e87017a585a706166d70
# -*- 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
#