Skip to content

Instantly share code, notes, and snippets.

Ryan McDevitt mc706

Block or report user

Report or block mc706

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
from queue import Queue
from threading import Thread
from typing import Iterable, Callable, Optional
def parallel_process(work: Iterable, task_func: Callable, num_threads: int, callback: Optional[Callable] = None) -> None:
Processes work in parallel using a queue-worker pattern.
Breaks up work into `num_threads` workers, which will call `task_func` for each item in work.
mc706 / overlaps.js
Created Mar 29, 2017
View overlaps.js
function overlaps(...pairs) {
return pairs.sort().reduce((clusters, pair) => {
let i = clusters.findIndex(c => Math.max(c[0],pair[0]) <= Math.min(c[1],pair[1]));
if (i !== -1) {
clusters[i] = [Math.min(clusters[i][0], pair[0]), Math.max(clusters[i][1], pair[1])]
} else {
return clusters
mc706 /
Last active Mar 29, 2017
def overlaps(pairs):
clusters = []
for pair in sorted(pairs):
low, high = pair
found = False
for i, cluster in enumerate(clusters):
cluster_low, cluster_high = cluster
if max(low, cluster_low) <= min(high, cluster_high):
found = True
clusters[i] = [min(low, cluster_low), max(high, cluster_high)]

Keybase proof

I hereby claim:

  • I am mc706 on github.
  • I am mc706 ( on keybase.
  • I have a public key whose fingerprint is 8AFC 84AA E445 6147 69DF 6671 662C CDAB 706D 996F

To claim this, I am signing this object:

mc706 /
Last active Oct 19, 2015
a quick one off bash script to total hours in commit messages matching Time: [1.5] pattern per user
#!/usr/bin/env bash
TAGS=$(git log --tags --simplify-by-decoration --pretty="format:%ci %d" | grep -o "\(tag:\s[v0-9\.]*\)" | sed "s/tag: //g")
CONTRIBUTORS=$(git shortlog -e -s | grep -o "<.*>"| sed 's/[<>]//g');
for name in $CONTRIBUTORS
mc706 / blockslide.html
Created May 15, 2013
A whirlpool of colors generated in javascript and jquery.
View blockslide.html
.row {
float: left;
clear: left;
You can’t perform that action at this time.