Skip to content

Instantly share code, notes, and snippets.

@quells
quells / uitype.py
Created October 29, 2026 15:41
Type the value of an env var into a named field, via uiclick's AT-SPI helpers.
#!/usr/bin/env python3
"""Type the value of an env var into a named field, via uiclick's AT-SPI helpers.
Refuses to type unless the target field reports FOCUSED after GrabFocus, so
keystrokes can't land in some other window. Never prints the value.
Usage: uitype.py --app Firefox [--enter] "E-Mail" RAUTHY_TEST_USER
Requires ~/.local/bin/uiclick (AT-SPI lookup + Mutter RemoteDesktop key injection).
"""
@quells
quells / uiclick.py
Created October 24, 2026 03:55
Activate a control in a running GNOME/Wayland app from a remote (SSH) shell.
#!/usr/bin/env python3
"""Activate a control in a running GNOME/Wayland app from a remote (SSH) shell.
Finds the control by name in the AT-SPI accessibility tree, gives it focus,
and presses Enter (or Space) through org.gnome.Mutter.RemoteDesktop, which is
the same activation path as a mouse click.
Why not a normal click:
- XTest/xdotool cannot reach native Wayland clients.
- /dev/uinput is root-only on this host.
@quells
quells / shot.py
Created October 24, 2026 03:54
Capture the logged-in GNOME/Wayland screen from a remote (SSH) shell.
#!/usr/bin/env python3
"""Capture the logged-in GNOME/Wayland screen from a remote (SSH) shell.
Uses the xdg-desktop-portal Screenshot API non-interactively, so it works
without a terminal inside the desktop session. Prints the saved PNG path.
"""
import os, sys, time
from gi.repository import Gio, GLib
out = sys.argv[1] if len(sys.argv) > 1 else f"/tmp/screenshot-{int(time.time())}.png"
@quells
quells / WEBDAV.md
Created January 13, 2026 08:18
WebDAV Setup for Sprite

WebDAV Setup Guide for Sprite VM

This guide documents the complete setup process for running a WebDAV server in a Sprite VM, allowing file access via HTTP from macOS or other WebDAV clients.

Overview

  • Server: WsgiDAV (Python-based WebDAV server)
  • Web Server: Cheroot (bundled with WsgiDAV)
  • Port: 8080 (configured as Sprite HTTP service)
  • Served Directory: /home/sprite (entire home directory)
import json
import os
import sys
from typing import Dict, List, Tuple
def main():
query = ""
if len(sys.argv) > 1:
query = sys.argv[1].lstrip(".")
@quells
quells / bmp.go
Last active February 4, 2025 05:28
package main
import (
"image"
"image/color"
"log"
"os"
"golang.org/x/image/bmp"
)
@quells
quells / boox-dns-blacklist
Created July 1, 2021 15:29
Pi-Hole Blacklist for BOOX devices
# Copied from https://github.com/StevenBlack/hosts
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
127.0.0.1 local
255.255.255.255 broadcasthost
::1 localhost
::1 ip6-localhost
::1 ip6-loopback
fe80::1%lo0 localhost
@quells
quells / ubnt-dns-blacklist
Created April 16, 2021 23:04
Pi-Hole Blacklist for UniFi/Ubiquiti Devices
# Copied from https://github.com/StevenBlack/hosts
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
127.0.0.1 local
255.255.255.255 broadcasthost
::1 localhost
::1 ip6-localhost
::1 ip6-loopback
fe80::1%lo0 localhost
@quells
quells / pihole-unbound.docker-compose.yml
Last active April 2, 2021 23:23
Pi-Hole + Unbound Docker Compose Script
version: "3"
networks:
dns_net:
driver: bridge
ipam:
config:
- subnet: 172.31.41.0/24
services:
@quells
quells / tiny-ca.sh
Created February 8, 2021 16:51
Tiny certificate authority for LAN
#!/bin/bash
# Based on https://deliciousbrains.com/ssl-certificate-authority-for-local-https-development/
if [ "$#" -ne 1 ]; then
echo "Usage: tiny-ca.sh <domain>"
exit 1
fi
DOMAIN=$1