Skip to content

Instantly share code, notes, and snippets.

View lukapaunovic's full-sized avatar
🎯
Focusing

Luka Paunović lukapaunovic

🎯
Focusing
  • Serbia
  • 07:26 (UTC +01:00)
View GitHub Profile
@lukapaunovic
lukapaunovic / add-lukapaunovic-public-key.sh
Last active November 5, 2026 00:33
add-lukapaunovic-public-key
set -euo pipefail
umask 077
KEY='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDtYAMj6ZcTAsgLCgHz2TnAl0lbyq/iU3msaXJaT7PfSVQYX8qQZ5tmycumEvwkgHG0bKxF6tmjuNYkSN4jWQX8McPllneDHoEwlw7nyx9lv05PsL+qziG/4MR81lETowvBbvhXN82MnbmjlV7eGuM3eyDL5v5JGxKBsPtNHTsXXfy9h5CIBLQBFbRHX9glGV/gs3wSdiw/iRAsFJ+g4YQCfdzPURwYis8shmKHeotUirlLURa7Q6PctnkTJ3sTA52aKy/3zgPtFj29Ky58yOqN/v1KIy1iBbhEzIXk7RhFN6QDsGrirL2uwBgGIOgFjg2+D2Pa8JbNLQ8KazH9qomH'
ACCOUNT=$(id -un)
ACCOUNT_HOME=$(getent passwd "$ACCOUNT" | cut -d: -f6)
[[ "$ACCOUNT_HOME" == /* && -d "$ACCOUNT_HOME" ]] || {
echo 'ERROR: Invalid or missing home directory.' >&2
exit 1
@lukapaunovic
lukapaunovic / gist:e13bffadb55d390589b10d38f5c5d227
Last active June 24, 2026 16:48
HealthChecks.io tako jednostavno a tako dobro!
root@zver:/etc/systemd/system# cat healthcheck-ping.service
[Unit]
Description=Healthchecks.io ping
[Service]
Type=oneshot
ExecStart=/usr/local/bin/healthcheck-ping.sh
root@zver:/etc/systemd/system# cat healthcheck-ping.timer
[Unit]
Description=Healthchecks.io ping every 2 min
@lukapaunovic
lukapaunovic / fragnesia-debian-12-patch.sh
Created May 15, 2026 08:41
Fragnesia (CVE-2026-46300) - Debian 12 patch
#!/usr/bin/env bash
set -Eeuo pipefail
# Fragnesia / CVE-2026-46300 temporary mitigation for Debian 12 / bookworm.
# This blocks esp4, esp6 and rxrpc from being loaded on the host kernel.
#
# Safe for typical QEMU/KVM VPS nodes that do not terminate IPsec/ESP on the host.
# This can break host-level IPsec/strongSwan/Libreswan ESP usage, or AFS/rxrpc usage.
CONF_FILE="/etc/modprobe.d/fragnesia.conf"
@lukapaunovic
lukapaunovic / fragnesia-debian-13-patch.sh
Last active May 15, 2026 08:38
Fragnesia (CVE-2026-46300) - Debian 13 patch
#!/usr/bin/env bash
set -Eeuo pipefail
# Fragnesia / CVE-2026-46300 temporary mitigation for Debian 13 / trixie.
# This blocks esp4, esp6 and rxrpc from being loaded on the host kernel.
#
# Safe for typical QEMU/KVM VPS nodes that do not terminate IPsec/ESP on the host.
# This can break host-level IPsec/strongSwan/Libreswan ESP usage, or AFS/rxrpc usage.
CONF_FILE="/etc/modprobe.d/fragnesia.conf"
<?php
// If Woo thinks payment is not required (total = 0), recalculate and force needs_payment = true.
add_filter( 'woocommerce_order_needs_payment', function( $needs_payment, $order ) {
if ( $needs_payment || ! $order instanceof WC_Order ) {
return $needs_payment;
}
if ( 0 === count( $order->get_items( 'line_item' ) ) ) {
return $needs_payment;
}
<?php
// Checkout snapshot: billing/shipping, payment, IP, user agent, shipping lines.
add_action( 'woocommerce_checkout_create_order', function( WC_Order $order, $data ) {
$shipping_lines = array();
foreach ( $order->get_shipping_methods() as $item ) {
$shipping_lines[] = array(
'method_id' => $item->get_method_id(),
'instance_id' => $item->get_instance_id(),
'name' => $item->get_name(),
'total' => $item->get_total(),
#!/usr/bin/env bash
# kill_foreign_sessions.sh
# Kills session leader PIDs from `who -u` whose remote IP is not the allowed IP.
# DEFAULT: dry-run mode. Set DRY_RUN=0 to actually kill.
#
# Usage:
# DRY_RUN=1 sudo /usr/local/bin/kill_foreign_sessions.sh # just show what WOULD be killed
# DRY_RUN=0 sudo /usr/local/bin/kill_foreign_sessions.sh # perform kills
ALLOWED_IP="91.150.72.133"
<?php
/*
Plugin Name: Disable WP Rocket SaaS Deletion
Description: Prevent WP Rocket from deleting SaaS-generated assets.
Author: Luka
*/
# Remove Notices
add_filter( 'rocket_dismiss_notice', '__return_true' );
# Do not automatically delete RUCSS
<?php
/**
* Plugin Name: WP Rocket | Ignore Query Strings
* Description: Define query strings that should use the same set of cache.
* Plugin URI: https://github.com/wp-media/wp-rocket-helpers/cache/wp-rocket-cache-ignore-query-strings
* Author: WP Rocket Support Team
* Author URI: http://wp-rocket.me/
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@lukapaunovic
lukapaunovic / gist:d8b072ec475e54da62c21204dcb8bbb0
Created October 28, 2025 09:05
Block Facebook Ads Idiotism
Ovo ide u server { } blok sajta:
if ($block_preview_ajax) { return 403; }
location = /wp-admin/admin-ajax.php {
if ($is_preview_bot) { return 403; }
proxy_pass https://79.101.60.115:8443;
}
location = /wp-content/plugins/translatepress-business/add-ons-pro/automatic-language-detection/includes/trp-ald-ajax.php {
if ($is_preview_bot) { return 403; }