Skip to content

Instantly share code, notes, and snippets.

View ph33nx's full-sized avatar
🥷
Cooking

Abhi ph33nx

🥷
Cooking
  • 12:00 (UTC +05:30)
View GitHub Profile
@ph33nx
ph33nx / backup_mysql_db.sh
Last active June 5, 2025 11:20
This bash script automates the process of daily backups for all MySQL/MariaDB databases on a Linux server. It stores each database backup in a dedicated directory under /var/backups/mysql/ and names the backup files using the format <database_name>_<date_time>.sql. Additionally, the script includes a cleanup function that deletes backups older t…
#!/bin/bash
# backup_mysql_db.sh
# This script backs up each MySQL/MariaDB database into its own file daily.
# The backups are stored in /var/backups/mysql/<database_name>/<database_name>_<date_time>.sql
# Backups older than 30 days are automatically deleted.
#
# Author: Ph33nx
# GitHub: https://github.com/ph33nx
#
@ph33nx
ph33nx / wp-cron.sh
Created July 14, 2024 13:04
Run Cron Jobs in WordPress Using WP CLI (bash Script)
#!/bin/bash
# Run cron jobs for all wordpress sites in a folder using WP CLI.
# Author: https://github.com/ph33nx
# !IMP: Change BASE_DIR below to the folder that has the wordpress sites. Ex: /var/www or /usr/share/nginx etc..
BASE_DIR="/path_to_folder_that_has_wordpress_sites/"
# Check for wp-cli.phar existence in the system
if ! command -v wp &> /dev/null; then
echo "WP-CLI could not be found. Please install it first."
@ph33nx
ph33nx / fedora-41-desktop-setup.sh
Last active June 15, 2025 22:10
Fedora 41 Desktop Environment Setup for Developers
sudo dnf update -y && sudo dnf autoremove -y
reboot
# Enable RPMFusion repos: https://docs.fedoraproject.org/en-US/quick-docs/rpmfusion-setup/
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf config-manager --enable fedora-cisco-openh264
sudo dnf update @core
# If secure boot
sudo dnf install kmodtool akmods mokutil openssl
@ph33nx
ph33nx / batch_image_converter.py
Last active July 1, 2025 00:53
Batch Convert Images to Web-Optimized JPG or WEBP using Python with EXIF Preservation 🖼️✨ Fast, batch image conversion while preserving EXIF metadata using Python Script
#!/usr/bin/env python3
"""
Author: ph33nx
URL: https://gist.github.com/ph33nx/861d9ff35721d56205c834c7f8308e0b
Description:
This script converts images from various formats (e.g., PNG, JPG, WebP) to either JPG or WebP for web optimization.
It preserves EXIF metadata, allows for optional parameter customization, and handles errors gracefully.
@ph33nx
ph33nx / download_subtitles.py
Last active May 27, 2025 22:38
Python script to recursively download missing subtitles for video files in formats like .mp4, .mkv, .avi, and .mov. Ideal for Jellyfin, Plex, Emby, and other media servers in homelab setups. Automatically fetches the best-matched .srt subtitles in your preferred language using subliminal. Boosts your media library with accurate subtitles for mov…
#!/usr/bin/env python3
"""
Author: ph33nx
URL: https://github.com/ph33nx
Description:
This script automatically scans a directory (recursively) for video files and downloads the best matching subtitles using the `subliminal` library.
It avoids duplicate work by checking for existing `.srt` subtitle files and is suitable for organizing media libraries in homelab setups.
Key Features:
@ph33nx
ph33nx / arch-linux-setup-gaming.sh
Last active June 9, 2025 10:29
Arch Linux Gaming Setup Script: Automate the installation of NVIDIA drivers, Wine, Lutris, Vulkan, and essential 32-bit libraries for gaming. This script ensures a complete gaming environment setup with DXVK and Winetricks on Arch-based systems. Perfect for gamers looking to optimize their Linux setup for titles on Steam, Epic, or standalone Win…
#!/bin/bash
# Gaming Setup Script for Arch Linux with Nvidia GPU
# Author: ph33nx
# Description: Installs all necessary packages and configurations for gaming on Arch Linux
# Update system and keyring
echo "Updating system and keyring..."
sudo pacman -Syu --needed --noconfirm archlinux-keyring
@ph33nx
ph33nx / block-internet-access-folder-executables-windows-firewall.bat
Last active July 7, 2025 11:55
Batch script to block internet access for all .exe files in a folder recursively using Windows Firewall (inbound and outbound rules). Includes dynamic folder path input, usage instructions, and automation.
:: Batch Script: block_folder.bat
:: Author: https://github.com/ph33nx
:: Description: Blocks all .exe files in the specified folder (and subfolders) from accessing the internet (both inbound and outbound) using Windows Firewall.
:: Usage:
:: block_folder.bat [FolderPath]
:: - Pass the folder path containing the .exe files to block.
:: block_folder.bat -h
:: - Displays this help message.
:: Check for admin rights and relaunch as admin if not already
@ph33nx
ph33nx / project2txt.py
Last active February 7, 2025 15:20
project2txt.py - Python script that Exports Project Structure, Code and File Contents to txt file for LLM, ChatGPT, Agent Based Workflows. Scans a project's directory structure and exports the file hierarchy and contents into a clean, human-readable YAML file. This script is designed to simplify AI workflows, including those leveraging ChatGPT, …
#!/usr/bin/env python3
"""
project2txt.py
Python script to scan a project's directory structure for common programming files and export it to a text file.
Respects .gitignore rules if present, handles subdirectories, and preserves file contents.
Only includes paths that contain common programming and project files.
Author: ph33nx
GitHub: https://gist.github.com/ph33nx/12ce315ef6dbcf9ef1d01f5371af4a3d
@ph33nx
ph33nx / Install-Android-USB-ADB-Fastboot-Windows-2025.md
Last active June 29, 2025 12:26
Install Android USB Driver, ADB, and Fastboot on Windows 10/11 (2025) – Step-by-step instructions to install the Android USB driver and set up ADB/Fastboot using winget on Windows 10/11. Perfect for Android development and troubleshooting.

Credit: ph33nx


Manual Installation Guide for Android USB Driver & ADB/Fastboot (Windows 10/11)

This guide provides simple, direct steps to manually install the Google USB Driver and ADB/Fastboot binaries using winget on Windows 10/11.


@ph33nx
ph33nx / TurnOffMonitor.ps1
Created March 3, 2025 08:20
PowerShell Windows API Script: Instantly Turn Off Your Monitor (Developer Hack) Leverage this advanced PowerShell script that uses Windows API calls to instantly power off your monitor without disrupting background tasks. Perfect for system automation, IT efficiency, and developer productivity. Follow the included shortcut instructions to set up…
# TurnOffMonitor.ps1
# This script leverages the Windows API via .NET to power off the display while keeping background processes running.
# Author: ph33nx (https://github.com/ph33nx)
# Shortcut Instructions:
# 1. Right-click on your Desktop and select "New > Shortcut".
# 2. In the "Type the location of the item" field, paste:
# powershell.exe -ExecutionPolicy Bypass -File "C:\path\to\TurnOffMonitor.ps1"
# 3. Click "Next", give your shortcut a name (e.g., "Turn Off Monitor"), and finish.
# 4. (Optional) Assign a hotkey by right-clicking the shortcut, selecting "Properties", and setting your desired key combination.
# Keywords: Windows API, PowerShell, monitor off, turn off display, display sleep shortcut, Windows shortcut, system automation,