Skip to content

Instantly share code, notes, and snippets.

View egorleet's full-sized avatar
🕊️
Peace & kindness first

Egor Volchenko egorleet

🕊️
Peace & kindness first
View GitHub Profile
@egorleet
egorleet / cleanup.sh
Created October 28, 2026 13:41
Server cleanup script that removes VS Code Server directories, WordPress backup files (.wpress), and node_modules directories inside wp-content. It also truncates service logs, deletes compressed log archives, and records all actions, file sizes, and errors in a timestamped log file.
#!/bin/bash
LOG="/root/cleanup-$(date +%Y-%m-%d_%H-%M-%S).log"
# Save all output to both the terminal and a log file
exec > >(tee -a "$LOG") 2>&1
echo "========== SERVER CLEANUP =========="
echo "Started: $(date)"
echo "===================================="
@egorleet
egorleet / delete-inactive-plugins.sh
Created October 26, 2026 09:30
WordPress Inactive Plugins Cleaner (CloudPanel)
#!/bin/bash
# WordPress Inactive Plugins Cleaner (CloudPanel)
#
# Usage:
# bash delete-inactive-plugins.sh --dry-run
# bash delete-inactive-plugins.sh
DRY_RUN=false
@egorleet
egorleet / delete-inactive-themes.sh
Created October 23, 2026 15:33
WordPress Inactive Themes Cleaner
#!/bin/bash
# WordPress Inactive Themes Cleaner
#
# Usage:
# bash delete-inactive-themes.sh --dry-run
# bash delete-inactive-themes.sh
DRY_RUN=false
find / -name "php.ini" -not -path "*/proc/*" -not -path "*/sys/*" -exec sed -i 's/;*session.upload_progress.enabled =.*/session.upload_progress.enabled = Off/' {} \; 2>/dev/null
systemctl restart php*-fpm 2>/dev/null
find / -name "php.ini" -not -path "*/proc/*" -not -path "*/sys/*" -exec grep -H "session.upload_progress.enabled" {} \; 2>/dev/null
apt update && apt upgrade -y
systemctl restart php*-fpm 2>/dev/null
find / -name "php.ini" -not -path "*/proc/*" -not -path "*/sys/*" -exec grep -H "session.upload_progress.enabled" {} \; 2>/dev/null
@egorleet
egorleet / php-fix-upload-progress.sh
Created October 21, 2026 11:41
Quick Bash script to mitigate the PHP2Shell vulnerability (CVE-2026-109618 / CVE-2026-109619) by disabling session.upload_progress.enabled across all installed PHP versions (FPM & CLI) and restarting services.
#!/bin/bash
# Loop through all PHP versions found in /etc/php
for php_ver in /etc/php/*; do
if [ -d "$php_ver" ]; then
ver_num=$(basename "$php_ver")
# Check and update fpm and cli php.ini files
for ini_path in "$php_ver/fpm/php.ini" "$php_ver/cli/php.ini"; do
if [ -f "$ini_path" ]; then
@egorleet
egorleet / admin-editor-styles.php
Last active September 15, 2026 08:59
Turn off sidebar view for WordPress/Gutenberg blocks v3
<?php
/**
* Admin-only CSS for the block editor.
*
* [h1] Turn off sidebar view for WordPress/Gutenberg blocks v3 [/h1]
*
* (connect to functions.php [code] require_once get_template_directory() . '/inc/admin-editor-styles.php'; [/code] )
* ACF prints a "Block" panel of its own in the block inspector sidebar, which
* duplicates what the block's own fields already offer and only adds noise for
* editors. Hide it.
@egorleet
egorleet / gist:5d02518246f1f57427c3a47c9a2f46c5
Created August 24, 2026 08:50
Clean WordPress temp files, etc.
sudo find /home -type f -name "*.wpress" -delete
sudo find /home -type f -name "*.zip" -delete
du -sh /home/* 2>/dev/null | sort -hr | head -20
du -h --max-depth=2 /home 2>/dev/null | sort -hr | head -50
find /home -type f -printf '%s %p\n' 2>/dev/null | sort -nr | head -50 | \
awk '{printf "%.2f GB\t%s\n", $1/1024/1024/1024, $2}'
@egorleet
egorleet / gist:69c39ab72a509a9aa02a18b3f61a5318
Created December 17, 2025 06:12
Make zip by files name
bash -c 'set -euo pipefail; shopt -s nullglob; for png in *.png; do base="${png%.png}"; zipname="${base}.zip"; files=( "${base}".* ); (( ${#files[@]} > 0 )) || continue; rm -f "$zipname"; zip -q -9 "$zipname" "${files[@]}"; echo "✅ $zipname <- ${#files[@]} file(s)"; done'
@egorleet
egorleet / nginx.conf
Created October 13, 2025 11:25
Redirect from 404 to main page
error_page 404 = @redirect_to_home;
location @redirect_to_home {
return 301 https://$host;
}
@egorleet
egorleet / setQuantity.js
Last active October 31, 2025 07:46
Automatically updates the Steam Market sell quantity input with the available amount (e.g., PAYDAY 2)
/**
* 🧩 setQuantity.js
*
* Automatically sets the quantity for Steam Market Sell input.
*
* This script keeps the sell quantity input (#market_sell_quantity_input)
* synchronized with the available amount element (#market_sell_quantity_available_amt).
*
* ✅ How it works:
* - Checks every millisecond if the quantity input is visible.