Skip to content

Instantly share code, notes, and snippets.

require 'fileutils'
# For use in cleaning scanned book/magazine/etc pages and preparing the scans
# for distribution/OCR.
#
# Assume you've been scanning a book as double-page scans. You can
# automatically split them into two files via ImageMagick `mogrify`:
#
# mogrify -path "./Auto-Halved Pages" -format png -crop 50%x100% +repage "./Double-Page Scans/*.png"
#
@Snarp
Snarp / pathname_core_ext.rb
Created February 27, 2025 16:25
Extends Pathname to add #stemname instance method
# Extends Pathname to add #stemname instance method
class Pathname
# "dir/subdir/filename1.ext" => "filename1"
def stemname
bs = basename.to_s
bs.slice(0,bs.length-extname.length)
end
end
@Snarp
Snarp / linux_bash_screenshot_examples.bash
Created April 25, 2025 20:10
Linux Bash screenshot examples: gnome-screenshot & scrot
#!/bin/bash
STRFTIME="%Y-%m-%d %H-%M-%S %3N" # 2025-01-01 13:01:01 001
DIR="$HOME/Pictures/Screenshots"
EXTNAME="jpg"
FILENAME="$DIR/$(date +"$STRFTIME").$EXTNAME"
# echo "$FILENAME"
mkdir -p "$DIR"

Cinnamon Keyboard Shortcuts GUI Settings Tool Isn't Working

  • 2025-04-28
  • Linux Mint 22.1, Cinnamon v6.4.8

cinnamon-settings keyboard will not let me remap Alt+Print to a better screenshot tool. Let's figure out why.

Exporting / Importing / Backing Up Keybindings