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 / HelloPack.sh
Created May 20, 2025 06:29
HelloPack plugin list and plugin update
# List plugin IDs
wp eval 'var_export(array_column(hellopack_client()->api()->plugins(),"name","id"));'
# Update the plugin
wp plugin install "$(wp eval 'echo hellopack_client()->api()->download(260729283,[]);')" --force
@szepeviktor
szepeviktor / glyph-width.php
Last active May 12, 2025 10:34
Estimate glyph widths for sans serif 16px font
<?php
function get_text_width(string $text): int
{
$glyph_widths = [
'A' => 10.67,
'B' => 10.67,
'C' => 11.55,
'D' => 11.55,
'E' => 10.67,
@szepeviktor
szepeviktor / zip-uploads.php
Last active May 8, 2025 06:04
Archive WordPress uploads in a ZIP file on the server
<?php
function addDirToZip(string $dir, ZipArchive $zipFile, string $basePath = '')
{
$files = scandir($dir);
// Remove '.' and '..'
unset($files[0], $files[1]);
foreach ($files as $file) {
$filePath = $dir . $file;
@szepeviktor
szepeviktor / comment-tor-spam.php
Last active March 29, 2025 18:37
Mark WordPress comments from Tor exit nodes as spam
<?php
/*
* Plugin Name: Mark comments from Tor exit nodes as spam
* Plugin URI: https://github.com/szepeviktor/wordpress-website-lifecycle
*/
/** @return string|null */
function getTorExitNodes()
{
@szepeviktor
szepeviktor / composer.json
Created March 28, 2025 15:16
WHMCS Composer repository
{
"repositories": [
{
"type": "composer",
"url": "https://releases.whmcs.com/v2"
}
],
"require": {
"whmcs/whmcs": "^8.9"
}
@szepeviktor
szepeviktor / qvik.txt
Created March 27, 2025 08:28
qvik QR kód leírása - GIRO
EAM KIEGÉSZÍTŐ SZOLGÁLTATÁSOK ÚTMUTATÓ
BKR ÜZLETSZABÁLYZAT 20. SZÁMÚ MELLÉKLETE
https://www.giro.hu/storage/DDOYCCedHv8YFOdILSOSNiuL6Mfmu6sv56y2HvBU/BKR%20%C3%9CSZ_20_mell%C3%A9klet_2024_09_01.pdf
@szepeviktor
szepeviktor / Hosting.md
Last active May 16, 2025 23:51
Hosting providers
@szepeviktor
szepeviktor / cpt-templates.php
Last active March 12, 2025 17:19
Programatically add custom post type template files to WordPress
<?php
/*
* Plugin Name: Add cpt templates
*/
add_filter(
'template_include',
function ($template) {
if (is_singular('cpt')) {
@szepeviktor
szepeviktor / jpeg-archive.sh
Last active March 2, 2025 23:28
Build danielgtaylor/jpeg-archive
apt-get install build-essential autoconf pkg-config nasm libtool
# Build https://github.com/mozilla/mozjpeg
cmake -G"Unix Makefiles" -DPNG_SUPPORTED=OFF -DBUILD_SHARED_LIBS=OFF .
make
make install
# Build Build danielgtaylor/jpeg-archive
# Modify source: https://github.com/danielgtaylor/jpeg-archive/pull/128
make
make install
@szepeviktor
szepeviktor / dump-product-attr.sh
Created February 26, 2025 21:53
Dump WooCommerce product attributes
#!/bin/bash
DUMP_FILE="/home/user/product-attr-debug/$(date --utc +%F).product"
TOTAL="$(wp wc product list --format=count)"
for PAGE in $(seq 1 $(( (TOTAL+99) / 100 ))); do
wp wc product list --page=${PAGE} --fields=id,attributes >>"${DUMP_FILE}"
done