This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# chmod +x purge.sh | |
# DEFAULT | |
DEFAULT_DOMAIN="1.example.tld" | |
# MANUAL | |
function usage() { | |
echo "Use:" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use snippets plugin or functions.php | |
// Adds xkey tags: frontpage, sidebar (right), article-ID, category and tag | |
// Remember to change url | |
add_action('save_post', function ($post_id) { | |
// Don't do anything is this isn't an article or is autosaving | |
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; | |
if (get_post_type($post_id) !== 'post') return; | |
$tags = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add Xkey-based X-Cache-Tags headers | |
add_action('send_headers', function () { | |
if (is_admin() || is_user_logged_in()) { | |
return; | |
} | |
$tags = []; | |
// Frontpage | |
if (is_front_page()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Nicknames, urls and snapshot directories | |
case "$1" in | |
example) | |
DOMAIN="www.example.com" | |
TARGET_DIR="/var/www/emergency/example" | |
;; | |
try) | |
DOMAIN="try.example.tld" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import re | |
import sys | |
import json | |
import httpx | |
import tempfile | |
import configparser | |
from langdetect import detect |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import requests | |
import subprocess | |
import tempfile | |
import datetime | |
import sys | |
import time | |
MATOMO_API_URL = "https://matomo/index.php" | |
TOKEN = "<long-api-key" # give right token |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Comments are in Finnish, sorry | |
#--- Rate-limiter muistiin --- | |
from datetime import datetime, timedelta | |
from zoneinfo import ZoneInfo | |
ALLOWED_ERROR_CODES = [502, 503, 504] | |
last_reported = {} # esim. {503: datetime_object} | |
RATE_LIMIT_HOURS = 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Varnish working directory location in tmpfs | |
TMPFS_DIR="/dev/shm/varnish" | |
echo "Creating directory: $TMPFS_DIR" | |
mkdir -p "$TMPFS_DIR" | |
chown -R varnish:varnish "$TMPFS_DIR" | |
# Path to override.conf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub vcl_recv { | |
unset req.http.x-cache; | |
} | |
sub vcl_hit { | |
set req.http.x-cache = "hit"; | |
if (obj.ttl <= 0s && obj.grace > 0s) { | |
set req.http.x-cache = "hit graced"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Mastodon update script | |
# v3 (2024.02.18) | |
# forked | |
# | |
# Changelog | |
# * v1 - initial version | |
# * v2 - added mastodon-bird-ui |
NewerOlder