Skip to content

Instantly share code, notes, and snippets.

View omamkaz's full-sized avatar
🏠
Working from home

Osama Mohammed Al-zabidi omamkaz

🏠
Working from home
View GitHub Profile
@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 $@
@omamkaz
omamkaz / snake.py
Created April 29, 2022 22:02
Simple python console snake game
#!/usr/bin/python3
from sys import argv
from random import randint, choice
from time import strftime, sleep
from curses import (textpad, curs_set, KEY_RIGHT,
KEY_LEFT, KEY_DOWN, KEY_UP,
wrapper, COLOR_RED)
####################### start advanced config #########################
@omamkaz
omamkaz / env_path.py
Created April 29, 2022 21:56
print linux env paths
#!/usr/bin/python3
from os import getenv
_paths = getenv("PATH").split(":")
def print_type(title: str, _filter: tuple):
print(f"\n@{title.title()} dirs:")
for (index, fp) in enumerate(filter(lambda fp: fp.startswith(_filter), _paths), 1):
print(f"{index:3}- {fp}")