Skip to content

Instantly share code, notes, and snippets.

@andcam
andcam / gist:921e81d4b6dadfb7fa4ef529b52eecb3
Last active June 21, 2023 15:56
cloudflare - block common bot paths
(http.request.uri.path contains ".tbz")
or (http.request.uri.path contains ".bz")
or (http.request.uri.path contains ".bz2")
or (http.request.uri.path contains ".gz")
or (http.request.uri.path contains ".tar")
or (http.request.uri.path contains ".7z")
or (http.request.uri.path contains ".xz")
or (http.request.uri.path contains ".tgz")
or (http.request.uri.path contains ".rar")
or (http.request.uri.path contains ".sql")
@andcam
andcam / gist:9305da753726599ba2a14e2a6ff13de2
Created April 24, 2023 18:51
AkamaiGHost 503 Service Unavailable
HTTP/1.1 503 Service Unavailable
Server: AkamaiGHost
Mime-Version: 1.0
Content-Type: text/html
Content-Length: 176
Expires: Mon, 24 Apr 2023 08:57:16 GMT
Date: Mon, 24 Apr 2023 08:57:16 GMT
Connection: close
@andcam
andcam / gist:f6355e04d542db0b8a2fa0d722e6866c
Created April 24, 2023 18:50
AkamaiGHost 504 Gateway Time-out
HTTP/1.1 504 Gateway Time-out
Server: AkamaiGHost
Mime-Version: 1.0
Content-Type: text/html
Content-Length: 249
Expires: Mon, 24 Apr 2023 08:04:19 GMT
Date: Mon, 24 Apr 2023 08:04:19 GMT
Connection: close
@andcam
andcam / gist:c6462b0afe5e047b831d08abb306fc7b
Created November 29, 2022 09:01
extract, sort and count IP4 address from any text file
awk '/^[0-9.]+[.][0-9]+[.][0-9]+[.][0-9]+$/{if(!a[$0]++)print $0}' RS="[ :/\n]" file.txt | sort | uniq -c
@andcam
andcam / gist:55747f8a2ba5b3de2650b7ae27b6b793
Created November 15, 2022 09:47
sort and count lines in a text file
cat file.txt | sort | uniq -c | sort -r
@andcam
andcam / utf8_bodge.sql
Created July 20, 2022 01:06
Wordpress UTF8 chars fix - search & replace
UPDATE wp_posts SET post_content = REPLACE(post_content, '“', '“');
UPDATE wp_posts SET post_content = REPLACE(post_content, '”', '”');
UPDATE wp_posts SET post_content = REPLACE(post_content, '’', '’');
UPDATE wp_posts SET post_content = REPLACE(post_content, '‘', '‘');
UPDATE wp_posts SET post_content = REPLACE(post_content, '—', '–');
UPDATE wp_posts SET post_content = REPLACE(post_content, '–', '—');
UPDATE wp_posts SET post_content = REPLACE(post_content, '•', '-');
UPDATE wp_posts SET post_content = REPLACE(post_content, '…', '…');
UPDATE wp_posts SET post_title = REPLACE(post_title, '“', '“');
@andcam
andcam / .htaccess
Created June 7, 2022 18:39
fix for mp4 video files not playing in Safari & iOS through CloudFlare (apache)
# disable compression for video files
SetEnvIfNoCase Request_URI .(mp4|ogv|webm)$ no-gzip dont-vary
@andcam
andcam / gist:ba2871cef0325747bb4ecfa11b35806b
Created January 26, 2022 11:47
prevent Wordpress installing default themes with core updates... ffs.
define('CORE_UPGRADE_SKIP_NEW_BUNDLED', true);
@andcam
andcam / gist:0fd65c14e5c7301ce1d8095695f6b4d3
Created November 17, 2021 11:02
unroll-images-production spam
Delivered-To: ##@##.###
Received: by 2002:a05:622a:148b:0:0:0:0 with SMTP id t11csp5523685qtx;
Tue, 16 Nov 2021 20:36:08 -0800 (PST)
X-Received: by 2002:a7b:c084:: with SMTP id r4mr78162411wmh.117.1637123768650;
Tue, 16 Nov 2021 20:36:08 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1637123768; cv=none;
d=google.com; s=arc-20160816;
b=cC3bxNWRu7je7F9BIERxbP9sIchmPLrP/S8kyEDgevujQhIGckmXqEVHee8DR4a/kD
WdCupeQ5ym2PoI3w0PGuyhkgrKDd/4Qc2m4duO62QfAJ0L9EUakm3t1I0XvIb+GIwVel
NWKApz74gy40/GoDHkiEEWlkHFuHWJfT3I+iHDo2yqoqWJ4dvb59r04C+H1Xb+vJ7Utj
@andcam
andcam / gist:1794add303cd11803226a10aed78ee2f
Last active January 18, 2022 13:01
google cloud (re)boot error - required key instance-id returned nothing
[ 5.621521] cloud-init[497]: Cloud-init v. 21.3-1-g6803368d-0ubuntu1~20.04.4 running 'init-local' at Wed, 10 Nov 2021 23:40:27 +0000. Up 5.33 seconds.
[ OK ] Finished Initial cloud-init job (pre-networking).
Starting Initial cloud-ini… (metadata service crawler)...
[ 6.165672] cloud-init[517]: Cloud-init v. 21.3-1-g6803368d-0ubuntu1~20.04.4 running 'init' at Wed, 10 Nov 2021 23:40:28 +0000. Up 6.10 seconds.
[ 6.178570] cloud-init[517]: ci-info: +++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++
[ 6.190549] cloud-init[517]: ci-info: +--------+-------+-----------+-----------+-------+-------------------+
[ 6.202533] cloud-init[517]: ci-info: | Device | Up | Address | Mask | Scope | Hw-Address |
[ 6.214512] cloud-init[517]: ci-info: +--------+-------+-----------+-----------+-------+-------------------+
[ 6.216738] cloud-init[517]: ci-info: | ens4 | False | . | . | . | 00:00:00:00:00:00 |
[ 6.218654] cloud-init[517]: ci-i