Skip to content

Instantly share code, notes, and snippets.

View ph33nx's full-sized avatar
🥷
Cooking

Abhi ph33nx

🥷
Cooking
  • 05:48 (UTC +05:30)
View GitHub Profile
@ph33nx
ph33nx / gist:ba29b38c643baf7abbf83f5e74c532c6
Last active August 28, 2020 21:41
Minimal Desktop Enivronment Installation on Arch Linux
#Install minimal Gnome on Arch
pacman -S gnome-shell nautilus gnome-terminal gnome-tweak-tool gnome-control-center gdm networkmanager gnome-keyring xorg-server xorg-xinit
systemctl start gdm
systemctl enable gdm
sudo systemctl start NetworkManager
sudo systemctl enable NetworkManager
@ph33nx
ph33nx / php.conf
Last active April 26, 2024 12:32
Wordpress/PHP DDOS Protection + Harden PHP on Nginx (2024)
# PHP DDOS Protection + Harden PHP on Nginx (2022)
# Created as per latest security standards
# includes protection against DDOS, SQL injections, Comment spam, Php code injection and more
# 444 is returned in most places as it's the most appropriate response code for hackers.
# Some wordpress url's are also blocked as most bots often hit those urls no matter the site is running on wordpress or not
# ** Created by @ph33nx : https://github.com/ph33nx **
# HOW TO USE:
# Include below line (#12) in all your WordPress Sites server block (/etc/nginx/conf.d/wp_site.conf) for this to take effect
# include snippets/wordpress.conf;
@ph33nx
ph33nx / postgres-daily-backup.sh
Last active April 3, 2023 13:59
Postgres Daily Backup Bash Script + Get Credentials from .env
# This script is used to backup postgresql database to a file
# 1. Keep the backup file for 30 days
# 2. Intended to be run from cron
# 3. Read DB credentials from .env file next to the script
# 4. Restore the backup with the following command in psql
# PGPASSWORD=$DB_SECRET pg_restore -Fc --no-owner -h localhost -p 5432 -U $DB_USERNAME -d $DB_NAME < $BACKUP_FILE_NAME
# cd to the script directory
cd "$(dirname "$0")"
@ph33nx
ph33nx / windows_firewall_block_exe.bat
Last active April 1, 2025 19:52
Windows Firewall - Block All .Exe's Inside a folder from accessing Internet using batch script | Block all .exe in a folder to access Internet
@REM This batch script loops through all exe's inside a directory and blocks all .exe's inside that folder and its subfolders using windows inbuilt firewall.
@REM IMP: Replace FOLDER_NAME with the folder in which you want all .exe's blocked. or replace the whole url, for ex: C:\Program Files\Adobe
@ setlocal enableextensions
@ cd /d "%~dp0"
@for /R "C:\Program Files\FOLDER_NAME" %%a in (*.exe) do (
netsh advfirewall firewall add rule name="%%~na (Blocked using script)" dir=out program="%%a" action=block
@ph33nx
ph33nx / WinMasterBlocker.bat
Last active April 24, 2025 13:26
Block All Adobe .exe files via Firewall on Windows Using Batch Script | Stop adobe apps to access internet
:: ################################################################
:: ## 🔥 WinMasterBlocker 🔥 #
:: ################################################################
:: # Author: https://github.com/ph33nx #
:: # Repo: https://github.com/ph33nx/WinMasterBlocker #
:: # #
:: # This script blocks inbound/outbound network access #
:: # for major apps like Adobe, Autodesk, Corel, Maxon, #
:: # and more using Windows Firewall. #
:: # #
@ph33nx
ph33nx / lemp-ubuntu.sh
Last active April 2, 2025 00:27
LEMP stack on Ubuntu 24.04 LTS (2024): Automated Bash Script for Installing Nginx, Php 8.3, WordPress, Mysql/Mariadb
#!/bin/bash
# This script is meant to be run on a fresh Ubuntu 24.04 LTS installation.
# Tired of manually installing LEMP stack on Ubuntu? This script will do it for you.
#
# Optionally, This script restores a server from a backup. It assumes the following directory structure:
# - backup/
# - nginx/ (contains nginx configuration files)
# - db/ (contains .sql files for database restoration)
# - sites.zip (zipped file containing site files)
@ph33nx
ph33nx / fresh-mac-dev-environment.sh
Last active July 13, 2024 03:18
Fresh Mac OS Development Environment setup - bash script
#!/bin/bash
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
brew analytics off
@ph33nx
ph33nx / delete_macos_files.ps1
Created February 11, 2024 19:58
Delete hidden MacOS files on Windows using Powershell Script
# Get the current directory
$folder = Get-Location
# Delete hidden files recursively based on pattern
Get-ChildItem -Path $folder -Recurse -Force -File | Where-Object { $_.Name -like "._*" } | ForEach-Object {
# Remove any file attributes
Set-ItemProperty -Path $_.FullName -Name Attributes -Value 0
# Attempt to delete the file
Remove-Item -Path $_.FullName -Force
}
@ph33nx
ph33nx / fresh-windows-dev-environment.ps1
Last active April 4, 2025 16:41
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
@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: