Skip to content

Instantly share code, notes, and snippets.

Frank Cleary frankcleary

Block or report user

Report or block frankcleary

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
@frankcleary
frankcleary / boundedexecutor.py
Last active Sep 13, 2019
Python ThreadPoolExecutor with bounded queue
View boundedexecutor.py
from concurrent.futures import ThreadPoolExecutor
from threading import BoundedSemaphore
class BoundedExecutor:
"""BoundedExecutor behaves as a ThreadPoolExecutor which will block on
calls to submit() once the limit given as "bound" work items are queued for
execution.
:param bound: Integer - the maximum number of items in the work queue
View sshemr.sh
sshemr(){
jobid=`/path/to/elastic-mapreduce --list --active | awk '{ print $1 }' | head -n1`
/path/to/elastic-mapreduce --ssh $jobid
}
@frankcleary
frankcleary / figure_rename.py
Created Apr 23, 2014
Rename figure files (figure 3.jpg -> figure 4.jpg)
View figure_rename.py
"""Rename a list of figures, making space for a new figure
Ex: Figure 1, Figure 2, Figure 3 -> Figure 1, Figure 3, Figure 4
"""
import sys
import os
import re
You can’t perform that action at this time.