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 / facebook-cache.conf
Last active October 3, 2026 05:39
Cache shop pages for agressive Facebook bot
CacheQuickHandler Off
CacheIgnoreQueryString Off
CacheRoot /var/cache/apache2/mod_cache_disk
CacheDirLevels 2
CacheDirLength 1
CacheLock On
CacheLockPath /tmp/mod_cache-lock
CacheLockMaxAge 10
@szepeviktor
szepeviktor / asn-per-minute.py
Created October 2, 2026 10:01
Analyze Apache access log to identify the most frequent ASN for each minute
#!/usr/bin/env python3
from collections import Counter
import argparse
import gzip
import ipaddress
import sys
import geoip2.database
import geoip2.errors
@szepeviktor
szepeviktor / fail2ban_graph.py
Created September 20, 2026 03:51
2026-09-19 - 120 oszlop, 12 perc/oszlop
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import io
import re
import sys
@szepeviktor
szepeviktor / geo-important-factors.txt
Last active August 16, 2026 11:57
Important GEO factors
Important GEO factors according to zubair-trabzada/geo-seo-claude:
- AI Citability & Visibility: 25%
- Brand Authority Signals: 20%
- Content Quality & E-E-A-T: 20% (Experience, Expertise, Authoritativeness, and Trustworthiness)
- Technical Foundations: 15%
- Structured Data: 10%
- Platform Optimization: 10%
- Content blocks that are easy for AI systems to quote and understand independently
- Question-and-answer style headings and direct answers
@szepeviktor
szepeviktor / restore-wcsatt-cart-plan-selector.php
Created August 8, 2026 06:10
Restore WCSATT Cart Plan Selector
<?php
/*
* Plugin Name: Restore WCSATT Cart Plan Selector
* Description: Restores the classic-cart one-time/subscription plan selector removed from WooCommerce Subscriptions 9.0.1.
* Author: Viktor Szépe
*/
namespace Roboviktor\WcsattCartPlanSelector;
# Ubuntu 24.04
apt install apache2 apache2-dev geoipupdate libmaxminddb-dev
# Add license key
editor /etc/GeoIP.conf
wget https://github.com/maxmind/mod_maxminddb/releases/download/1.3.0/mod_maxminddb-1.3.0.tar.gz
tar -xf mod_maxminddb-1.3.0.tar.gz
cd mod_maxminddb-1.3.0/
./configure
make install
@szepeviktor
szepeviktor / science-songs.md
Created July 20, 2026 22:34
Miért ritkák a tudományos ténydalok? - Why Are Songs About Scientific Facts So Rare?

Szerintem nem azért ritka, mert ne lehetne jó, hanem mert a dalírás és a tudományos pontosság eltérő irányba húz.

A fő okok

1. A dal általában érzelmet akar kiváltani, nem információt átadni. A legtöbb hallgató kapcsolatokról, veszteségről, vágyról, identitásról akar dalt hallani. Egy plagioklász összetétele önmagában kevés embernek személyesen fontos.

2. A tudományos állítások rosszul tűrik a dalszöveges tömörítést. Egy szerelmes mondatot húszféleképpen át lehet fogalmazni. Egy ásvány képletét vagy egy fizikai törvényt nem. Ha a rím vagy a ritmus kedvéért módosítják, könnyen hamis lesz.

@szepeviktor
szepeviktor / fix-rest-batch.php
Last active July 25, 2026 00:46
Temporary mitigation for chained RCE in WordPress core: CVE-2026-60137 and CVE-2026-63030
<?php
/*
* Plugin Name: Fix REST Batch
* Description: Rejects malformed REST batch paths before affected WordPress core versions process them.
*/
declare(strict_types=1);
namespace SzepeViktor\FixRestBatch;
@szepeviktor
szepeviktor / lsb-base-logging.sh
Last active July 18, 2026 04:08
PHP-FPM: Suppress the normal "Reopening PHP FastCGI Process Manager logs" message
# /etc/lsb-base-logging.sh
log_daemon_msg_pre()
{
# Suppress the normal "Reopening PHP FastCGI Process Manager logs" message
case "${1:-}:${2:-}" in
Reopening*logs:php-fpm*)
/usr/bin/logger -p daemon.notice -t "$2" -- "$1"
exec >/dev/null
;;
esac
@szepeviktor
szepeviktor / apache.conf
Created May 1, 2026 22:13
WordPress deserves no CSP policy
# CSP policy
<LocationMatch "^/olm/wp-admin/">
Header always set Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data: blob: https://ps.w.org https://secure.gravatar.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' data: https://fonts.gstatic.com; form-action 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; report-uri /csp-report.php"
</LocationMatch>