Skip to content

Instantly share code, notes, and snippets.

@amir-saniyan
amir-saniyan / Modern Git Workflow.md
Last active June 11, 2026 22:45
Modern Git Workflow on GitHub

Modern Git Workflow on GitHub

Based on: GitHub Flow + Conventional Commits + Squash Merge + Semantic Versioning


1. Core Philosophy

  • One permanent branch: main
  • All work in short-lived branches
@amir-saniyan
amir-saniyan / The Go Programming Language Specification Persian.md
Created May 13, 2026 09:30
مشخصات زبان برنامه‌نویسی گو

مشخصات زبان برنامه‌نویسی Go

@amir-saniyan
amir-saniyan / vtk-2d-pipeline-minimal.py
Last active December 27, 2025 00:51
VTK 2D Pipeline
import sys
from pathlib import Path
import vtkmodules.all as vtk
from PySide6.QtWidgets import QApplication, QMainWindow
from vtkmodules.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
IMAGE_PATH = "test.png"
@amir-saniyan
amir-saniyan / git-pull-all.sh
Created September 29, 2024 13:38
Pull all subdirectory repositories script (two level nested)
#!/usr/bin/env bash
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
cd "$SCRIPTPATH"
for dir in */ ; do
echo "$dir"
cd "$SCRIPTPATH/$dir"
@amir-saniyan
amir-saniyan / aes.py
Created September 24, 2024 10:53
Python 3 - Encrypt/Decrypt using AES 256
# Python 3 - Encrypt/Decrypt using AES 256
# pip install pycryptodome
# Crypto.__version__ == 3.20.0
import base64
import hashlib
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
@amir-saniyan
amir-saniyan / image_cropper.py
Last active October 17, 2024 03:59
Image Cropper
class ImageCropper:
@staticmethod
def crop(image, x, y, width, height):
try:
image_width = image.shape[1]
image_height = image.shape[0]
x = max(0, min(image_width - 1, x))
y = max(0, min(image_height - 1, y))
@amir-saniyan
amir-saniyan / Persian Names Cleaner.md
Last active July 8, 2024 18:21
Persian Names Cleaner

Persian Names Cleaner

from tqdm import tqdm
from collections import OrderedDict
import csv


def read_names(file_path):
    names = []
@amir-saniyan
amir-saniyan / python-motion-detector.md
Last active December 10, 2022 09:49
Python Motion Detector

Python Motion Detector

Motion Detector Using BackgroundSubtractorKNN

import cv2

_IMAGE_SIZE = (512, 512)

_BACKGROUND_SUBTRACTOR_HISTORY = 100
@amir-saniyan
amir-saniyan / create-private-branch-of-a-public-repository.md
Last active January 5, 2025 07:43
Create private branch of a public repository

Create private branch of a public repository

This gist describes how to create private branch (downstream) of a public repository (upstream).

Initialize repository

$ git init private-repo
$ cd private-repo