Skip to content

Instantly share code, notes, and snippets.

@mesmere
mesmere / print-dates.mjs
Last active May 19, 2025 03:24
Utility to print all dates between a start date and now
import process from 'node:process'
import 'temporal-polyfill/global' // Remove once node ships TC39
if (process.argv.length !== 5) {
console.error("Usage: node print-dates.mjs startyear startmonth startday");
process.exit(1);
}
const startDate = new Temporal.PlainDate(process.argv[2], process.argv[3], process.argv[4]);
const endDate = Temporal.Now.plainDateISO('America/New_York');
curl -s "https://crosshare.org/dailyminis/2022/1" | grep -oP '(?<=href="/crosswords/)\w+(?=/)' | awk 'NR%2' | (
index=0
while read crossid; do
((index++))
filename=$(printf "%02d %s\n" $index "$(curl -Is https://crosshare.org/api/puz/$crossid | grep -Po '(?<=filename=").+(?=")')")
curl -o "$filename" https://crosshare.org/api/puz/$crossid
done
)
@mesmere
mesmere / twitter-file-browser.js
Created April 29, 2025 19:42
Mobile browser userscripts
// ==UserScript==
// @name Twitter mobile file browser unlocked
// @namespace http://tampermonkey.net/
// @version 2025-04-29
// @author mesmere
// @description Open the full file browser instead of just the recent media panel when attaching an image/video.
// @match https://twitter.com/*
// @match https://x.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant window.onurlchange
@mesmere
mesmere / crossword-db.sh
Last active April 27, 2025 20:25
Alphacross play stats
if [ $(id -u) -ne 0 ]
then echo "Please run this script as root."
exit
fi
/data/data/com.termux/files/usr/bin/sqlite3 /data/data/org.akop.crosswords/databases/crosswords

The Switch Pro controller doesn't fully work with HK (shoulder buttons are broken), apparently bc the game uses an outdated version of SDL controller mappings. We can help it along by providing mappings from the community in an environment variable.

  1. Install the GOG version of Hollow Knight, e.g. from the Internet Archive.
  2. Edit ~/GOG Games/Hollow Knight/start.sh:
    export SDL_GAMECONTROLLERCONFIG="050000007e0500000920000001800000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,misc1:b4,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux,"
    ./"Hollow Knight" -force-opengl

Note the -force-opengl which was necessary for me bc on my hardware t

@mesmere
mesmere / tametsi-on-linux.md
Created July 11, 2024 10:16
Run Tametsi natively without Wine
  1. Buy Tametsi on Steam and install it with the Linux client.
  2. Go to the Tametsi install directory.
    $ cd $HOME/.steam/steam/steamapps/common/Tametsi/
    
  3. Unzip tametsi.exe.
     $ file tametsi.exe 
    tametsi.exe: Zip archive, with extra data prepended
    

$ unzip tametsi.exe -d tametsi/

  1. Download balatro-1.0.1f (the latest version as of 9 June 2024).
  2. Unzip the executable:
    unzip Balatro.exe -d balatro/
  3. Add this to the OS-specific settings switch in globals.lua:
    if love.system.getOS() == 'Linux' then
        self.F_DISCORD = false

self.F_SAVE_TIMER = 5

This is a suite of custom commands for vetting people into a discord server using yagpdb's ticket system.

Relevant roles

  • [no role] - Can only see #start-here and #rules.
  • admin - Can do everything.
  • approver - Can approve or deny vetting tickets but shouldn't have other permissions.
  • anti-liberal aktion - Can see vetting and talk to applicants but can't approve.
  • vetted - Applicants who have been approved. Gives them access to #roles and #general
  • liberal in the walls - Additional role for applicants who have been approved but need some restrictions added (we add a role icon to tell people they're a lib)
@mesmere
mesmere / 015.go.tmpl
Last active July 7, 2023 12:35
YAGPDB CC system for auto-sanitizing messages. tiktok to vxtiktok, twitter to nitter, removes tracking url parameters
{{/* Trigger on NONE */}}
{{/* Find the user's dominant role color for the accent bar on the notice message. */}}
{{ $color := 0 }}
{{ $pos := 0 }}
{{ range .Member.Roles }}
{{- with $.Guild.GetRole . -}}
{{- if and .Color (lt $pos .Position) -}}
{{- $color = .Color -}}
{{- $pos = .Position -}}
@mesmere
mesmere / lopsided_words.py
Last active March 26, 2023 17:22
Words (of each length) that have the most lopsided ratio between the most common letter and all other letters
from collections import Counter
words = list(filter(None, open("words.txt", "r").read().split("\n")))
bestRatioByLength = []
for word in words:
length = len(word)
ratio = Counter(word).most_common(1)[0][1] / length