Skip to content

Instantly share code, notes, and snippets.

@jigpu
jigpu / wacom-gnome-compat.sh
Last active October 12, 2025 06:52
Script to remap pad buttons on consumer (Bamboo) Wacom devices to be compatible with GNOME
#!/bin/bash
# Consumer Wacom devices (i.e. most Bamboo devices like the Bamboo Pen & Touch,
# Bamboo Fun, Bamboo Connect; and the newer non-pro Intuos devices like the
# Intuos Draw and Intuos Art) have a hardware button mapping that is incompatible
# with GNOME. This incompatibility prevents the GNOME Control Center's Wacom panel
# from working properly, and often also prevents at least one button from working
# entirely.
#
# This script can be used to discover a software mapping that can be applied by
@jigpu
jigpu / crypt-squashfs.sh
Created October 29, 2019 18:03
LUKS encrypt a squashfs disk image
#!/bin/sh
# https://martin.elwin.com/blog/2008/05/backups-with-squashfs-and-luks/
set -e
SQUASHFS_IMG="$1"
LUKS_IMG="$2"
CRYPTNAME=mkcrypt-$RANDOM
CRYPTDEV="/dev/mapper/$CRYPTNAME"
@jigpu
jigpu / dump_bos_descriptors.py
Last active July 23, 2025 10:40
Scan the USB bus and print out the BOS descriptors for each device, if they exist.
#!/usr/bin/python3
# dump_bos_descriptors.py
#
# Scan the USB bus and print out the BOS descriptors for each device, if
# they exist. Alternatively, decode and print out the BOS descriptor that
# is passed in via stdin.
#
# Usage: `./dump_bos_descriptors.py [< binary]`
#
@jigpu
jigpu / wacom_app_config.sh
Last active November 29, 2024 07:38
Apply application-specific profiles with xsetwacom on Linux
#!/bin/bash
# wacom_app_config.sh
#
# BASH script to automatically run change Wacom driver config
# based on the focused application.
#
# Limited support for use under GNOME and its forks due to the
# way it does its own device/took configuration, but should work
# fine elsewhere. It may be possible to use the power of dconf
@jigpu
jigpu / c4000-ssid.sh
Created January 2, 2024 18:36
Set the SSID / password on C4000BG DSL modems
#!/bin/bash
# Set the SSID / password on C4000BG DSL modems
#
# WARNING: This script does no sanity checking! It does not check
# that the SSID is available, or that it is even well-formed (i.e.
# 32 octets or less in length). Be careful!
set -e
@jigpu
jigpu / usbmon-annotate.awk
Created November 7, 2023 19:59
AWK script to make some usbmon events a bit more readable
# AWK script to annotate output from usbmon
#
# Usage: `awk -f usbmon-annotate.awk < usbmon.log`
#
# Output: If possible, each line of usbmon output will have a human-
# readable description of what it is printed out immediately before
# the usbmon line itself.
#
# For example, the following INPUT:
#
@jigpu
jigpu / compare-commit-upstream.sh
Created August 30, 2023 17:56
Compare a commit in the current (input-wacom) repository with its upstream source.
#!/bin/bash
# compare-commit-upstream.sh
#
# Given a commit ID in the current repository, find the corresponding
# upstream commit and print out the difference, if any. If no upstream
# commit can be found, print a message and exit with code 0.
#
# Usage: ./compare-commit-upstream.sh <local-git-commit-id>
#!/bin/bash
# Perform a distributed kernel build using icecream and a specific compiler
# version.
#
# For example, you might set SUFFIX=-12 to build with the "gcc-12" compiler.
SUFFIX=
export PATH=/usr/lib/icecream/bin:$PATH
@jigpu
jigpu / btreset.sh
Created December 19, 2020 20:11
Raspberry Pi Bluetooth Watchdog / Reset
#!/bin/sh
# Force a reset of the Bluetooth interface if it freezes up.
#
# https://github.com/raspberrypi/linux/issues/2832#issuecomment-597001597
if test $(id -u) -ne 0; then
echo "This script must be run as root."
exit 1
fi
@jigpu
jigpu / gpx-to-flightbook-csv.sh
Last active March 19, 2023 17:41
GPX to CSV converter for MyFlightBook
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "GPX to CSV converter for MyFlightBook"
echo
echo "Converts a GPX file (e.g. from a handheld GPS unit) into a CSV file that"
echo "can be imported into MyFlightBook. Performs basic data filtering, event"
echo "detection, etc."
echo
echo "Usage: $0 <start> <stop>"