TechEarl

Building the web since 2000

Field notes on shipping real systems.

Practical writing on PHP, MySQL, Linux, WordPress, security and the weird corners of the web, by one engineer who's been shipping them for over two decades.

Share this siteCopied
Latest

Fresh from the desk

A five-year-old Dr Pepper fan site built on Gatsby, why Gatsby stopped being a safe bet, and how I rebuilt it on Next.js 16 without losing the parts that worked.

The Joke Domain That Outlived Gatsby

Five years ago I bought a domain about a coworker's Dr Pepper habit. Here is what building it in Gatsby, then rebuilding it on Next.js 16, taught me about side projects that outlive their framework.

Fix the WordPress "Error establishing a database connection": bad wp-config credentials, MySQL or MariaDB down, connection limits, or a cached error page.

How to Fix "Error Establishing a Database Connection" in WordPress

Error establishing a database connection means WordPress cannot reach its database. Read the MySQL error code to find the real cause (wrong credentials, a stopped server, a connection limit, corrupted tables, or a cloud firewall), and if the error outlives the fix, stop the cache from serving it. Also covers the stuck "Briefly unavailable for scheduled maintenance" page.

The Agentic Browsing audit is live in PageSpeed Insights. Paste your URL to get a score, then pass the accessibility tree, CLS, and llms.txt checks. Full rule-by-rule guide.

How to Pass the PageSpeed Agentic Browsing Audit

The Agentic Browsing audit is now live in Google PageSpeed Insights, no Chrome Canary needed. Paste your URL, read the fractional score, and pass every check that says whether AI agents can read and act on your site.

Fill in your hash file, wordlist, mode and mask, then copy ready-to-run hashcat commands for every attack mode. Full flag reference, charset table, common modes. Tested on hashcat 7.1.2.

Hashcat Cheat Sheet: Build the Command, Copy, Crack

Set your hash file, wordlist, hash mode, and mask once at the top, and every command below fills in with your values, ready to copy and run. Then the full flag reference grouped by task, the mask charset table, and the common -m modes. Tested on hashcat 7.1.2.

Built-in and custom charsets, increment mode, keyspace maths, and the policy-shaped masks that crack passwords a plain brute force never would in time. Tested on hashcat 7.1.2.

Hashcat Mask Attack (-a 3): Smart Brute Force That Finishes

A mask attack is brute force with a brain: you tell hashcat the shape of the password and it skips the quadrillions of strings nobody picks. I cover the charsets, custom charsets, increment mode, the keyspace maths, and the masks that actually crack real passwords. Tested on hashcat 7.1.2.

How hashcat rule functions mutate wordlist words, the best64 ruleset with real output, stacking rules, writing your own, and the big public rulesets. Tested on hashcat 7.1.2.

Hashcat Rules: More Cracks From the Same Wordlist

Rules are the highest-yield technique in cracking: one wordlist word becomes hundreds of plausible variants. I cover the rule functions, best64 with real generated output, stacking, writing your own, and the big public rulesets. Tested on hashcat 7.1.2.

WordPress

Empower your web dreams, one block at a time

Thousands of hits to admin-ajax.php are usually WordPress Heartbeat and plugins, not an attack. How to read the action parameter and the fix that does not break your site.

admin-ajax.php High Traffic: Attack or Normal?

Thousands of hits to wp-admin/admin-ajax.php are almost always your own site: WordPress Heartbeat and plugins, not a DDoS. How to read the action parameter, when it is a real attack, and why blocking the file breaks your site.

wordfence_lh URLs in Google Search Console: The Right Fix

Thousands of ?wordfence_lh=1&hid= URLs in Google Search Console come from Wordfence's Live Traffic feature. The setting that stops them, the check to run first, why robots.txt is the wrong fix, why ?replytocom= comment URLs need no fix at all, and what Discovered and Crawled - currently not indexed mean.

Run Bulk Scripts in WordPress With WP-CLI (eval-file)

The right way to run a bulk operation across thousands of WordPress posts: a wp eval-file harness with batched queries and a flush-in-loop, measured WP_Query memory tuning, wp_insert_post imports that don't run out of memory, packaging it as a custom WP-CLI command, and pushing AI enrichment through a batch API at half the cost.

Database

Unleash the power of your data universe

MongoDB Schema Design: Embedding vs Referencing

When to embed related data as subdocuments and when to reference it by _id in MongoDB. The 16 MB document limit, $lookup joins, the established schema-design patterns, and the field types that trip people up: money as Decimal128 or integer cents, and UUIDs as BSON Binary subtype 4.

