Skip to content

Instantly share code, notes, and snippets.

View antibagr's full-sized avatar
🦄
something in the way

Anthony antibagr

🦄
something in the way
View GitHub Profile
@antibagr
antibagr / asyncio_with_threads.py
Created October 7, 2021 00:55
Asyncio with threads explained
import time
import asyncio
import threading
async def coro(name: str) -> str:
await asyncio.sleep(0.001)
print(f'[Coroutine] Called with {name=}')
return name
@antibagr
antibagr / deco.py
Last active September 12, 2021 14:25
Dynamic parameterised decorator
from __future__ import annotations
from typing import Any, Callable, Type
from dataclasses import dataclass
class A:
pass
@dataclass
@antibagr
antibagr / test_fast_api_custom_datetime.py
Created August 5, 2021 16:58
FastAPI Custom Datetime Format (ISO 8601)
import asyncio
from datetime import datetime
import pytest
from fastapi import FastAPI
from starlette.testclient import TestClient
from pydantic import BaseModel
class CustomDatetime(BaseModel):
from functools import wraps
from typing import Callable, Awaitable, Any, Union
from aiogram import types
# sends to user when handler raises exception
ERROR_MESSAGE = "No, I'm dying. Please tell BotFather I love him ..."
@echo off
:: ========================================
:: Easy way to make migrations on Django project
:: Replace YOUR_APP_NAME on line 13 with your actual Django app name
:: Made for fun by Rudolf Nemov
:: https://github.com/antibagr
@echo off
:: ========================================
:: Small script to automate load developer environment on Windows
:: Open it from cmd. it will change directory, load virtual environment and open your IDE automatically.
:: Launch it and it will list folders in "YOUR_PROJECTS_FOLDER"
:: Then enter a folder you wish to open.