Skip to content

Instantly share code, notes, and snippets.

@gwire
gwire / nginx_proxy_imaps.md
Last active June 7, 2025 18:40
Using Nginx to proxy IMAPS

Using Nginx to proxy IMAPS

Nginx can be used to proxy several mail protocols. This can be useful in a variety of scenarios: load balancing, providing up-to-date TLS for servers that don’t support it, graceful server migration, or enabling user-specific storage policies.

Unfortunately, what’s not clear from the documentation is that nginx (at least at 1.18) can’t proxy over encrypted connections - which makes this unworkable except in the case of servers on the local network.

@gwire
gwire / red_salon_steam.py
Last active April 21, 2025 14:52
Script to solve the steampipe puzzle in "Vampire The Masquerade - Swansong"
"""
In scene 07 of the game Vampire: The Masquerade - Swansong, you need to turn three valves
on three pipes, in order to set all three gauges to 12.
Each valve has a different effect across all three gagues.
If the gagues go over 12 they wrap around to zero.
Online guides suggest a specific sequence of turns, but this isn't a solution as it assumes
a known starting position.
@gwire
gwire / bingbotsearch.json
Last active April 14, 2025 12:13
AWS WAF Rule for blocking WordPress search requests by Bingbot
{
"Name": "BingbotSearch",
"Priority": 13,
"Statement": {
"AndStatement": {
"Statements": [
{
"ByteMatchStatement": {
"SearchString": "bingbot",
"FieldToMatch": {
@gwire
gwire / imap-keyword-notes.md
Last active April 14, 2025 12:17
Notes on common IMAP keywords

IMAP4 Keywords are small bits of metadata that can be attached to stored email messages.

They're free-form text, but the convention is that

  • \ indicates a system keyword
  • $ indicates a keyword with a common meaning

See the IMAP4 spec and the IANA registry

@gwire
gwire / thames.jsonld
Created July 28, 2024 16:33
A review of the claim that the River Thames is the cleanest river in the world
{
"@context": "https://schema.org",
"@type": "ClaimReview",
"claimReviewed": "The Thames is considered one of the cleanest rivers in the world.",
"reviewBody": "This sounds like bollocks, mate",
"itemReviewed": {
"@type": "Claim",
"author": {
"@type": "Person",
"name": "Lucy Williamson"
@gwire
gwire / calendar-file.sieve
Last active April 18, 2024 15:20
Sieve script to file mails containing iCal events
require["mime","fileinto"];
## IANA registered type is "text/calendar", but some sources use "application/ics"
if header :mime :anychild :subtype "Content-Type" ["calendar","ics"] {
fileinto "calendar";
}
@gwire
gwire / nginx_405.md
Last active June 14, 2023 21:19
Generating 405 responses in nginx

I have a site where there is no legitmate use of the HTTP POST method (or anything other than GET/HEAD).

limit_except is usually used for method restriction, but only produces 403 responses, not 405. There's a Stack Overflow question that notes this. There's a 2015 blog post that suggests something like the following (which I needed to modify to get the Allow: header to appear):

server {
@gwire
gwire / sorting_arpa_list.md
Created April 22, 2023 16:23
Sorting a list of in-addr.arpa values

I have a process that outputs a list of .in-addr.arpa values. These consist of names with 3 to 6 labels.

161.187.42.143.in-addr.arpa
18.139.243.162.in-addr.arpa
38.51.19.58.in-addr.arpa
136.67.34.in-addr.arpa
16.134.243.162.in-addr.arpa
18.240.203.159.in-addr.arpa
240.54.in-addr.arpa
@gwire
gwire / user_data.yml
Last active September 21, 2024 23:32
Cloud-init config to allow password-less sudo via ssh-agent
#cloud-config
## I want to authenticate sudo via ssh-agent on Ubuntu 22.04
users:
- name: bob
gecos: Bob
shell: /bin/bash
primary_group: bob
groups: sudo
@gwire
gwire / fileprovider_use.md
Created January 31, 2023 13:50
File Provider users

Software on Apple platforms that makes use of the File Provider API

Software Platform Used Notes
Dropbox macOS, iOS yes help
OneDrive macOS yes reddit
Google Drive macOS yes help
NextCloud macOS no in development