Skip to content

Instantly share code, notes, and snippets.

View Eseperio's full-sized avatar

E.Alamo Eseperio

View GitHub Profile
@Eseperio
Eseperio / readme.md
Last active June 13, 2025 08:41
Multiple PHP versions at same time on MacOS in 2022 and using Apache

Using Multiple PHP Versions Simultaneously in 2025 on macOS with Apache

This guide explains how to install and run several PHP versions at the same time on macOS, using Apache. Each PHP version is assigned to a specific directory, so you can easily switch PHP versions for any project simply by moving it to the relevant folder. This method allows instant version changes without having to update your server configuration every time.

1. Installing Multiple PHP Versions

To install different PHP versions, use Homebrew:

  1. Add the required tap:
class UniqueSelector {
static getElementSelector(element) {
if (element.id) {
return `#${element.id}`;
}
if (element.tagName === 'BODY') {
return 'body';
}
let selector = element.tagName.toLowerCase();
if (element.className) {
@Eseperio
Eseperio / block-ai-bots-server-wide.md
Created December 13, 2024 07:12
Block AI Bots Server-wide in Plesk or ModSecurity-powered Servers

Block AI Bots Server-wide in Plesk or ModSecurity-powered Servers

Introduction

AI bots can be aggressive and cause severe server overload by consuming excessive resources. Their primary purpose is to train their machine learning models using your data, often without your consent. This activity can degrade your server's performance, cause downtime, and compromise your site's availability. This guide explains how to block these unwanted AI bots using ModSecurity on Plesk-managed servers.

Step 1: Enable ModSecurity in Plesk

  1. Log in to Plesk as an administrator.
  2. Go to Tools & Settings > Web Application Firewall (ModSecurity).
  3. Ensure that ModSecurity is enabled and select the Balanced or Fast mode, depending on your server's configuration and performance needs.
@Eseperio
Eseperio / check-cloudflare
Created March 17, 2025 12:06
Check if cloudfront is requesting your server
#!/bin/bash
# This script downloads the AWS IP ranges JSON, extracts the CloudFront IP prefixes,
# and builds a tcpdump filter to capture traffic from those IP ranges.
# Check if jq is installed
if ! command -v jq &> /dev/null
then
echo "jq is required but not installed. Please install jq and run the script again."
exit 1
fi