This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multiprocessing | |
import sys | |
def rsetgen(count, floor, ceiling): | |
""" | |
Recursively generate all possible sets of | |
count unique numbers between floor and ceiling | |
""" | |
if 1 == count: | |
for i in xrange(floor, ceiling): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
""" | |
Get PID of n'th parent | |
This works in linux only | |
""" | |
def pnid(n=1, pid=os.getpid()): | |
for i in range(n): | |
try: | |
procfile = open("/proc/%s/status" % pid) |
NewerOlder