Skip to content

Instantly share code, notes, and snippets.

@jikamens
jikamens / namecheap-dns.py
Last active February 13, 2024 10:54
namecheap-dns.py - Export/import DNS records from/to Namecheap
#!/usr/bin/env python3
"""
namecheap-dns.py - Export/import DNS records from/to Namecheap
This script can export DNS records from a domain in Namecheap to a YAML file or
import records from a YAML file in the same format into Namecheap. I use this
script to maintain my Namecheap DNS records in a source repository with change
history, i.e., "configuration as code" for my Namecheap DNS records.
@jikamens
jikamens / browserAction.html
Created September 18, 2023 18:56
messenger.mailTabs.getSelectedMessages() demo
<!DOCTYPE html>
<html>
<body>
<div id="messageList">
</div>
<script src="browserAction.js"></script>
</body>
</html>
@jikamens
jikamens / server-sucker.el
Last active August 29, 2023 00:16
Keep the Emacs server running in the Emacs in the current active systemd session
;; Copyright 2023 Jonathan Kamens <jik@kamens.us>.
;;
;; This program is free software: you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by the Free
;; Software Foundation, either version 3 of the License, or (at your option)
;; any later version. See <https://www.gnu.org/licenses/>.
;;
;; This program is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
@jikamens
jikamens / deposit_notification.cgi
Last active July 13, 2023 13:58
Scripts and configs for "enhancing" Eastern Bank emailed deposit notifications
#!/bin/bash -e
TF=/fillmein/deposit_notification.$$
trap "rm -f $TF" EXIT
echo "Content-type: message/rfc822"
echo
if /fillmein/eastern-deposit-notification.py >| $TF; then
cat $TF
@jikamens
jikamens / toodledo-agenda.py
Last active June 26, 2023 15:33
toodledo-agenda.py - Prepare your daily agenda in Toodledo
#!/usr/bin/env python3
'''toodledo-agenda.py - Prepare your daily agenda in Toodledo
Toodldeo doesn't _quite_ do the right thing, at least for me, whether I sort by
date and then priority, or by priority and then date.
* If I sort by date first, then top-priority items that aren't due by a
specific date get pushed all the way to the bottom of my to-do list and I
never see them.
#!/bin/bash -e
# This script reads a dpkg.log fragment, identifies all of the
# packages upgraded in it, finds and downloads the pre-upgrade
# versions of those packages from Launchpad, and installs them,
# downgrading the system to approximately the state it was in before
# the packages were upgraded.
#
# To use it, copy the section of /var/log/dpkg.log containing the
# upgrade you want to undo into a new file, remove the lines
@jikamens
jikamens / scan-bill.sh
Last active June 26, 2023 15:28
Demonstration of how to automatically scan and file bills
#!/bin/bash -e
WHOAMI=$(basename $0)
DEV_FILE=$HOME/.scan-bill.dev
RETRY=false
MULTIPLE=false
DUPLEX_SOURCE='Automatic Document Feeder(centrally aligned,Duplex)'
SIMPLEX_SOURCE='Automatic Document Feeder(centrally aligned)'
SOURCE="$DUPLEX_SOURCE"
STARTED=false
@jikamens
jikamens / bitwarden-backup.py
Created June 26, 2023 15:10
Simple script for backing up your Bitwarden vault using the Bitwarden CLI
#!/usr/bin/env python3
# Simple script for backing up your Bitwarden vault using the Bitwarden CLI
#
# Copyright 2021 Jonathan Kamens <jik@kamens.us>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
@jikamens
jikamens / bwsc-usage.py
Created June 16, 2023 21:22
Check your daily Boston Water (BWSC) usage and alert about potential leaks
#!/usr/bin/env python3
"""
Check your daily Boston Water (BWSC) usage and alert about potential leaks
This script logs into the Boston Water and Sewer Commission customer portal
using the Chrome Selenium driver, downloads your daily usage for the past 30
days, and prints a warning if the most recent daily usage number is more than
three standard deviations higher than the mean of all the usage numbers. This
@jikamens
jikamens / find_perl_module.py
Created March 9, 2023 17:12
Ansible module to figure out from where to install Perl modules
#!/usr/bin/python
# Copyright: (c) 2023, Jonathan Kamens <jik@kamens.us>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = r'''
---
module: find_perl_module