Skip to content

Instantly share code, notes, and snippets.

// Source: https://gist.github.com/emanzitti/a21c915a5a547aab40d4567d948aa3f6
const GUILD_ID = '',
AUTHOR_ID = '';
clearMessages = function (guild_id, author_id, authToken, deleted = new Set()) {
const searchURL = `https://discordapp.com/api/v6/guilds/${guild_id}/messages/search?author_id=${author_id}&include_nsfw=true`
const headers = { Authorization: authToken }
let clock = 0
interval = 750
function delay(duration) {
@dshoreman
dshoreman / musicmerger.sh
Created June 14, 2022 03:45
A script to scan multiple music sources with mp3check, moving only error-free albums/artists to the library.
#!/usr/bin/env bash
ROOT=/vault/media
PREFIX=music-from-
TARGET=$ROOT/music
COLLECTIONS=(main)
main() {
for collection in "${COLLECTIONS[@]}"; do
echo -e "\n Processing $collection/"
@dshoreman
dshoreman / btrfs-guide.md
Created May 21, 2022 18:48 — forked from MaxXor/btrfs-guide.md
Btrfs guide to set up an LUKS-encrypted btrfs raid volume with included maintenance & recovery guide

Encrypted Btrfs storage setup and maintenance guide

Initial setup with LUKS/dm-crypt

This exemplary initial setup uses two devices /dev/sdb and /dev/sdc but can be applied to any amount of devices by following the steps with additional devices.

Create keyfile:

dd bs=64 count=1 if=/dev/urandom of=/etc/cryptkey iflag=fullblock
chmod 600 /etc/cryptkey
@dshoreman
dshoreman / grouplist.php
Created May 15, 2022 17:13
Fedora Package Group Lister
<?php
namespace Fedora\Packages;
use SimpleXMLElement;
use XMLReader;
class FedoraRelease
{
const RELEASES_URI = 'https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/';
@dshoreman
dshoreman / clickfix.js
Created May 7, 2022 09:31
Tesco: Prevent ctrl-click hijacking
// ==UserScript==
// @name Tesco.com Click Fixer
// @namespace Violentmonkey Scripts
// @match https://www.tesco.com/*
// @grant none
// @version 1.0
// @author -
// @description 07/05/2022, 09:32:38
// ==/UserScript==
document.addEventListener('click', e => {
@dshoreman
dshoreman / play-in-mpv.js
Last active August 26, 2022 20:21
Greasemonkey script to open youtube videos in MPV
// ==UserScript==
// @name Youtube: Open in mpv
// @version 1
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
// @require https://gist.githubusercontent.com/BrockA/2625891/raw/9c97aa67ff9c5d56be34a55ad6c18a314e5eb548/waitForKeyElements.js
// @match https://*.youtube.com/results*
// @match https://*.youtube.com/c/*/videos
// @match https://*.youtube.com/u/*/videos
// @match https://*.youtube.com/channel/*/videos
@dshoreman
dshoreman / slurp.md
Last active May 11, 2024 23:00
Swaymsg commands for listing windows and outputs

i3

Get Active Window ID

xdotool getactivewindow

Get Current Desktop ID

xdotool get_desktop_for_window "$(xdotool getactivewindow)"
@dshoreman
dshoreman / passcheck.sh
Created January 17, 2019 10:52
PwnedPasswords API Checker (Bash)
#!/bin/bash
# This script checks the haveibeenpwned 'PwnedPasswords'
# API based on the first 5 characters of your password's
# SHA-1 hash, then plucks out a full match from the hash
# suffixes returned by the API (assuming there are any).
# If your password's hash is found, it'll return pwncount.
#
# Either replace $1 with password, or call from shell
# as ` ./passcheck "mypass" - note the preceeding space
@dshoreman
dshoreman / example.conf
Created June 28, 2017 16:34
Example NginX config to block PHP execution in OctoberCMS
server {
listen 80;
server_name example.com;
return 301 https://$host$request_uri;
}
@dshoreman
dshoreman / gist:3904286
Created October 17, 2012 07:55 — forked from druu/gist:3901226
Bookmarklet: Clean up Google's search result URLs
javascript:(function(){var links=document.querySelectorAll('a.l'),count=links.length;while(count--){links[count].onmousedown=null;if((/url=/i).test(links[count].href)){links[count].href=decodeURIComponent(links[count].href.match(/url=([a-z0-9\-+%._]+)&/i)[1].replace(/\+/g, ' '));}};})()