Skip to content

Instantly share code, notes, and snippets.

View n05tr0m0's full-sized avatar
:electron:
My life is based on true story.

Muslim Abdulmazhidov n05tr0m0

:electron:
My life is based on true story.
View GitHub Profile
@n05tr0m0
n05tr0m0 / logger.py
Created March 13, 2024 20:43
FastAPI + Uvicorn + loguru configuration
"""Classes and functions to customize logs."""
import logging
import sys
from loguru import logger
from app.config import AppSettings # originaly this is BaseSettings from Pydantic
@n05tr0m0
n05tr0m0 / password_generator.py
Last active May 21, 2023 16:35
A simple password generator for CLI with automatic copying of the generated password to clipboard. Don't forget to give the rights to execute.
#!/usr/bin/env python3
import argparse
import platform
import random
import subprocess
import sys
from string import ascii_letters, digits, punctuation
def parse_args() -> argparse.Namespace:
@n05tr0m0
n05tr0m0 / hash_pass.py
Last active November 10, 2022 00:33
Python Password Generator
# taken from https://stackoverflow.com/questions/9594125/salt-and-hash-a-password-in-python/56915300#56915300
import hashlib
import hmac
import os
def hash_new_password(password: str) -> tuple[bytes, bytes]:
"""
Hash the provided password with a randomly-generated salt and return the
salt and hash to store in the database.