Skip to content

Instantly share code, notes, and snippets.

View hasansezertasan's full-sized avatar
😎
Open Source | Software Developer

Hasan Sezer Taşan hasansezertasan

😎
Open Source | Software Developer
View GitHub Profile
from __future__ import annotations
import asyncio
import json
from functools import partial
from typing import Any
from aio_pika import DeliveryMode
from aio_pika import ExchangeType
from aio_pika import IncomingMessage
@hasansezertasan
hasansezertasan / detector.py
Created November 6, 2025 20:08
Detects if importing the given module causes any use of __import__() or importlib.import_module() at runtime.
"""
detector.py
------------------
Usage:
python -m detector fastapi
Detects if importing the given module causes any use of
__import__() or importlib.import_module() at runtime.
"""
@hasansezertasan
hasansezertasan / png-to-ico-multisize.py
Created November 2, 2025 23:52
Convert PNG to ICO format. Also, did you know that ICO format can have multiple size of image in itself, I didn't...
# /// script
# requires-python = ">=3.12"
# dependencies = ["pillow"]
# ///
from PIL import Image
def main() -> None:
with Image.open("icon.png") as img:
@hasansezertasan
hasansezertasan / keys.py
Created October 28, 2025 10:09
Hotkey registration module.
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "pynput",
# ]
# ///
# ruff: noqa: T201
"""Hotkey registration module."""
from collections.abc import Callable
from functools import wraps
@hasansezertasan
hasansezertasan / litestar-aa-update-nested-mre.py
Last active March 6, 2026 01:55
An MRE for Litestar Discord Server. The script down below gives `sqlalchemy.exc.InvalidRequestError: merge() with load=False option does not support objects transient (i.e. unpersisted) objects. flush() all changes on mapped instances before merging with load=False.` when updating a nested record with Litestar, Advanced Alchemy and DTOs.
# /// script
# requires-python = ">=3.12"
# dependencies = ["litestar[standard]>=2.9.1", "advanced-alchemy==1.7.0", "aiosqlite>=0.20.0"]
# ///
import datetime
from typing import Annotated, Optional
from uuid import UUID
# /// script
# requires-python = ">=3.14"
# dependencies = []
# ///
def main() -> None:
print("Hello from gist!")
@hasansezertasan
hasansezertasan / sqla-numerical-enum.py
Last active March 6, 2026 01:59
How to use SQLAlchemy with numerical enums?
# /// script
# requires-python = ">=3.14"
# dependencies = [
# "sqlalchemy==2.0.48",
# "starlette-admin==0.16.0",
# "uvicorn==0.41.0",
# ]
# ///
"""
How to use SQLAlchemy with numerical enums?
@hasansezertasan
hasansezertasan / udemy-checker-readme.md
Last active July 19, 2022 11:43
Udemy Status Checker

Udemy checker

Sometimes i do this when i finish the course, un-check all of the lessons i watch. So i created the script and i said to myself "do it with some options". So here it is...

// Instant checking for the un-collapsed sections
var checkboxes = document.getElementsByClassName("udlite-sr-only udlite-real-toggle-input")
for (const checkbox of checkboxes) {
  if (!checkbox.checked) {
    checkbox.click()