Skip to content

Instantly share code, notes, and snippets.

View pankajthekush's full-sized avatar

pankajthekush

View GitHub Profile
@pankajthekush
pankajthekush / method_killer.py
Last active November 10, 2022 10:22
Run a method for n seconds
class FuncTimer():
def __init__(self,fn,args,runtime):
self.fn = fn
self.args = args
self.queue = multiprocessing.Queue()
self.runtime = runtime
self.process = multiprocessing.Process(target=self.thread_caller)
def thread_caller(self):
with ThreadPoolExecutor() as executor:
@pankajthekush
pankajthekush / README.md
Last active October 14, 2022 09:33 — forked from godber/AUTHORS
pdfinfo - A simple python wrapper of the pdfinfo command line tool.

PDFINFO example

This has now been modified to work with either Python 2 or Python 3.

An example has been added, see example.py.

python ./example.py
{'Tagged': 'no', 'Producer': 'Mac OS X 10.12.1 Quartz PDFContext', 'Creator': 'Word', 'Encrypted': 'no', 'Author': 'Shekhar Vemuri', 'File size': '6264512 bytes', 'Optimized': 'no', 'PDF version': '1.3', 'ModDate': 'Thu Dec  8 11:42:16 2016 MST', 'Title': 'Guide to Apache Airflow', 'Page size': '612 x 792 pts (letter)', 'CreationDate': 'Thu Dec  8 11:42:16 2016 MST', 'Pages': '6'}