Skip to content

Instantly share code, notes, and snippets.

View ph33nx's full-sized avatar
🥷
Cooking

Abhi ph33nx

🥷
Cooking
  • New Delhi
  • 17:16 (UTC +05:30)
View GitHub Profile
@ph33nx
ph33nx / project2yaml.py
Last active January 5, 2025 18:59
project2yaml.py - Python script that Exports Project Structure and File Contents to YAML 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, LLMs, and…
#!/usr/bin/env python3
"""
project2yaml.py
Python script to scan a project's directory structure and export it to a YAML file.
Respects .gitignore rules if present, handles subdirectories, and preserves file contents.
Author: ph33nx
GitHub: https://github.com/ph33nx/
@ph33nx
ph33nx / block-internet-access-folder-executables-windows-firewall.bat
Last active December 18, 2024 20:38
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.
@echo off
:: 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.
@ph33nx
ph33nx / arch-linux-setup-gaming.sh
Last active December 18, 2024 18:48
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 / download_subtitles.py
Last active December 2, 2024 21:12
Python script to recursively download missing subtitles for video files
#!/usr/bin/env python3
import os
import sys
from babelfish import Language
from subliminal import download_best_subtitles, region, save_subtitles, scan_video
# Configure subliminal cache
region.configure('dogpile.cache.dbm', arguments={'filename': 'cachefile.dbm'})
@ph33nx
ph33nx / batch_image_converter.py
Last active January 10, 2025 04:33
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: github.com/ph33nx
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 / fedora-41-desktop-setup.sh
Last active November 8, 2024 11:56
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 / 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 / backup_mysql_db.sh
Last active September 28, 2024 00:10
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-update.sh
Last active December 2, 2024 04:32
Wordpress Automated Themes, Plugins & Core Updates - Bash Script - Run as Cron Job
#!/bin/bash
# This script is designed to update WordPress core, plugins, and themes,
# set correct file permissions, and restart Nginx and PHP-FPM services.
# Update www-data user to the filesystem user of WP.
# !IMP: Make sure WP CLI is installed: https://wp-cli.org/
#
# Original script concept by https://github.com/ph33nx
#
# To schedule this script to run every Thursday at 4 AM, add the following line to your crontab:
@ph33nx
ph33nx / fresh-windows-dev-environment.ps1
Last active October 28, 2024 11:59
Setup development environment on Fresh Windows Installation. Run the script in powershell
# On Fresh windows installation, open powershell or terminal and run the script as following:
# powershell.exe -executionpolicy bypass -file .\fresh-windows-dev-enviroment.ps1
winget install Git.Git
winget install GitHub.GitLFS
git config --global core.autocrlf false
winget install Microsoft.VisualStudioCode
winget install OpenJS.NodeJS.LTS # NodeJS LTS
winget install Python.Python.3.12 # Python 3.12