Skip to content

Instantly share code, notes, and snippets.

View arquolo's full-sized avatar

Paul Maevskikh arquolo

  • PathVision.ai
  • Planet Earth
View GitHub Profile
@arquolo
arquolo / nitpick-style.toml
Last active February 20, 2023 17:40
Nitpick config
["pyproject.toml".tool.yapf]
based_on_style = "facebook"
align_closing_bracket_with_visual_indent = true
allow_multiline_dictionary_keys = true
coalesce_brackets = true
column_limit = 79
dedent_closing_brackets = false
spaces_around_power_operator = true
@arquolo
arquolo / icecream2.py
Last active November 21, 2022 08:38
Fork of https://github.com/gruns/icecream with NumPy support. Python 3.6+
#!/usr/bin/env python
#
# IceCream - Never use print() to debug again
#
# Ansgar Grunseid
# grunseid.com
# grunseid@gmail.com
#
# Pavel Maevskikh
@arquolo
arquolo / fix_pe.py
Last active July 1, 2022 13:02
Disable ASLR and make .nv_fatb section read-only to allow DLLs share address space and not overflow virtual memory on Windows
# Simple script to disable ASLR and make .nv_fatb sections read-only
# Requires: pefile ( python -m pip install pefile )
# Usage: fix_pe.py --input path/to/*.dll
import shutil
from argparse import ArgumentParser
from pathlib import Path
import pefile
@arquolo
arquolo / thin_plate_spline.py
Last active May 25, 2021 13:17
Fork from cheind/py-thin-plate-spline
from __future__ import annotations
import numpy as np
class TPS:
@staticmethod
def fit(c: np.ndarray, delta: np.ndarray, lambd: float = 0., reduced: bool = False) -> np.ndarray:
# c: (N, 2), delta: (N, 2) -> (N + 2, 2) or (N + 3, 2)
n = len(c)
@arquolo
arquolo / benchmark_torch.py
Last active June 2, 2023 09:27
Benchmark speed and batch of neural networks from PyTorch framework. Requires Python 3.8-3.11, PyTorch 2.0
import os
import warnings
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
from collections.abc import Callable
from concurrent.futures import ProcessPoolExecutor
from functools import partial
from itertools import count
from time import perf_counter
os.environ['CUDA_MODULE_LOADING'] = 'LAZY'