What Column Type Should a Password Be in MySQL?

The column type for a password in MySQL is VARCHAR(255). You store the encoded output of a slow password hash (bcrypt, argon2id, scrypt), never a raw MD5 or SHA-256. Covers the 60-char bcrypt hash, the variable-length Argon2id hash, and the lookup-then-verify flow.

How to Store a bcrypt Password Hash in PostgreSQL

A bcrypt hash is a fixed 60-character string. In PostgreSQL the right column is text (varchar(255) is equivalent). Why text over char(60), app-side hashing, the pgcrypto crypt() option, and a worked users schema.

Linux

Freedom to innovate, power to perform

How to Toggle Dark Mode From the macOS Command Line

Toggle macOS dark mode from the terminal with one osascript line: instant, no restart. Force it on or off, read the current state, and skip the dead _HIEnableThemeSwitchHotKey trick. Plus the other Mac settings from the command line: system volume (osascript), Bluetooth (blueutil), a photo with the Mac camera (imagesnap) and your calendar (cal, icalBuddy).

DevOps

Automate, integrate, accelerate your success

How to List the Files Changed in Git

List the files changed in git: working tree, staged, the last commit, between branches, or since N commits. Then pipe the list straight into a linter so you only check what changed.

JavaScript

Building tomorrow's web, today

JavaScript array methods in 2026: at, flat, toSorted, toSpliced, merge, insert, dedupe with Set, a Fisher-Yates shuffle, reduce, and Object.groupBy.

Modern JavaScript Array Methods: at, flat, toReversed, and groupBy

The JavaScript array methods worth reaching for in 2026, with the tasks they solve: convert and fill arrays, at() and flat(), merge, insert at an index, the copying toReversed/toSorted/toSpliced/with, dedupe with Set, random picks and a correct shuffle, reduce, and Object.groupBy (not the Array.prototype.group that never shipped).

Generate a UUID in JavaScript: crypto.randomUUID() (Browser and Node)

Generate a UUID in JavaScript with the built-in crypto.randomUUID(), no library needed. The secure-context gotcha that returns undefined on plain http, browser vs Node usage, the rest of Web Crypto in Node (globalThis.crypto, getRandomValues, crypto.subtle), and when you need a v7 library instead.

JavaScript Object Methods: keys, values, entries, fromEntries, and freeze

The object methods I reach for daily: Object.keys/values/entries, the entries to fromEntries round-trip, destructuring objects and arrays, Object.hasOwn as the modern hasOwnProperty, why Object.freeze is only shallow, and merging and deep-cloning objects with spread, Object.assign and structuredClone.

Fix EADDRINUSE: Port Already in Use in Node.js

EADDRINUSE means another process already holds the port. Find it with lsof or netstat, kill it, or run npx kill-port. Plus the graceful in-code fix, the nodemon leftover-process trap, and Docker's "port is already allocated" version.

Security

Protecting digital assets, ensuring peace of mind

Hashcat vs John the Ripper on speed, hash coverage, file formats, attack engine, and usability, with a clear decision table for when to reach for each.

Hashcat vs John the Ripper: Which Should You Use?

Hashcat or John the Ripper? They overlap but have different sweet spots. I compare them on speed, hash and file-format coverage, the attack engine, and usability, and give a straight answer for when to reach for each. Most people end up using both.

How to Use Hashcat: The Complete Guide (with Real Examples)

Everything you need to go from a fresh hashcat install to recovering a password: the command anatomy, attack modes, hash modes, your first real crack, reading the status screen, and the speed flags that matter. Tested on hashcat 7.1.2.

John the Ripper Cheat Sheet: Extract, Crack, Show

Set your hash file, wordlist, and format once, and every John the Ripper command below fills in with your values, ready to copy. The *2john extractors, all four cracking modes, the full flag reference, and the format list. Tested on 1.9.0-jumbo-1.

Password Cracking: How It Actually Works (Beginner to Advanced)

Password cracking is not guessing at a login form. It is an offline maths problem against a stolen hash. I walk the whole workflow, every attack mode and when to use each, the fast-vs-slow hash divide that decides everything, and what the clock actually looks like on modern hardware.

PHP

Building robust backends, delivering reliable solutions

Build a Custom Product URL Structure in WordPress (Remove /product/ and /shop/)

