Skip to content

Instantly share code, notes, and snippets.

@jikamens
jikamens / perms.sh
Created January 20, 2026 14:00
script to toggle WordPress permissions before and after updates
#!/bin/bash -e
TOPDIR=FILLMEIN
OWNER=FILLMEIN
DIRS="
wp-content/plugins/wordfence/tmp
wp-content/uploads
wp-content/wfcache
wp-content/wflogs
wp-content/cache
@jikamens
jikamens / 1password-from-bitwarden-backup.py
Last active January 17, 2026 19:07
Script to import output of bitwarden-backup.py into 1Password
#!/usr/bin/env python3
# Script for importing bitwarden-backup.py output into 1Password
#
# Previously, I wrote and shared bitwarden-backup.py, a script for exporting
# a comprehensive backup of your private and organization Bitwarden data,
# including attachments:
#
# https://gist.github.com/jikamens/15f4b25cec019cb81ddeeee8dacbcfb9
#
@jikamens
jikamens / mastodon-filters-manage.py
Last active January 3, 2026 19:37
Python script to export or import Mastodon filters
#!/usr/bin/env python3
# Export or import Mastodon filters
#
# This script exports or imports filters from your Mastodon account.
# To use it, you first need to create an "Application" in your
# Mastodon account with read:filters and write:filters scopes; if you
# just want to export, you only need read:filters. Go to Preferences
# -> Development in the Mastodon web UI to do this. Then click on the
# newly created application and copy its access token, since that's
#!/usr/bin/env python3
# Script to solve "Kitchen Sorting" puzzles at GameSnacks.com
# (https://gamesnacks.com/games/757entlesmh4g) but presumably generalizable
# to any similar sorting game.
#
# Define the puzzle by creating a text file where each line in the file
# represents a tube in the game and is either a single hyphen to indicate that
# the tube starts empty or a whitespace separated list of the items in the
# tube. Change the `puzzle_file` variable below to the file name containing the
@jikamens
jikamens / nas-botnet-complaint.pl
Created March 21, 2025 21:59
script for generating complaints about botnets attacking a Synology NAS
#!/usr/bin/env perl
# Script for pulling "admin" login failure logs from a Synology NAS and
# generating complaint emails to the abuse contacts for the IP addresses in the
# logs.
#
# You need to have the NAS set up so that you can SSH into it as root to be
# able to use this script. Follow the instructions here to enable SSH to the
# admin accounts:
# https://kb.synology.com/en-us/DSM/tutorial/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet
@jikamens
jikamens / cups_conf.py
Created December 29, 2024 02:04
Ansible module for editing CUPS config files such as printers.conf
#!/usr/bin/python3
# Copyright (c) 2024, Jonathan Kamens <jik@kamens.us>
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
import copy
import os
import re

The canonical location of this list has moved here.

@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 / bitwarden-backup.py
Last active January 7, 2026 15:29
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-2023,2024,2026 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 / server-sucker.el
Last active August 27, 2025 15:33
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