Skip to content

Instantly share code, notes, and snippets.

View ultramookie's full-sized avatar

steve mookie kong ultramookie

View GitHub Profile
@ultramookie
ultramookie / gotosocial.conf
Created October 1, 2024 04:37
Optimized GoToSocial nginx configuration
upstream backend {
server 127.0.0.1:8080;
}
server {
server_name DOMAIN.TLD;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
location / {
proxy_pass http://backend;
proxy_set_header Host $host;
upstream backend {
server 127.0.0.1:8080;
}
server {
server_name NAME.TLD;
location / {
proxy_pass http://backend;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
#!/bin/bash
#
# A little Mastodon hygeine. Keeping the storage nice and tidy.
# Get to where the script needs to go
cd /home/mastodon/live/bin
# Clean out accounts that have never interacted with anyone on this instance.
RAILS_ENV=production /home/mastodon/live/bin/tootctl accounts prune
@ultramookie
ultramookie / gist:c35dfe2f50842d383d0b0238b7039686
Created January 21, 2024 22:03
mastodon backup excludes.txt
cache/media_attachments/
cache/preview_cards/
cache/custom_emojis/
cache/accounts/
#!/bin/bash
sudo -u postgres pg_dump -Fc mastodon_production -Z 9 -f /home/mastodon/db/mastodon.`date +%d`.dump
rclone sync /home/mastodon/live/.env.production s3bucket:path/conf/mastodon/
rclone sync /etc/nginx/sites-available/mastodon s3bucket:path/conf/nginx/
rclone sync /home/mastodon/live/public/system/ s3bucket:path/system --exclude-from=/backups/bin/excludes.txt
rclone sync /home/mastodon/db s3bucket:path/db
#!/bin/bash
sudo -u postgres pg_dump -Fc mastodon_production -Z 9 -f /opt/db/mastodon.`date +%d-%H`.dump
# Sync It Offsite
rclone sync /home/mastodon/live/.env.production bucket:conf/mastodon/
rclone sync /etc/nginx/sites-available/mastodon bucket:conf/nginx/
rclone sync /home/mastodon/live/public/system/ bucket:system --exclude-from=/opt/backup/excludes.txt
rclone sync /opt/db bucket:db
curl -s https://orangebunny.net/api/v1/instance | jq ".stats | [.user_count, .status_count, .domain_count] | @csv"
#!/bin/bash
date "+%m/%d/%Y,"| tr -d '\n' >> ~/mastodon-stats.txt && (curl -s https://orangebunny.net/api/v1/instance | jq ".stats | [.user_count, .status_count, .domain_count] | @csv" | tr -d '\"') >> ~/mastodon-stats.txt
@ultramookie
ultramookie / yamltest.py
Created June 19, 2021 17:40
Protocode for parsing the YAML Front Matter for Hugo docs.
#!/bin/env python3
import yaml
from yaml.loader import SafeLoader
import pprint
DELIMITER = "---\n"
filename = "infinite.md"
_, yaml_text, _ = open(filename).read().split(DELIMITER, maxsplit=2)
data = yaml.load_all(yaml_text, Loader=SafeLoader)
#!/bin/env python3
import time
last=0
current=1
added=0
print(last)
while(True):