Skip to content

Instantly share code, notes, and snippets.

View jszakmeister's full-sized avatar

John Szakmeister jszakmeister

View GitHub Profile
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
@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]
@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 / gist:8040316
Created December 19, 2013 14:53
Aleph hanging on exit...
2013-12-19 09:52:04
Full thread dump OpenJDK Server VM (23.7-b01 mixed mode):
"Attach Listener" daemon prio=10 tid=0x8509c800 nid=0x1816 waiting on condition [0x00000000]
java.lang.Thread.State: RUNNABLE
"DestroyJavaVM" prio=10 tid=0xb650a400 nid=0x1719 waiting on condition [0x00000000]
java.lang.Thread.State: RUNNABLE
"Hashed wheel timer #1" prio=10 tid=0x850cac00 nid=0x1775 waiting on condition [0x84f5c000]
@jszakmeister
jszakmeister / buildall.sh
Last active August 29, 2015 14:02
Script to help build multiple configurations of Neovim
#!/bin/bash
set -e
set +o pipefail
BASE_DIR="$(dirname "$0")"
cd "$BASE_DIR"
if test -t 1; then
COLOR_FAIL="\e[31;1m"

Keybase proof

I hereby claim:

  • I am jszakmeister on github.
  • I am jszakmeister (https://keybase.io/jszakmeister) on keybase.
  • I have a public key whose fingerprint is 58B2 77C0 D208 F7AC 460C 07C8 4548 B3A8 C0D7 0C12

To claim this, I am signing this object:

@jszakmeister
jszakmeister / .gdbinit
Created November 25, 2014 11:43
gdbinit for Neovim (for debugging while running under LuaJIT)
set history filename .gdb-history
set history save on
set history size 2000
set env LD_PRELOAD /lib/x86_64-linux-gnu/libpthread.so.0
set env NVIM_PROG /home/jszakmeister/projects/neovim/build/debug/bin/nvim
set env VIMRUNTIME /home/jszakmeister/projects/neovim/runtime
path /home/jszakmeister/projects/neovim/.deps/usr/bin
set debug jit 1
import coverage
inst = coverage.coverage(auto_data=False, branch=True, data_suffix=None,
source=['foo'])
inst.load()
inst.start()
import foo
inst.stop()
inst.combine()
inst.save()
import threading
import time
from datetime import datetime
def foo():
while True:
print datetime.now()
time.sleep(1.0)
# Create a symlink that uses the serial number from the
# FTDI-based USB-to-Serial converter. Some distros have
# a version with the serial in /dev/serial/by-id, but I
# don't find it quite as friendly as this.
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="ttyUSB-ftdi-$attr{serial}"