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
def parse_bool_str(val): | |
if isinstance(val, str): | |
val = val.lower().strip() | |
if val in ['true', 'yes', 'y', '1']: | |
val = True | |
elif val in ['false', 'no', 'n', '0']: | |
val = False | |
else: | |
raise ValueError('Provided value cannot be parsed as a string.') |
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 subprocess | |
import os | |
from pathlib import Path | |
from typing import Union | |
class SshClient(): | |
""" Perform commands and copy files on ssh using subprocess | |
and native ssh client (OpenSSH). | |
""" | |
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 | |
def tracer(frame, event, arg): | |
print(f'{frame = }') | |
print(f'{event = }') | |
print(f'{arg = }') | |
print() | |
# if you enter any function, still use the same trace function. | |
if event == 'call': |
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 threading | |
import concurrent.futures | |
import time | |
import numpy as np | |
from operator import itemgetter | |
def func(worker_id, sleep): | |
start = time.perf_counter() | |
print(f'func {worker_id} started @ {threading.get_native_id()}') | |
time.sleep(sleep) |
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
/* | |
* Name: NOTION MOD | |
* Homepage: | |
* Author: mamaj | |
* Version: v1.0 | |
* Updated: 02.14.2020 | |
*/ | |
/*.notion-text-block a, .notion-quote-block a, .notion-bulleted_list-block a { |