Skip to content

Instantly share code, notes, and snippets.

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

Md. Sany Ahmed sany2k8

:octocat:
Focusing
  • Khulna, Bangladesh
View GitHub Profile
@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:

import asyncio
import aiohttp
import time
async def gather_with_concurrency(n, *tasks):
semaphore = asyncio.Semaphore(n)
async def sem_task(task):
async with semaphore:
@sany2k8
sany2k8 / upload-to-aws-flask.md
Created December 16, 2021 13:02 — forked from leongjinqwen/upload-to-aws-flask.md
upload files to aws s3 bucket with flask

Upload files to AWS

Make sure you already have S3 bucket, access key and secret key before go through this notes.

How to connect to AWS?

Boto3 allows Python developers to write software that makes use of services like Amazon S3 and Amazon EC2.

Step 1: Install boto3 with pip

pip install boto3
@sany2k8
sany2k8 / script.sh
Created October 25, 2021 08:49 — forked from vielhuber/script.sh
PostgreSQL: Backup and restore export import pg_dump with password on command line #sql
# best practice: linux
nano ~/.pgpass
*:5432:*:username:password
chmod 0600 ~/.pgpass
# best practice: windows
edit %APPDATA%\postgresql\pgpass.conf
*:5432:*:username:password
# linux