Skip to content

Instantly share code, notes, and snippets.

@arantius
arantius / slow-html.py
Last active June 1, 2026 13:11
A simple tool to serve slow HTTP resposes. So the start and end time will be different.
import http.server
import time
import socketserver
from urllib.parse import urlparse, parse_qs
# Configuration constants
DEFAULT_NUM_PARAGRAPHS = 5
DEFAULT_DELAY_SECONDS = 0.5
@arantius
arantius / custom-host-rules.md
Last active May 5, 2026 00:45
Mouseover Popup Image Viewer: Custom Host Rules

Core Entries

These entries define when and where a rule is active.

d

Domain: This rule will be active only when the location.hostname (i.e. the domain) of the current page contains this substring.

e

@arantius
arantius / download-test.user.js
Last active November 7, 2023 22:49
Greasemonkey downloader test
// ==UserScript==
// @name Download Test
// @description Script to test download/install. At least one: require, resource, icon.
// @icon /favicon.ico
// @require require.js
// @resource resource resource.txt
// @grant GM.getResourceUrl
// ==/UserScript==
(async function() {
@arantius
arantius / css-resource-test.user.js
Last active November 7, 2023 00:47
Test script with a CSS resource
// ==UserScript==
// @name CSS Resource Test
// @version 1
// @grant GM.getResourceUrl
// @resource css test.css
// ==/UserScript==
(async function() {
var link = document.createElement('link');
link.rel = 'stylesheet';
// ==UserScript==
// @name URLSearchParams test
// @version 1
// @grant none
// ==/UserScript==
// Test for https://github.com/greasemonkey/greasemonkey/issues/3136
const searchParams = new URLSearchParams("key1=value1&key2=value2");
for (const key of searchParams.keys()) {
@arantius
arantius / bad-match.user.js
Created November 5, 2023 14:00
User script with bad @match
// ==UserScript==
// @name Bad match
// @description A user script with an improperly formatted @match, which should not install.
// @version 1
// @grant none
// @match abc
// ==/UserScript==
// ==UserScript==
// @name GM.rmc example
// @version 1
// @grant GM.registerMenuCommand
// ==/UserScript==
GM.registerMenuCommand('GM.rmc example', () => alert('GM.rmc example'));
// ==UserScript==
// @name GM.rmc example
// @version 1
// @grant none
// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// ==/UserScript==
GM_registerMenuCommand('GM.rmc example', () => alert('GM.rmc example'));
@arantius
arantius / everything-red.css
Created May 14, 2018 16:37
A simple CSS file
* { color: red !important; }
@arantius
arantius / gm-get-set-demo-with-polyfill.user.js
Last active March 8, 2022 15:31
A simple persistent value test user script
'use strict';
// ==UserScript==
// @name GM set/get demo
// @description Exercises both GM.getValue() and GM.getValue(). Logs a counter which goes up by one, at each page load.
// @grant GM.getValue
// @grant GM_getValue
// @grant GM.setValue
// @grant GM_setValue
// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// ==/UserScript==