Skip to content

Instantly share code, notes, and snippets.

View szepeviktor's full-sized avatar
🍓
Guess I'm the lone ranger keeping it all running.

Viktor Szépe szepeviktor

🍓
Guess I'm the lone ranger keeping it all running.
View GitHub Profile
@szepeviktor
szepeviktor / remove-debug.md
Last active December 5, 2025 16:29
Deletion of WordPress debug tools and log files

Deletion of WordPress debug tools and log files

How to clean up after debugging.

Dummy content

  • posts, pages
  • products
  • orders
  • users
@szepeviktor
szepeviktor / WD-WordPress-performance.md
Last active December 1, 2025 21:15
Make a slow WordPress site fast!

WordPress Performance

Debugging theory: https://github.com/szepeviktor/debug-wordpress

  • Check PHP version, 8.1 in 2026
  • Check PHP directives:
    • memory_limit
    • max_execution_time
    • opcache.memory_consumption
    • opcache.interned_strings_buffer
@szepeviktor
szepeviktor / cpu-load.sh
Created November 25, 2025 11:50
Monitoring CPU load on cPanel hosting
while :; do ps -u $USER -o pcpu= | awk '{sum+=$1} END {printf("%4.0f\n", sum)}'; sleep 1; done
@szepeviktor
szepeviktor / is-human.php
Created November 11, 2025 08:14
Detect HTTP requests from humans
#!/usr/bin/env php
<?php
#$ composer require matomo/device-detector
require __DIR__.'/vendor/autoload.php';
use DeviceDetector\DeviceDetector;
use DeviceDetector\Parser\Device\AbstractDeviceParser;
AbstractDeviceParser::setVersionTruncation(AbstractDeviceParser::VERSION_TRUNCATION_NONE);
@szepeviktor
szepeviktor / wordfence-plugin-check.sh
Created September 6, 2025 16:20
Wordfence plugin vulnerability check in small shell script
#!/bin/bash
wget -O wordfence-vulnerabilities.json "https://www.wordfence.com/api/intelligence/v2/vulnerabilities/production"
wp plugin list --skip-update-check --status=active --fields=name,version \
| tail -n +2 \
| while read -r PLUGIN VERSION; do
UPDATE="$(jq -r --arg slug "${PLUGIN}" \
'[.. | objects | select(."type"=="plugin" and ."slug"==$slug) | ."patched_versions"[]?] | if length>0 then map(split(".") | map(tonumber)) | max | join(".") else empty end' \
wordfence-vulnerabilities.json
@szepeviktor
szepeviktor / twilio-sms.sh
Last active September 11, 2025 23:48
Twilio SMS to email
#!/bin/bash
#
# Send SMS with Twilio API.
#
export LC_ALL="C.UTF-8"
declare -a iso1_to_gsm=(
'À' 'Ä' 'Â' 'Ä' 'Ã' 'Ä'
'È' 'É' 'Ê' 'É' 'Ë' 'É'
'Ì' 'I' 'Î' 'I' 'Ï' 'I'
@szepeviktor
szepeviktor / wc-gtin-search.php
Last active August 22, 2025 08:49
WC Admin Search by Global Unique ID
<?php
/**
* Plugin Name: WC Admin Search by Global Unique ID
* Description: Make the admin Products search match the _global_unique_id (GTIN/EAN/UPC/ISBN).
* Version: 1.0.0
* WC requires at least: 9.2
* Requires PHP: 7.4
* Author: Viktor Szépe
* Author URI: https://www.szepe.net/
*/
@szepeviktor
szepeviktor / php-switch.sh
Created July 29, 2025 07:52
Switch PHP version for a user in Debian
#!/bin/bash
mkdir -p /usr/local/bin/php8.3
ln -s /usr/bin/php8.3 /usr/local/bin/php8.3/php
# Add this to your script: export PATH="/usr/local/bin/php8.3:$PATH"
@szepeviktor
szepeviktor / Environments.md
Last active July 4, 2025 08:40
Futtató környezetek szerepe egy szoftver életében

Környezetek

  • local - Fícsör kifejlesztése a saját gépen, amíg nem látszik a hiba
  • CI - Véleményt mondanak: minőségbiztosító eszközök, tesztek ✔ ❌, kollégák
  • staging - Bemutatjuk a hozzá nem értő ügyfélnek, illetve kipróbáljuk egy prod-hoz közeli környezetben
  • production - Oda adjuk a felhasználóknak
@szepeviktor
szepeviktor / wp-cli-array.sh
Created June 13, 2025 16:36
WP-CLI edit array option
wp option get auto_update_plugins --format=json \
| jq -c 'to_entries | map(select(.value != "wordpress-seo/wp-seo.php")) | from_entries' \
| wp option update auto_update_plugins --format=json