Skip to content

Instantly share code, notes, and snippets.

View merrilymeredith's full-sized avatar

meredith merrilymeredith

View GitHub Profile
@merrilymeredith
merrilymeredith / 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;
@merrilymeredith
merrilymeredith / gmail-archive.js
Created October 8, 2018 04:59
Google Apps Script for improving my gmail experience
"use strict"
// set to trigger daily 3a-4a
function archiveInbox() {
var count
do {
count = archiveInboxIncremental()
}
while (count !== 0)
@merrilymeredith
merrilymeredith / 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
@merrilymeredith
merrilymeredith / 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" "report@frobtech.com" {
@merrilymeredith
merrilymeredith / 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
@merrilymeredith
merrilymeredith / 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
@merrilymeredith
merrilymeredith / 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
@merrilymeredith
merrilymeredith / 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