Skip to content

Instantly share code, notes, and snippets.

@sehraramiz
sehraramiz / README.md
Last active July 19, 2022 06:48
A git hook to auto add a prefix based on changed module to commit messages

file path:

  • .git/hooks/prepare-commit-msg

Add this script to .git/hooks

It looks at the staged changes in git and add a prefix to commit message based on the location of the change

If the change is in the /*/api/api_a/*.py the commit message would be:

  • "[ApiA] blah blah"
"""use pydantic version 2"""
import enum
from typing import Generic, TypeVar
from pydantic import Field, BaseModel
from fastapi.encoders import jsonable_encoder
T = TypeVar("T")
@sehraramiz
sehraramiz / README.md
Last active May 30, 2022 09:26
Timer.sh

Usage:

send notification after 15 minutes

sh timer.sh 15m

send notification after 10 seconds

sh timer.sh 10

Keybase proof

I hereby claim:

  • I am sehraramiz on github.
  • I am sehraramiz (https://keybase.io/sehraramiz) on keybase.
  • I have a public key ASD87zEbkWZyd-OGISb8SDUoaqc7L1AjVb4irkgQt_8sggo

To claim this, I am signing this object:

@sehraramiz
sehraramiz / panjere.html
Last active February 20, 2021 10:23
Panjere Sample
<ul id="panjere"></ul>
<script src="https://cdn.jsdelivr.net/gh/sehraramiz/sehraramiz.github.io@latest/static/panjere.js"></script>
<script>showPanjere("https://mypanjere.ir/api/random/?count=5");</script>
@sehraramiz
sehraramiz / dmenu_run_clone.sh
Created November 27, 2020 10:16
a clone of dmenu_run
#!/bin/bash
declare programs=$(dmenu_path | head -30)
choice=$(echo -e "${programs[@]}" | dmenu -p 'Which program to run? ' -fn 'NotoMonoRegular:bold:pixelsize=30' )
echo $choice
$choice
@sehraramiz
sehraramiz / dmenu_dj.sh
Last active November 27, 2020 10:42
dmenu dj
#!/bin/bash
MusicDir="$HOME/Music"
declare playlistsNames=$(find $HOME/Music -maxdepth 1 -type f -name "*.xspf" -printf "%f\n" )
choice=$(echo -e "${playlistsNames[@]}" | dmenu -l 10 -p "what's your mood? " -fn 'NotoMonoRegular:bold:pixelsize=30')
if (printf '%s\n' "${playlistsNames[@]}" | grep -xq $choice); then
vlc $MusicDir/$choice
fi
@sehraramiz
sehraramiz / inotify.sh
Created January 23, 2018 10:32
inotify max_user_watches increase command, use when react native packager stuck on start
echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances && echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p