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 April 1, 2022 10:47
Multiple PHP versions at same time on MacOS in 2022 and using Apache

Multiple PHP versions at same time on MacOS and Apache

This is how i achieved to get all PHP versions working at the same time.

I have as many php versions as i want all running at same time. Versions are attached to directories, so in my www directory i have a folder for each php version www/php71/, www/php72/ and so on. If i want to change a project to another version, i only have to move it to a different folder. In MacOs, moving a huge folder is less than 1 second, so this is the fastest way to change version without updating server configuration.

Installing PHP

Install all the php versions via brew command. Example command (replace version number for each one)

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