Skip to content

Instantly share code, notes, and snippets.

View Dan-Q's full-sized avatar
🚣

Dan Q Dan-Q

🚣
View GitHub Profile
@Dan-Q
Dan-Q / ml-swap-credit-collector.user.js
Created May 26, 2026 08:32
Userscript to automatically perform a daily check, upon visiting the Melonland Forum, for your daily Swap Credit Welfare and claims it it available.
// ==UserScript==
// @name Melonland Swap Credit Collector
// @namespace swap-credit-collector.melonland.me.danq
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAFF0lEQVRYR+2Wa0yTVxiAn7YUFLxw80p07bwQx21CcCibl0RdNrNpGCRk6JwbuuGdH9Op0+gfIolblpmJIpM5SRwSo0w02czATM0GIlTuVFqpOBEpVKRFoLflfINOBQPiFrPE59fp957znuec837nq8zpdDp5jsheCPzvdkCUjN1ul6rGzc3tmavnqXZAdI2Ofh29XocYVVVVhZ+frys+FAYtIFY9ftw47jY3I3O0U1yqo6amlg0bkjCZTK5+j9ObXiaT9Tx5lEEJiC5iu4WE027mamkNNlsEZWXpJCcnY7F0uPo+jOjfe0yiLZfLeyL/MKCACKemprJlyxZw2igrv4XRqKau7g/Onk0hcPo09n35lat/L0ajkY3rVcS27mZlwS7ausxDE/Bwd6ezq6tn2/VUVITS3X2YCxcukZV1tN+kYrXbtyuJeSmRqHWHMZvNeHl5ueIP80QB8VitVqPTiYJzotFogHBKSn7EYKgk62gmfzY20dXdjUKhwOFwuM5ZSNddCkM1u4SpU6ei1Wp7svalXwHxaPHiNzl3Lg+lvJOrmhYqK1V0dPxE6t6NJCxfweTJkwgJCSUj4wi3bzewLyGU/Ku1LIrXQmMI0R/+TFllFQEBAa68/dFHQGyfu1IprcxN1kFxqZabNyMwGtPRanWMHTsOb+8R+PqOR61+F43me2YPq8DSfp+4vZnkbPuIqKQMDh46zOrVH7vyPok+AnFxcRQUFODp6cm2bduZMeMTqqtzuXz5JOXlZaxfvx4fH1+Cg6OprLjIodTtJMXM4UD+cX7YP4EprzYSovYnflEEs9/f
@Dan-Q
Dan-Q / site-closer.js
Created May 12, 2026 15:59
Dated Site Closed Script
// DATED Simple Site Closer script v0.1
// This script shuts down certain pages automatically on some dates, expressed as regular expressions of ISO8601 datestamps!
// With thanks to MelonKing's original version: https://melonking.net/scripts/site-closer.js
//
// How to use:
// Just place this script in the head of any page you'd like to close!
// Make a page called closed.html and put your closed info on there!
//
// Add this code after you link the script:
// <script>
@Dan-Q
Dan-Q / rainbow-name.net.melonland.forum.me.danq.user.js
Last active May 18, 2026 08:44
Userscript originally made to render your username in rainbow (or other) text in the shoutbox on Melonland Forum; now does lots of other things too.
// ==UserScript==
// @name Melonland Shoutbox Rainbow Name
// @namespace rainbow-name.net.melonland.forum.me.danq
// @match https://forum.melonland.net/*
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAFH0lEQVRYR+1Wa0yTZxR+SikoqCCgKERsh0ocAhMCK7B5SdBlIxuGQUKGzLmhGwoKP4YDBoE/xCZuWWYmclHmJHFIjDKQZDMDMyUbqIDljrTcnIiUm7SF3nfeZjVy0Rb4sSzx/fN9X/K+5zzvc57znI9joIX/cHFeAfjfMcAko9PpjKqxtrZesnoWpAGWPDT0LUilEjDptrW1wdnZaUkgLAbAbr3O1RVPhofB0U/ibqMEHR2dSEpKwNjY2AtBmJqMw+HMu8ciACwIo5uBMOjkuNfYAa02AGJxAVJSUqBQKOcNzvabysTerays5uwzC4AlF4lESE1NBQxaiJsfQiYToLv7L1y/nguvLZtx6ptv5wSWyWQ4lshH1Gg2DtRkYUIlXxwAWxsbTKtU/9IuRUuLL9TqQty8eRslJRfmDcpum57OQ+TGeAiPFkIul8Pe3n5hJWA3FwgEkEiY4AxoamqiAP5oaPgZfX2tKLlQjL8Hh6BSq8HlcqHX62GqMwPdfdsP/OAGbNq0CV1dXS/UyLwlYAn37n0HVVWV4FlN417TCFpb+VAqf4Ho5DHE7o+Dh8cG+Pj4oqjoPB49GsCpWF9U3+vEnhhKNuiD0E9+hbi1De7u7i/tkjkAGH02PJ7xZtYcJam9C/39AVT3ArqJBGvXusLRcQWcnNYRQx8QMz8ieFkLFJNPEX2yGGVpn0KYUISz+YU4dOgzsy06B0B0dDRqampgZ2eHtLR0bN36Odrby1FbewXNzWIkJiZi9WonbNsWi
@Dan-Q
Dan-Q / wireguard-server-for-debian-13.sh
Created February 18, 2026 14:20
Launch script, originally intended to be used as a Linode StackScript but suitable for any Debian 13 box, for setting up a WireGuard VPN server.
#!/bin/bash
# With thanks to: https://www.server-world.info/en/note?os=Debian_13&p=wireguard
#
# How to use:
# 1. Spin up a tiny virtual machine (the cheapest one with a public IP address will usually do!) with your choice
# of cloud provider (Linode, Google Cloud, AWS, Azure, whoever...) and region.
# 2. Run this script (you can modify it to your liking if e.g. you want to support multiple simultaneous clients.
# 3. Download the /root/wireguard.conf file it creates and load it into your WireGuard client.
# 4. Use e.g. icanhazip.com or ipleak.net to check and see where in the world you now appear to be!
#
@Dan-Q
Dan-Q / 3r.org.uk-shift-volunteer-counts.user.js
Created February 8, 2026 20:21
[Userscript] Three Rings: add 'count' alongside volunteers on shifts
// ==UserScript==
// @name Three Rings: add 'count' alongside volunteers on shifts
// @namespace Violentmonkey Scripts
// @match *://*.3r.org.uk/rota
// @match *://*.3r.org.uk/rota/*
// @grant GM_addStyle
// @version 1.0
// @author Dan Q
// @description Switch the list of volunteers on a shift into a numbered list so they're easy to enumerate.
// ==/UserScript==
@Dan-Q
Dan-Q / rss-feed-suffixes.php
Created January 1, 2026 18:04
Code referenced by a ClassicPress/WordPress theme's functions.php to add RSS 'suffix messages', as used by DanQ.me.
<?php
/**
* Returns the DEFAULT "thanks" message for a post. This is determined (functionally-)randomly,
* using the ID of the post as the random seed.
*/
function q23_rss_thanks_default( $post ) {
$rss_thanks_messages = [
"πŸ’– RSS is fantastic, and so are you for using it. πŸŽ†",
"πŸ‘ Congratulations on being an RSS user. πŸŽ‰",
@Dan-Q
Dan-Q / blog.html
Created November 28, 2025 09:41
Frameset with Self-Correcting Anchor Link Tracking, based on Melon Link, for kro
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Blog</title>
</head>
<body>
<h1>Blog</h1>
@Dan-Q
Dan-Q / gb-scotland-ireland-voronoi-boundary.py
Created November 10, 2025 17:30
Hacky Python script to plot across England the Voronoi boundary between Scotland and Ireland, showing which English point is closer to which of its neighbours, as a GPX file.
#!/usr/bin/env python3
"""
Generate a GPX line dividing parts of England that are closer to Scotland
than to Ireland, using real polygon boundaries from Natural Earth.
"""
import os
import tempfile
import requests
from zipfile import ZipFile
@Dan-Q
Dan-Q / SCROLOOP.BAS
Last active October 15, 2025 09:12
QBasic program demonstrating a scroll effect in a loop. Details/explanation: πŸ”— https://danq.me/2025/10/15/the-scroll-art-museum/
CLS
I% = 0 ' Screen position
J% = 1 ' Direction of flow ( -1 <= => +1 )
Action:
FOR A% = 0 TO I%
PRINT " "; ' Print lots of spaces to position
NEXT A%
I% = I% + J%
IF I% = 70 OR I% = 0 THEN
@Dan-Q
Dan-Q / openai-gpt4o-photo-geolocation-prompt.md
Created April 17, 2025 12:42
Prompt for GPT4o to guess GPS coordinates from data in a photographic image.

Identify the location from photographs and provide an analysis.

When given one or more photographs, your task is to analyze the visual elements within each photo to determine the most likely location where it was taken. You should consider details such as architectural styles, natural landmarks, linguistic elements in signage, and any other distinguishable geographic or cultural features. Once you've identified a possible location, provide a rationale for your guess, explaining the reasoning behind your conclusion. Additionally, supply a set of GPS coordinates in decimal format that corresponds to the guessed location.

Steps

  1. Analyze Details: Examine the photograph(s) for identifiable landmarks, languages, architectural styles, natural scenery, vehicles, clothing, signage, and any other clues that may indicate the region or city.

  2. Reasoning: Develop a reasoning process based on these observed details to narrow down the potential locations.