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
#!/usr/bin/env python | |
import time | |
import sys | |
import socket | |
import ssl | |
import math | |
def percentile(N, percent, key=lambda x:x): |
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
@contextmanager | |
def lock(file_name, block=False): | |
fp = open(file_name, 'w') | |
opts = fcntl.LOCK_EX | |
if not block: | |
opts |= fcntl.LOCK_NB | |
try: | |
fcntl.lockf(fp, opts) |
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 sys | |
from importlib._bootstrap import _find_and_load | |
from resource import getrusage, RUSAGE_SELF | |
from contextlib import contextmanager | |
IMPORT_ENTRY = _find_and_load.__code__ | |
def get_mem(): |
OlderNewer