Automating Social Media Post Reactions and Page Invites with JavaScript

When marketing campaigns or organic posts achieve high engagement, many users interact with the content (likes, reactions) without following or liking the parent page. Facebook provides a manual interface to invite users who reacted to a post to like the page. However, manually clicking hundreds of individual invite buttons is tedious. Figure 1: Modal window listing users who reacted to the post. Browser Console Automation Script By executing a lightweight script in the browser’s Developer Tools Console, we can automate scrolling through pagination (See More) and dispatching invite clicks with controlled delays to respect client-side rate limits. ...

July 21, 2016 · 2 min · 356 words · Ahmad Mahfouz

Resolving PHP Mcrypt Extension Symlink Conflicts on Ubuntu Server

When configuring legacy PHP environments on Ubuntu Server and attempting to activate the mcrypt cryptographic module, administrators may encounter symlink collision warnings. The Error Condition After installing the extension packages: sudo apt-get install mcrypt php5-mcrypt Attempting to register the module via php5enmod produces the following error: root@ubuntu:~# php5enmod mcrypt WARNING: Not enabling the mcrypt module for apache2 SAPI since module symlink WARNING: already exists in /etc/php5/apache2/conf.d with different content. WARNING: Not enabling the mcrypt module for cli SAPI since module symlink WARNING: already exists in /etc/php5/cli/conf.d with different content. This error occurs when old or stale configuration symlinks pointing to prior configuration targets exist in the SAPI configuration directories (/etc/php5/apache2/conf.d/ and /etc/php5/cli/conf.d/), preventing the package manager from linking the canonical /etc/php5/mods-available/mcrypt.ini. ...

June 26, 2016 · 1 min · 178 words · Ahmad Mahfouz

Django Architecture Cheat Sheet: ORM, Signals, Sessions, and Auth

A quick-reference architectural guide covering essential patterns in Django web applications: querysets, signals, raw database queries, session handling, and authentication. 1. Django ORM Query Patterns # Query basic datasets Article.objects.all() Article.objects.all().count() Article.objects.filter(is_published=True).exists() # Slicing (LIMIT and OFFSET) Article.objects.filter(is_published=True)[:5] # Specific field projections Article.objects.filter(is_published=True).values('title', 'created_at')[:5] # Ordering Article.objects.filter(is_published=True).order_by('-created_at') # Field lookups and date filtering from datetime import datetime Article.objects.filter(created_at__gte=datetime(2025, 1, 1)) Article.objects.filter(created_at__year=2025).order_by('id') # Inspect underlying compiled SQL query = Article.objects.filter(is_published=True) print(str(query.query)) 2. Raw SQL and Database Connections When complex reporting queries or performance bottlenecks require bypassing the ORM: ...

December 4, 2014 · 2 min · 388 words · Ahmad Mahfouz

Automated Flight Ticket Booking and Availability Monitoring with Splinter

During peak holiday seasons, securing airline seats on heavily booked routes often requires repeatedly checking booking engines for cancellations. Using browser automation frameworks like Splinter (an abstraction layer built on top of Selenium WebDriver), we can automate the search loop, detect flight inventory releases, fill passenger details, and hold reservations automatically. What is Splinter? Splinter provides a pythonic API for browser automation. It allows developers to: Navigate web portals and wait for elements. Select radio buttons, dropdowns, and checkboxes. Fill form fields and submit via JavaScript execution. Inspect rendered DOM structures and handle session timeouts. Automated Booking Workflow The script continuously queries available flight options for specific routes and travel dates. If the airline portal reports “no flights available” or sessions expire, it automatically restarts the search until seats open up, then populates passenger credentials: ...

December 4, 2014 · 2 min · 340 words · Ahmad Mahfouz

Forwarding Client Real IPs from Nginx Reverse Proxy to Apache

A common high-performance web architecture deploys Nginx on the public frontend (port 80/443) to handle TLS termination, static asset caching, and request routing, reverse-proxying dynamic requests to an Apache backend (e.g., listening on port 8080 or localhost). However, without explicit header forwarding, Apache logs will show all incoming requests originating from 127.0.0.1 (the reverse proxy IP) rather than the client’s actual public IP. This disrupts geolocation, fraud detection, rate-limiting, and security audit trails. ...

November 30, 2014 · 2 min · 297 words · Ahmad Mahfouz