Skip to content

Instantly share code, notes, and snippets.

View MihanixA's full-sized avatar
🏠
Working from home

Mikhail S MihanixA

🏠
Working from home
View GitHub Profile
@MihanixA
MihanixA / exp_retry.py
Created February 12, 2020 00:01
Python Exponential Retry Decorator
import time
import math
from copy import deepcopy
from typing import List, Type, Union, Callable, Any, Optional
from functools import wraps
def exp_retry(count: int = 5, power: Union[int, float] = 2, ignore_exceptions: List[Type[BaseException]] = None,
raise_on_failure: Optional[Type[BaseException]] = Exception) -> Callable:
ignore_exceptions: list = deepcopy(ignore_exceptions) if ignore_exceptions is not None else list()
@MihanixA
MihanixA / server.py
Last active October 24, 2020 22:12 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
import time
import uuid
from typing import Iterator
from collections import deque
from contextlib import contextmanager
import threading
import traceback
import sqlalchemy
import sqlalchemy.event
import sqlalchemy.orm
import logging
import os
import sys
import json_logging
class Logger:
URGENT = logging.CRITICAL + 10
@MihanixA
MihanixA / metapipe.sol
Created March 16, 2023 01:06
Account Abstraction / Sample Use Case / ETHcc
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";