Skip to content

Instantly share code, notes, and snippets.

Steve Hanov smhanov

Block or report user

Report or block smhanov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@smhanov
smhanov / description.md
Last active Sep 2, 2019
Pipeline multiprocessing for python with generators
View description.md

Pipeline multiprocessing in Python with generators

Similar to mpipe, this short module lets you string together tasks so that they are executed in parallel.

The difference is that it lets you use generators, functions which yield results instead of returning them. Each yielded item gets passed to the next stage.

You can specify that one or more copies of the workers operate on the input queue.

Things that can be in a stage

View copyinsert.py
#!/usr/bin/env python3
import time
import sys
class SuffixArray:
def __init__(self, A, B):
self.length1 = len(A)+1
self.length2 = len(B)+1
self.seq = A + b"\001" + B + b"\000"
View Heap.js
// By Steve Hanov (2014)
// Released to public domain
//
// Minimum element is always on top.
// You can pass in an optional lessThan(a, b) function to the constructor.
// You may use .length to retrieve the length. Try not to set it though.
function Heap()
{
if (arguments.length) {
@smhanov
smhanov / dawg.py
Last active Dec 2, 2019
Use a DAWG as a map
View dawg.py
#!/usr/bin/python3
# By Steve Hanov, 2011. Released to the public domain.
# Please see http://stevehanov.ca/blog/index.php?id=115 for the accompanying article.
#
# Based on Daciuk, Jan, et al. "Incremental construction of minimal acyclic finite-state automata."
# Computational linguistics 26.1 (2000): 3-16.
#
# Updated 2014 to use DAWG as a mapping; see
# Kowaltowski, T.; CL. Lucchesi (1993), "Applications of finite automata representing large vocabularies",
# Software-Practice and Experience 1993
You can’t perform that action at this time.