Skip to content

Instantly share code, notes, and snippets.

@waltman
waltman / nato_quiz.pl
Created January 21, 2025 01:35
A simple script to quiz myself on the NATO phonetic alphabet
#!/usr/bin/env perl
use v5.40;
my @nato = qw ( alfa
bravo
charlie
delta
echo
foxtrot
golf
@waltman
waltman / fix_ms150_waypoint.py
Last active September 22, 2024 23:52
Fix the Google Maps URLs in the 2024 MS 150 cue sheet
# Fix the Google Maps URLs in the MS 150 cue sheet
#
# $ python fix_ms150_waypoint.py 'https://www.google.com/maps?q=N%252039%C3%82%C2%B0%252037.980%2520W%2520074%C3%82%C2%B0%252050.632'
# https://www.google.com/maps?q=N+39°+37.980+W+074°+50.632
from sys import argv
print(argv[1].replace('%2520', '+').replace('%C3%82%C2%B0', ''))
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw(:5.34);
use experimental qw(signatures);
use Algorithm::Combinatorics qw(permutations combinations);
# solve BUNNY + BUNNY = RABBIT
my @var = split '', 'BUNYRAIT';
@waltman
waltman / cant_pay.txt
Created March 14, 2022 00:38
I've got a feeling we're going to be seeing more of this.
19:08 < Aloveth> Hi, Linode. Can i pay by JCB or UnionPay card?
19:09 -!- bencc1 [~bencc1@2a00:a040:197:3af:b3ae:86f:9c41:32fd] has quit [Ping timeout: 480 seconds]
19:11 < file> payment methods are on the site, https://www.linode.com/docs/guides/how-linode-billing-works/#payment-methods
19:11 < file> JCB or UnionPay are not directly in that list
19:15 -!- Aloveth [~oftc-webi@85.140.93.69] has quit [Remote host closed the connection]
19:20 -!- Aloveth [~oftc-webi@85.140.93.69] has joined #linode
19:20 < Aloveth> Hi, Linode. Can i pay by UnionPay card?
19:21 < file> payment methods are on the site, https://www.linode.com/docs/guides/how-linode-billing-works/#payment-methods
19:21 < file> JCB or UnionPay are not directly in that list
19:21 < Aloveth> Will you update list?)
@waltman
waltman / gnome-crash.txt
Last active February 12, 2021 01:11
/var/log/syslog when gnome crashed after apt upgrade of libgnome-autoar-0-0 libgnome-autoar-gtk-0-0 libsqlite3-0 libsqlite3-dev sqlite3 wpasupplicant
Feb 11 19:42:41 scruffy dbus-daemon[1908]: [system] Reloaded configuration
Feb 11 19:42:41 scruffy dbus-daemon[1908]: message repeated 2 times: [ [system] Reloaded configuration]
Feb 11 19:42:41 scruffy systemd[1]: Reloading.
Feb 11 19:42:41 scruffy systemd[1]: /lib/systemd/system/plymouth-start.service:17: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'. Support for KillMode=none is deprecated and will eventually be removed.
Feb 11 19:42:41 scruffy systemd[1]: /lib/systemd/system/dbus.service:12: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'. Support for KillMode=none is deprecated and will eventually be removed.
Feb 11 19:42:41 scruffy systemd[1]: /lib/systemd/system/rpc-statd.serv
@waltman
waltman / wrap-tex-region.el
Created March 1, 2020 20:19
Wrapping a region with a TeX command in elisp
(defun wrap-tex-region (cmd)
"Wraps the region in a TeX command"
(interactive "*")
(exchange-point-and-mark)
(insert "\\" cmd "{")
(exchange-point-and-mark)
(insert "}")
)
(defun emph-region ()
@waltman
waltman / sieve.py
Created December 12, 2019 00:31
Find all the 4-digit primes containing only the digits 1,3,7
import math
import re
def sieve(upto):
primes = set(range(2,upto+1))
for i in range(2, int(math.sqrt(upto)+1)):
if i in primes:
primes -= set(range(i**2, upto, i))
return list(primes)
@waltman
waltman / watch-http.pl
Created September 6, 2019 18:48
Script to check list of websites and report if any have changed
#!/usr/local/bin/perl -w
# $Id: watch-http,v 1.3 2007/03/26 11:58:59 waltman Exp $
use strict;
use LWP::Simple;
my $dir = "$ENV{HOME}/.watch-http";
chdir $dir
or die "Can't chdir to $dir: $!\n";
@waltman
waltman / plug-announce.pl
Created June 11, 2019 00:23
cronjob script to warn me to send out a plug-announce email
#!/usr/local/bin/perl
# send out a warning email if it's $N days before a PLUG meeting
use strict;
use warnings;
use feature qw(:5.30);
use experimental qw(signatures);
use Date::Manip;
my $N = 3;
#!/usr/bin/env python3
# PLUG North is on the 2nd Tueday of the month, and PLUG Central
# is on the 1st Wednesday of the month. North is always the Tuesday
# after Central unless, like in May 2019, the first of the month is
# a Wednesday. I argued that this only happens 1/7 of the time. This
# is an attempt to demonstrate it programmatically.
def months_starting_on_wed(jan1, year):
days_in_month = [