Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mc706's full-sized avatar

Ryan McDevitt mc706

View GitHub Profile
@mc706
mc706 / gittime.sh
Last active October 19, 2015 20:43
a quick one off bash script to total hours in commit messages matching Time: [1.5] pattern per user
#!/usr/bin/env bash
OIFS=$IFS;
IFS=$'\n';
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');
OUTPUT=()
HEADER=("CONTRIBUTORS")
for name in $CONTRIBUTORS
do
@mc706
mc706 / blockslide.html
Created May 15, 2013 03:27
A whirlpool of colors generated in javascript and jquery.
<html>
<style>
.row {
float: left;
clear: left;
}
.box{
float:left;
height:20px;

Keybase proof

I hereby claim:

  • I am mc706 on github.
  • I am mc706 (https://keybase.io/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
mc706 / overlaps.py
Last active March 29, 2017 14:16
phillydev#daily_programmer-2017-03-29.py
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)]
@mc706
mc706 / overlaps.js
Created March 29, 2017 15:00
phillydev#daily_programmer-2017-03-29.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 {
clusters.push(pair)
}
return clusters
},[]);
@mc706
mc706 / parallelism.py
Created September 19, 2018 15:32
Parallelism.py
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
mc706 / reddit_lottery.txt
Created November 3, 2022 18:37 — forked from nsa-yoda/reddit_lottery.txt
Reddit History: /u/BlakeClass's comment on What to do if you win The Lottery
Congratulations! You just won millions of dollars in the lottery! That's great.
Now you're fucked.
No really.
You are.
You're fucked.