How to build a custom product URL structure in WooCommerce: change or remove the /product/ and /shop/ bases from Settings > Permalinks, do it in code with a permalink filter plus add_rewrite_rule, serve any custom post type from the root without its parent slug, build /make/model/year/ catalog URLs, and avoid the 404 collisions that come from a base-less slug.

Use a .env File for WordPress Config and Secrets

Keep API keys, database credentials, and SMTP secrets out of wp-config.php and out of git by loading them from a .env file with vlucas/phpdotenv, load Composer packages from a must-use plugin, then harden the rest of wp-config.php with an annotated template: file editing off, forced HTTPS, salts, debug logging, and permissions.

RegEx

Master patterns, unlock possibilities

The top 5 online regex testers for 2026: Regex101, RegExr, RegexPlanet, Debuggex, and Rubular, compared by regex flavor support, real-time matching, debugging features, and who each one is best for.

Top 5 Online Regex Testers for 2026

The five online regex testers I actually use, ranked: Regex101, RegExr, RegexPlanet, Debuggex, and Rubular. What each is good at, where each falls short, and which flavor each one supports.

How to Use Regex in Nginx (location and rewrite)

Use regex in Nginx with location blocks and the rewrite directive: how location modifiers and matching priority work, why return beats rewrite for redirects, and copy-paste config for HTTPS, www, trailing slashes, 301s, clean URLs, and access blocking.

How to Use Regex in .htaccess (Apache mod_rewrite)

Use regex in .htaccess with Apache mod_rewrite: how RewriteRule and RewriteCond patterns work, the per-directory quirk that breaks everyone, and copy-paste rules for HTTPS, www, trailing slashes, 301s, clean URLs, and access blocking.

Experiences

Real stories, real insights: Where tech meets life

The Day My Password Died

A retrospective story about a breach-monitoring alert, a dog-inspired password and the difference between sentimental passwords and unique credentials.

AI

Tools that think, write, and ship code with you

Using Claude CLI to Manage WordPress Sites

How I use Claude CLI to run WordPress and ACF work end-to-end: ACF field group generation, WP-CLI orchestration, log triage, plugin debugging, bulk content ops, turning Figma designs into ACF Flexible Content layouts, plus the AI-assisted WP-CLI patterns (checkpoint plans, migration scripts, wp db query, audits, aliases) and what never to delegate.

Network

DNS, packets, and the wires between

Use sudo iftop -i eth0 to watch bandwidth per connection live: -n, -P, the rate columns and BPF filters. Plus nload for total throughput per interface.

iftop: See Bandwidth by Connection in Real Time

sudo iftop -i eth0 shows a live, per-connection bandwidth table: which host pairs are moving traffic and at what rate. The interface flag people forget, the -n and -P switches, the 2s/10s/40s columns, the filter syntax, and nload for total throughput per interface: -m, the graph scale, units, and the refresh interval.

Nmap Command Examples: Scan Hosts, Ports, and Services

Practical nmap command examples I reach for: host discovery, the default port scan, service and version detection, OS fingerprinting, scoped scans with timing control, and the scripting engine, with notes on when each one needs root.

How to Block the Wayback Machine from Archiving Your Site

How to block the Internet Archive's Wayback Machine from future crawls with robots.txt, how to request removal of existing snapshots by emailing info@archive.org, what the 'This URL has been excluded' message means, and the DMCA path for copyrighted material.

Cheat Sheets

Single-page references for the tools I reach for

ffmpeg cheat sheet: -c copy remux, trim, crop and cropdetect, palettegen GIFs, WebM to MP4, reverse, loudnorm volume, x264/x265/AV1 -crf, speed, concat, fixes.

The ffmpeg Command Cheat Sheet

A scannable ffmpeg reference: stream-copy without re-encoding, trim and cut, resize, crop and cropdetect, black and white (grayscale and sepia), extract or remove audio, normalize loudness with loudnorm, high-quality GIFs with palettegen, WebM to MP4 and back, change speed with setpts and atempo, reverse a clip, concat, subtitles, and the fixes for the errors you actually hit.

AWS S3 cp and sync Cheat Sheet: Copy, Move, and Sync Files with the CLI

A scannable AWS S3 CLI reference: aws s3 cp, sync, mv, rm, ls; recursive uploads and downloads; --exclude / --include filters; storage classes (STANDARD_IA, GLACIER, INTELLIGENT_TIERING); SSE encryption (AES256, aws:kms); --dryrun safety; the trailing-slash gotcha; concurrency tuning via max_concurrent_requests and multipart_chunksize; cross-account profiles.