Skip to content

Instantly share code, notes, and snippets.

View jszakmeister's full-sized avatar

John Szakmeister jszakmeister

View GitHub Profile
@jszakmeister
jszakmeister / loose-labels.clj
Last active March 4, 2017 17:51
Paul Heckbert's loose labeling (nice numbers) algorithm.
(import 'java.lang.Math)
;; This implementation comes from the "Nice Numbers for Graph Labels" in
;; Graphics Gems by Andrew S. Glassner. This is Paul Heckbert's algorithm
;; though.
(defn ^double nice-num [^double x round]
(let [exp (Math/floor (Math/log10 x))
f (/ x (Math/pow 10. exp))
nf (if round
@jszakmeister
jszakmeister / scc.txt
Created October 20, 2013 10:56
Large graph to test an SCC algorithm.
This file has been truncated, but you can view the full file.
[-100000 -37833]
[-100000 43890]
[-99998 -87012]
[-99998 -83053]
[-99998 90798]
[-99997 51064]
[-99997 76882]
[-99996 -78333]
[-99996 70886]
[-99994 -90905]
diff --git a/functional_tests/test_multiprocessing/test_keyboardinterrupt.py b/functional_tests/test_multiprocessing/test_keyboardinterrupt.py
index 8f07e54..86452a9 100644
--- a/functional_tests/test_multiprocessing/test_keyboardinterrupt.py
+++ b/functional_tests/test_multiprocessing/test_keyboardinterrupt.py
@@ -25,9 +25,12 @@ runner = os.path.join(support, 'fake_nosetest.py')
def keyboardinterrupt(case):
#os.setsid would create a process group so signals sent to the
#parent process will propogates to all children processes
- from tempfile import mktemp
+ from tempfile import mktemp, TemporaryFile