Skip to content

Instantly share code, notes, and snippets.

View relthyg's full-sized avatar

Martin Güthler relthyg

View GitHub Profile
@relthyg
relthyg / gist:f1500c8688d250d2e9432911ce4e1fe4
Created June 22, 2026 05:46
"mark all as read" button for old.reddit.com userscript
// ==UserScript==
// @name "mark all as read" button for old.reddit.com
// @description Adds a "mark all as read" button to https://old.reddit.com/message/unread/
// @match https://old.reddit.com/message/unread/*
// @author relthyg
// ==/UserScript==
(function() {
function getModhash() {
// Prefer the global reddit object, fall back to the hidden input
return (typeof reddit !== 'undefined' && reddit.modhash)
@relthyg
relthyg / mail.py
Created January 25, 2022 09:08
simple Python script for testing SMTP conenctions
# mail.py
# simple Python script for testing smtp connections
# see https://realpython.com/python-send-email/#sending-a-plain-text-email
import smtplib, ssl
smtp_server = "<your-smtp-hostname>"
smtp_username = "<your-smtp-username>"
sender_email = "<sender-email-address>"
receiver_email = "<receiver-email-address>"
port = 587
@relthyg
relthyg / mysql-dsn
Last active October 11, 2021 21:54
mysql-dsn: Connect to a mysql database from the command line using a DSN as argument
#!/usr/bin/env python3
#
# mysql-dsn
# Takes a DSN as argument and tries to connect to the specified database using the "mysql"-command.
# Passwords must be quoted ("url-encoded").
#
# Example:
# $ mysql-dsn mysqli://me:top_secret@hostname:33006/db-name
import re