Skip to content

Instantly share code, notes, and snippets.

View pourmand1376's full-sized avatar
😉
Learning

Amir Pourmand pourmand1376

😉
Learning
View GitHub Profile
@pourmand1376
pourmand1376 / getShamsiDate.js
Created September 6, 2025 12:12
Adding Shamsi Date to Templater
// Simplified Gregorian to Shamsi date converter
function toJalaali(gy, gm, gd) {
var g_days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
var j_days_in_month = [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29];
gy = parseInt(gy) - 1600;
gm = parseInt(gm) - 1;
gd = parseInt(gd) - 1;
var g_day_no = 365 * gy + parseInt((gy + 3) / 4) - parseInt((gy + 99) / 100) + parseInt((gy + 399) / 400);
@pourmand1376
pourmand1376 / rules.md
Created August 25, 2025 09:22
My Cursor Rules for Git Commit Messaging

IDENTITY and PURPOSE

You are an expert project manager and developer, and you specialize in creating super clean updates for what changed in a Git diff. Follow the conventional commits format:

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]
@pourmand1376
pourmand1376 / mac.sh
Last active August 22, 2025 09:55
Fix Mac Apps - Security Error
# Add this function to your shell profile (e.g., ~/.zshrc or ~/.bashrc)
fix_app() {
if [ -z "$1" ]; then
echo "Usage: fix_app <FullPathToApp>"
return 1
fi
APP_PATH="$1"
@pourmand1376
pourmand1376 / combined_stopwords.txt
Created March 20, 2025 13:14
All Persian Stop Words
همگام
قال
نيز
بنابراين
مون
بران
چندین
سعی
خوبي
ث
@pourmand1376
pourmand1376 / backup.sh
Created December 25, 2024 12:56
Daily Backup Script of Docker Volumes
#!/bin/bash
set -euo pipefail
# Directory containing Docker Compose file
DOCKER_DIR="/home/azureuser/services/mongodb"
# Backup storage directory
BACKUP_DIR="/home/azureuser/services/mongodb/backup"
@pourmand1376
pourmand1376 / main.py
Created August 15, 2023 06:46
Minimal Working Example of FastAPI using LangChain Stream Response
# Answer taken from https://gist.github.com/jvelezmagic/f3653cc2ddab1c91e86751c8b423a1b6
from fastapi import FastAPI
from fastapi.responses import StreamingResponse
from langchain.chat_models import ChatOpenAI
from langchain.prompts import PromptTemplate
from pydantic import BaseModel
from typing import AsyncGenerator
@pourmand1376
pourmand1376 / obsidian.sh
Last active August 8, 2023 13:39
Sync Obsidian Android
#!/bin/bash
# Get and validate username
get_name() {
read -p "Enter your name: " name
echo "Username: $name"
if [ -z "$name" ]; then
echo "Name is empty!"
exit 1
@pourmand1376
pourmand1376 / DailyNotesTemplate.md
Last active May 1, 2023 16:44
My Obsidian Templates - تمپلت فارسی من برای ابسیدین
direction date week month quarter year
rtl
<% tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD") %>
<% tp.date.now("YYYY-[W]ww", 0, tp.file.title, "YYYY-MM-DD") %>
<% tp.date.now("YYYY-MM", 0, tp.file.title, "YYYY-MM-DD") %>
<% tp.date.now("YYYY-[Q]Q", 0, tp.file.title, "YYYY-MM-DD") %>
<% tp.date.now("YYYY", 0, tp.file.title, "YYYY-MM-DD") %>

[[ obsidian-notes/Journaling/WeeklyNotes/<% tp.date.now("YYYY-[W]ww", 0, tp.file.title, "YYYY-MM-DD") %> | برنامه این هفته ]] - [[ obsidian-notes/Journaling/MonthlyNotes/<% tp.date.now("YYYY-MM", 0, tp.file.title, "YYYY-MM-DD") %> | برنامه این ماه ]] - [[ obsidian-notes/Journaling/QuarterlyNotes/<% tp.date.now("YYYY-[Q]Q", 0, tp.file.title, "YYYY-MM-DD") %> | برنامه این فصل ]] - [[ obsidian-notes/Journaling/YearlyNotes/<% tp.date.now("YYYY", 0, tp.file.title, "YYYY-MM-DD") %> | برنامه امسال ]]

@pourmand1376
pourmand1376 / git_fix
Created November 28, 2022 08:50
These two lines of code fix whenever there is a mismatch between ubuntu and windows git status
git config core.autocrlf true
git config core.filemode false
@pourmand1376
pourmand1376 / Makefile
Last active November 27, 2022 11:52
My MakeFile Template
.ONESHELL:
SHELL = /bin/bash
CONDA_ACTIVATE = source $$(conda info --base)/etc/profile.d/conda.sh ; conda activate ; conda activate
.PHONY: help
help: update
@egrep -h '\s##\s' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-30s\033[0m %s\n", $$1, $$2}'
update: ## pull git updates