Skip to content

Instantly share code, notes, and snippets.

View mariduv's full-sized avatar

meredith mariduv

  • Chicago, IL
  • 23:00 (UTC -05:00)
View GitHub Profile
@mariduv
mariduv / merge-spamassassin-bayes-backup.pl
Created July 17, 2025 17:42
Merge SpamAssassin bayes DB backup files
#!/usr/bin/env perl
=head1 NAME
merge-spamassassin-bayes-backup.pl - Merge bayes db backup files
=head1 SYNOPSIS
$ merge-spamassassin-bayes-backup.pl bayes-1.txt bayes-2.txt > bayes-merged.txt
$ sa-learn --restore bayes-merged.txt
@mariduv
mariduv / scrape-tag.pl
Created December 20, 2018 01:58
markdown dump of all posts on a tag on a particular blog, with other tags saved too
#!/usr/bin/env perl
use 5.010;
use warnings;
use strict;
use utf8::all;
use HTML::FormatMarkdown;
use Mojolicious 8.02;
@mariduv
mariduv / gmail-archive.js
Last active July 26, 2025 03:09
Google Apps Script for improving my gmail experience
// use Google Apps Script, server-side automation for Google Workspace
// accounts, to archive messages that are read and not flagged, after 30 days.
//
// Add a trigger that runs `archiveInbox()` overnight, and it will loop
// archiving up to 50 threads at a time, until no matches for `archive_filter`
// are found.
"use strict";
const archive_filter = "in:inbox is:read -is:starred older_than:30d";
@mariduv
mariduv / snippet.vim
Last active June 21, 2017 19:05
g<C-]> improvement with ltag
" The default behind g<C-]> is `tselect`, which gives you an awkward prompt that
" is awful if you get more than a page of results. This switches that out for
" `ltag`, which loads the location list, allowing LL commands and shortcuts.
" Use ltag instead of tselect
nmap g<C-]> :call Ltag(expand('<cword>'))<CR>
" Function wrapping to run ltag then lopen, and abort if ltag finds nothing
func! Ltag(term) abort
exe "ltag " . a:term
@mariduv
mariduv / example.sieve
Created May 31, 2017 16:48
Practical sieve examples seem kind of scarce, so...
# vim: ft=sieve
require "imap4flags";
require "fileinto";
require "copy";
if address :domain :is ["from", "to", "cc", "bcc"] "frobtech.com" {
addflag "frobtech";
if address :all :is "to" "[email protected]" {
@mariduv
mariduv / BTN_1
Last active December 23, 2020 21:47
GL.iNet GL-AR300M VPN Switch
#!/bin/sh
set -eu
logger "$BUTTON ${ACTION}"
# Drop in /etc/rc.buttons once you have your VPN configured through the
# built-in interface. Switch toward the front for VPN enabled.
# Notes:
# - "startvpn start" ends with a background openvpn process that may not be up
# yet or ever be up -- config/connectivity issues -- but we still enforce the
@mariduv
mariduv / README.md
Last active March 8, 2017 06:37
Updating babun cygwin packages

Babun has a cool package manager, but pact doesn't offer the equivalent of apt upgrade because you can't really update Cygwin files on Windows while Cygwin is running. Babun's core and plugins update very occasionally but sometimes you want to upgrade all your Cygwin packages at once. This is the script I use to do just that. All it's really doing is downloading Cygwin's setup-x86.exe and running it, and you can do the same manually. I just didn't see this procedure clearly documented anywhere for folks who were sold babun as an easy-to-use Cygwin kit. The only hits are "upgrade one at a time" or "use this command to sorta brute-force it all."

This upgrades everything in one shot.

Notes:

  • Remember you have to stop all Cygwin processes!
  • Yes, babun only installs 32-bit, as of release 1.2.0
  • Script does not check the PGP signature of this EXE before running it
  • Modern PowerShell makes you explicitly enable r
@mariduv
mariduv / auto-brightness.pl
Last active December 29, 2022 03:55
auto-brightness.pl - adjust windows desktop pc brightness based on rtsp traffic cam
#!/strawberry/perl/bin/wperl.exe
=head1 NAME
auto-brightness.pl - adjust display brightness based on a nearby traffic cam
=head1 DESCRIPTION
ClickMonitorDDC is a really handy tool for desktop PCs, as you can set hotkeys
to adjust display brightness as conditions change. It gets a bit repetitive
#!/bin/sh
set -eu
case ${1:-} in *help|-h)
exec perldoc $0;;
esac
cd
mkdir -p sandbox
@mariduv
mariduv / duo-qr-dump.pl
Created December 6, 2015 17:35
Dump Duo TOTP accounts from backup, in QR code form.
#!perl
=head1 duo-qr-dump.pl
perl duo-qr-dump.pl accounts.json
Requires: Mojolicious, Term::QRCode (which requires Text::QRCode which
requires qrencode)
Given accounts.json from your Duo android app's private data, dumps a list of