This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AC": "+247-####", | |
"AD": "+376-###-###", | |
"AE": "+971-5#-###-####", | |
"AE": "+971-#-###-####", | |
"AF": "+93-##-###-####", | |
"AG": "+1(268)###-####", | |
"AI": "+1(264)###-####", | |
"AL": "+355(###)###-###", | |
"AM": "+374-##-###-###", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Greet: | |
class Types(StrEnum): | |
morning: str = "morning" | |
afternoon: str = "afternoon" | |
evening: str = "evening" | |
@staticmethod | |
def morning(hour: int) -> bool: | |
return 5 <= hour < 12 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo() { | |
if alias "$1" &> /dev/null; then | |
command sudo $(alias $1 | cut -d '=' -f 2) ${@:2} | |
else | |
command sudo "$@" | |
fi | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
from PIL import Image | |
import configparser | |
import subprocess | |
import sys | |
import os | |
def fetch_desktop_image() -> str: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
_file=$1 | |
_file_name=$(python3 -c "print('$_file'.split('.', maxsplit=1)[0])") | |
javac $_file && | |
java $_file_name && | |
rm $_file_name.class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
python3.9 -B $@ |
NewerOlder