Skip to content

Instantly share code, notes, and snippets.

View omamkaz's full-sized avatar
🎯
Focusing

Osama Mohammed omamkaz

🎯
Focusing
View GitHub Profile
@omamkaz
omamkaz / phoneMasks.json
Created December 17, 2024 22:18 — forked from mikemunsie/phoneMasks.json
Phone Masks by Country Code JSON
{
"AC": "+247-####",
"AD": "+376-###-###",
"AE": "+971-5#-###-####",
"AE": "+971-#-###-####",
"AF": "+93-##-###-####",
"AG": "+1(268)###-####",
"AI": "+1(264)###-####",
"AL": "+355(###)###-###",
"AM": "+374-##-###-###",
@omamkaz
omamkaz / ar_en_numbers_convert.py
Last active October 18, 2024 01:00
simple python code to convert between arabic and english numbers
ar_numbers = "٠١٢٣٤٥٦٧٨٩"
en_numbers = "0123456789"
ar_number = "١٤٢٣٤٠٣٧osama"
en_number = "14234037osama"
def convert_numbers(text: str, to_language: str = "en") -> str:
def _convertor(text: str, from_language: str, to_language: str) -> str:
return "".join([to_language[from_language.index(n)] if n in from_language else n for n in text])
@omamkaz
omamkaz / greet.py
Created October 12, 2024 23:39
simple Python script that displays a "Good Morning," "Good Afternoon," or "Good Evening" message based on the current time
class Greet:
class Types(StrEnum):
morning: str = "morning"
afternoon: str = "afternoon"
evening: str = "evening"
@staticmethod
def morning(hour: int) -> bool:
return 5 <= hour < 12
@omamkaz
omamkaz / List.py
Created October 12, 2024 23:34
simple built-in list instance, that can work with a dimensions array.
from typing import overload, Any
class List(list):
@overload
def __getitem__(self, t: tuple, /) -> list[Any]: ...
def __getitem__(self, v, /):
if isinstance(v, tuple):
_v = None
for i in v:
@omamkaz
omamkaz / .zshrc
Created March 17, 2024 20:12
Fixing: sudo: [alias]: command not found
sudo() {
if alias "$1" &> /dev/null; then
command sudo $(alias $1 | cut -d '=' -f 2) ${@:2}
else
command sudo "$@"
fi
}
@omamkaz
omamkaz / plasma5_24_accent_color.py
Last active March 17, 2024 20:14
Change plasma v5.24 accent color.
#!/usr/bin/python3
from PIL import Image
import configparser
import subprocess
import sys
import os
def fetch_desktop_image() -> str:
#!/usr/bin/python3
from PIL import Image
import os.path
import sys
def resize_img(path: str, w: int, h: int) -> str:
image = Image.open(path)
new_image = image.resize((int(w), int(h)))
filename = os.path.basename(path).split(".", 1)
@omamkaz
omamkaz / run_cpp.sh
Created March 6, 2023 23:26
run cpp file direct
#!/usr/bin/bash
_file=$1
_file_name=$(python3 -c "print('$_file'.split('.', maxsplit=1)[0])")
g++ $_file -o $_file_name &&
./$_file_name &&
rm $_file_name
@omamkaz
omamkaz / run_java.sh
Created March 6, 2023 23:25
script to run java.java file direct.
#!/usr/bin/bash
_file=$1
_file_name=$(python3 -c "print('$_file'.split('.', maxsplit=1)[0])")
javac $_file &&
java $_file_name &&
rm $_file_name.class
@omamkaz
omamkaz / run_py.sh
Created March 6, 2023 23:23
run python file without create __pycache__ folder.
#!/usr/bin/bash
python3.9 -B $@