From f2206037d5f0ad4401ec69633841233e6e7dd0d4 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Tue, 28 Jul 2026 11:02:17 -0400 Subject: [PATCH] [fish] Add rustup config --- bin/.local/bin/tile2letter.sh | 67 ++++++++++++++++++++++++++++ fish/.config/fish/conf.d/rustup.fish | 1 + 2 files changed, 68 insertions(+) create mode 100755 bin/.local/bin/tile2letter.sh create mode 100644 fish/.config/fish/conf.d/rustup.fish diff --git a/bin/.local/bin/tile2letter.sh b/bin/.local/bin/tile2letter.sh new file mode 100755 index 0000000..6a3e322 --- /dev/null +++ b/bin/.local/bin/tile2letter.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +set -e + +usage() { + echo "Usage: tile-letter IMAGE [dpi=300] [overlap_inches=0] [orientation=portrait|landscape] [pdf=yes]" + exit 1 +} + +command -v magick >/dev/null || { echo "ImageMagick required"; exit 1; } +command -v img2pdf >/dev/null || { echo "img2pdf required (optional if pdf=no)"; } + +input="$1" +dpi="${2:-300}" +overlap_in="${3:-0}" +orientation="${4:-landscape}" +make_pdf="${5:-yes}" + +[[ -f "$input" ]] || usage + +base=$(basename "$input") +name="${base%.*}" + +# Letter size in inches +portrait_w=8.5 +portrait_h=11 + +if [[ "$orientation" == "landscape" ]]; then + letter_w=11 + letter_h=8.5 +else + letter_w=$portrait_w + letter_h=$portrait_h +fi + +tile_w=$(awk "BEGIN {print int($letter_w * $dpi)}") +tile_h=$(awk "BEGIN {print int($letter_h * $dpi)}") + +overlap_px=$(awk "BEGIN {print int($overlap_in * $dpi)}") + +echo "Input: $input" +echo "DPI: $dpi" +echo "Orientation: $orientation" +echo "Page size: ${tile_w}x${tile_h}" +echo "Overlap: ${overlap_in}in (${overlap_px}px)" + +mkdir -p "${name}_tiles" + +crop_w=$((tile_w + overlap_px)) +crop_h=$((tile_h + overlap_px)) + +magick "$input" \ + -crop ${crop_w}x${crop_h} \ + -background white \ + -gravity northwest \ + -extent ${tile_w}x${tile_h} \ + +repage \ + "${name}_tiles/${name}_%03d.jpg" + +echo "Tiles written to ${name}_tiles/" + +if [[ "$make_pdf" == "yes" ]]; then + pdf="${name}_poster.pdf" + img2pdf "${name}_tiles"/*.jpg -o "$pdf" + echo "PDF written to $pdf" +fi + diff --git a/fish/.config/fish/conf.d/rustup.fish b/fish/.config/fish/conf.d/rustup.fish new file mode 100644 index 0000000..e4cb363 --- /dev/null +++ b/fish/.config/fish/conf.d/rustup.fish @@ -0,0 +1 @@ +source "$HOME/.cargo/env.fish"