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
@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()
@hasansezertasan
hasansezertasan / main.py
Created May 12, 2024 01:12
How to use SQLAlchemy with numerical enums?
"""
How to use SQLAlchemy with numerical enums?
`IntEnum` class is taken from this article: [Using Python enums in SQLAlchemy models](https://michaelcho.me/article/using-python-enums-in-sqlalchemy-models/), all credits to the author.
"""
import datetime
import enum
from sqlalchemy import Integer, TypeDecorator, create_engine
# /// script
# requires-python = ">=3.14"
# dependencies = []
# ///
def main() -> None:
print("Hello from gist!")
@hasansezertasan
hasansezertasan / mre.py
Last active October 14, 2025 11:29
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