Skip to content

Instantly share code, notes, and snippets.

@rachasakr
rachasakr / mtd-spam-report.js
Created February 19, 2024 08:45
Mass report Mastodon spam by notification threshold
// Paste the following script in the web's console.
// CHANGE BEFORE RUN! USe AT YOUR OWN RISK!
const fromDate = new Date('2024-02-01T07:00:00.000Z'); // February 1st, 2024
const toDate = new Date('2024-02-14T07:00:00.000Z'); // February 14th, 2024
for (const targetNoti of document.querySelectorAll('#mastodon [aria-label="Notifications"] .status')) {
const postTime = new Date(targetNoti.querySelector('.status__info time').getAttribute('datetime'));
if (postTime < fromDate || postTime > toDate) continue;
targetNoti.querySelector('.status__action-bar .status__action-bar__dropdown button').click();
@rachasakr
rachasakr / LayoutFix.py
Created December 3, 2023 15:41
layoutFix.exe on Linux Mint using AutoKey
LOOKUP_TBL_US = '~!@#$%^&*()_+`1234567890-=QWERTYUIOP{}|qwertyuiop[]\ASDFGHJKL:"asdfghjkl;\'ZXCVBNM<>?zxcvbnm,./'
LOOKUP_TBL_TH = '%+๑๒๓๔ู฿๕๖๗๘๙_ๅ/-ภถุึคตจขช๐"ฎฑธํ๊ณฯญฐ,ฅๆไำพะัีรนยบลฃฤฆฏโฌ็๋ษศซ.ฟหกดเ้่าสวง()ฉฮฺ์?ฒฬฦผปแอิืทมใฝ'
origText = clipboard.get_selection()
# https://superuser.com/a/1432982
langCode = system.exec_command("xset -q | grep LED | awk '{ print $10 }'", getOutput=True)
crctText = ''
for ot in origText:
lkuPos = -1