Skip to content

Instantly share code, notes, and snippets.

View sany2k8's full-sized avatar
:octocat:
Focusing

Md. Sany Ahmed sany2k8

:octocat:
Focusing
View GitHub Profile

📘 SQLAlchemy Relationship Types

This guide demonstrates the four common types of relationships in SQLAlchemy using realistic examples:

  • ✅ One-to-One: UserUserProfile

  • ✅ One-to-Many: BlogBlogPost

📘 PostgreSQL Query Plan Examples

This document demonstrates various PostgreSQL query plan types, with sample datasets, queries, and EXPLAIN/EXPLAIN ANALYZE outputs.


✅ Step 1: Basic Table and Data

@sany2k8
sany2k8 / python_framework.md
Last active June 7, 2025 17:12
Python framework decision

Quick Decision Tree

  • REST API? → FastAPI
  • Full web app? → Django
  • Learning/Prototyping? → Flask
  • Max performance? → Falcon
  • Real-time? → Sanic/FastAPI

Framework Comparison

Django

@sany2k8
sany2k8 / postgres-jsonb.md
Created July 25, 2024 12:25 — forked from kcranston/postgres-jsonb.md
intro to document stores in postgreSQL

Document stores in PostgreSQL

Notes for software engineering meeting presentation

What

  • mid to late 2000s: appearance of Document stores / NoSQL databases such as Mongo, Couch
  • Relational DBs now have support for document data: JSON in MySQL, JSON and JSONB in PostgreSQL
  • Focus on JSONB in Postgres (most full featured)
@sany2k8
sany2k8 / commit-message-format.md
Created December 26, 2023 09:46 — forked from develar/commit-message-format.md
Commit Message Format

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
@sany2k8
sany2k8 / pydantic_phone_number_field.py
Created September 16, 2022 14:54 — forked from iRhonin/pydantic_phone_number_field.py
Pydantic Phone Number Field
import phonenumbers
from pydantic.validators import strict_str_validator
class PhoneNumber(str):
"""Phone Number Pydantic type, using google's phonenumbers"""
@classmethod
def __get_validators__(cls):
yield strict_str_validator
yield cls.validate
@sany2k8
sany2k8 / pydantic_password_field.py
Created September 16, 2022 14:54 — forked from iRhonin/pydantic_password_field.py
Pydantic Password Field
from typing import Any
from typing import Dict
from typing import Set
from typing import Type
from pydantic import SecretStr
from pydantic.utils import update_not_none
class Password(SecretStr):
@sany2k8
sany2k8 / terminal-colors-branch.sh
Created September 9, 2022 09:50 — forked from danielalvarenga/terminal-colors-branch.sh
Show branch in terminal Ubuntu
# Add in ~/.bashrc or ~/.bash_profile
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
RED="\[\033[01;31m\]"
YELLOW="\[\033[01;33m\]"
GREEN="\[\033[01;32m\]"
BLUE="\[\033[01;34m\]"
NO_COLOR="\[\033[00m\]"
@sany2k8
sany2k8 / pytest.md
Last active July 26, 2022 13:40 — forked from kwmiebach/pytest.md
pytest cheat sheet

Usage

(Create a symlink pytest for py.test)

pytest [options] [file_or_dir] [file_or_dir] ...

Help: