Skip to content

Instantly share code, notes, and snippets.

@thinkingcap
thinkingcap / wordpress.location.main-before
Last active July 20, 2026 05:50
/etc/nginx/main-extra.conf
# Geo location setup
geoip2 /usr/share/GeoIP/GeoLite2-Country.mmdb {
auto_reload 60m;
$geoip2_continent_code default=XX source=$remote_addr continent code;
$geoip2_country_code default=XX source=$remote_addr country iso_code;
}
map $geoip2_country_code $allowed_country {
default 0;
XX 0; # explicit: unknown IPs are not allowed
buy/:1 Access to fetch at 'https://api.blocktools.dev/api/v1/checkout' from origin 'https://getloglens.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
yew-storefront-loglens-fd871e2ab09780df.js:362 POST https://api.blocktools.dev/api/v1/checkout net::ERR_FAILED 502 (Bad Gateway)
imports.wbg.__wbg_fetch_b7bf320f681242d2 @ yew-storefront-loglens-fd871e2ab09780df.js:362
$__wbg_fetch_b7bf320f681242d2 externref shim @ yew-storefront-loglens-fd871e2ab09780df_bg.wasm:0x6a43b
$web_sys::features::gen_Window::Window::fetch_with_request::hc125aab5940d3531 @ yew-storefront-loglens-fd871e2ab09780df_bg.wasm:0x6b5fc
$<yew_storefront_loglens::Home as yew::functional::FunctionProvider>::run::home::{{closure}}::{{closure}}::hc943e75e5bd95f5a @ yew-storefront-loglens-fd871e2ab09780df_bg.wasm:0x126cb
$wasm_bindgen_futures::queue::Queue::new::{{closure}}::hfb7c7cbb6cb2d4f1 @ yew-storefront-loglens-fd871e2ab09780df_bg.wasm:0x4af86
$<dyn core::ops::function::FnMut

Proxmox VE tips

Just some tips I gathered over time. All in one easily reachable place so I can share it wherever I want.

Please note that unless you see a shebang (#!/...) these code blocks are usually meant to be copy & pasted directly into the shell. Some of the steps will not work if you run part of them in a script and copy paste other ones as they rely on variables set before.
The { and } surrounding some scripts are meant to avoid poisoning your bash history with individual commands, etc. You can ignore them if you manually copy paste the individual commands.
I chose to write things "in the open" that way so there's still some control and things don't become a black box.

Table of contents

#Block AI Slop
User-agent: AI2Bot
User-agent: Ai2Bot-Dolma
User-agent: aiHitBot
User-agent: Amazonbot
User-agent: Andibot
User-agent: anthropic-ai
User-agent: Applebot
User-agent: Applebot-Extended
User-agent: Awario
@thinkingcap
thinkingcap / build-franken-php.sh
Created July 1, 2025 00:04
Build FrankenPHP static binaries
docker buildx bake \
--load \
--set static-builder-gnu.args.PHP_VERSION=8.3 static-builder-gnu \
--set '*.platform=linux/amd64'
docker cp $(docker create --name static-builder-gnu dunglas/frankenphp:static-builder-gnu):/go/src/app/dist/frankenphp-linux-$(uname -m) frankenphp ; docker rm static-builder-gnu
nano /etc/lsws-rc/extra.d/mywebappname.rewrite.block-bot.conf
# Block unwanted bots by User-Agent
RewriteCond %{HTTP_USER_AGENT} "(scrapy|acunetix|BLEXBot|domaincrawler\.com|LinkpadBot|MJ12bot/v|majestic12\.co\.uk|AhrefsBot|TwengaBot|SemrushBot|Amazonbot|nikto|winhttp|Xenu\s+Link\s+Sleuth|Baiduspider|HTTrack|clshttp|harvest|extract|grab|miner|python-requests|ClaudeBot)" [NC]
RewriteRule .* - [F,L]
if ($http_user_agent ~* "(?:acunetix|gptbot|BLEXBot|domaincrawler\.com|LinkpadBot|MJ12bot/v|majestic12\.co\.uk|bingbot|AhrefsBot|TwengaBot|SemrushBot|Amazonbot|nikto|winhttp|Xenu\s+Link\s+Sleuth|Baiduspider|HTTrack|clshttp|harvest|extract|grab|miner|python-requests|meta-externalagent)") {
return 403;
}
#!/bin/bash
# Set a container name of your choice
CONTAINER=fed-insync
# Create the toolbox container AND initial update
distrobox-create --name $CONTAINER --image fedora:latest
distrobox enter $CONTAINER -- sudo dnf update -y
# Insync Repo
<button wire:click="save" wire:loading.attr="data-loading" class="relative">
<div class="[[data-loading]>&]:opacity-0">Save changes</div>
<div class="[[data-loading]>&]:opacity-100 opacity-0 absolute inset-0 flex items-center justify-center">
<!-- loading spinner... -->
</div>
</button>