Various shell scripts that are useful enough to me to keep in my PATH
Find a file
2024-10-26 14:04:02 -07:00
.gitignore Add .gitignore 2024-10-26 14:00:39 -07:00
bates Auto-update: Sat Oct 26 13:45:39 PDT 2024 2024-10-26 13:45:39 -07:00
cf Auto-update: Tue Jul 30 19:48:25 PDT 2024 2024-07-30 19:48:25 -07:00
checknode Auto-update: Tue Jul 30 19:30:24 PDT 2024 2024-07-30 19:30:24 -07:00
comfy Auto-update: Tue Jul 30 19:30:24 PDT 2024 2024-07-30 19:30:24 -07:00
ddns Auto-update: Tue Jul 30 19:48:25 PDT 2024 2024-07-30 19:48:25 -07:00
delpycache added delpycache for deleting all __pycache__ folders in current folder and its subfolders 2024-06-23 14:06:44 -07:00
emoji-flag Auto-update: Tue Jul 30 19:30:24 PDT 2024 2024-07-30 19:30:24 -07:00
get Auto-update: Tue Jul 9 16:15:05 PDT 2024 2024-07-09 16:15:05 -07:00
getreq Auto-update: Tue Jul 30 19:30:24 PDT 2024 2024-07-30 19:30:24 -07:00
gitpurge Auto-update: Tue Jul 30 20:55:02 PDT 2024 2024-07-30 20:55:02 -07:00
gitscan routine update 2024-08-03 00:22:15 -07:00
import-finder Auto-update: Tue Jul 30 19:30:24 PDT 2024 2024-07-30 19:30:24 -07:00
kip Auto-update: Mon Aug 5 19:11:27 PDT 2024 2024-08-05 19:11:27 -07:00
kip-simple Auto-update: Mon Aug 5 19:11:27 PDT 2024 2024-08-05 19:11:27 -07:00
lsd Auto-update: Tue Jul 30 19:30:24 PDT 2024 2024-07-30 19:30:24 -07:00
mamba-exporter Auto-update: Tue Jul 30 19:30:24 PDT 2024 2024-07-30 19:30:24 -07:00
mamba-importer Auto-update: Tue Jul 30 19:30:24 PDT 2024 2024-07-30 19:30:24 -07:00
murder Auto-update: Tue Jul 30 19:30:24 PDT 2024 2024-07-30 19:30:24 -07:00
nocomment Add nocomment 2024-10-08 06:40:59 +02:00
noon first commit 2024-06-23 13:47:43 -07:00
nv first commit 2024-06-23 13:47:43 -07:00
o Auto-update: Tue Jul 30 19:30:24 PDT 2024 2024-07-30 19:30:24 -07:00
pf Auto-update: Wed Jun 26 10:08:59 PDT 2024 2024-06-26 10:08:59 -07:00
pippin routine update 2024-08-03 00:22:15 -07:00
pull Auto-update: Sat Aug 3 12:14:26 PDT 2024 2024-08-03 12:14:26 -07:00
README.md Auto-update: Sat Oct 26 14:04:02 PDT 2024 2024-10-26 14:04:02 -07:00
serv first commit 2024-06-23 13:47:43 -07:00
sij Auto-update: Thu Aug 8 15:55:31 PDT 2024 2024-08-08 15:55:31 -07:00
summarize Auto-update: Tue Jul 30 19:30:24 PDT 2024 2024-07-30 19:30:24 -07:00
tmux-merge first commit 2024-06-23 13:47:43 -07:00
txt-line-merge-abc Auto-update: Tue Jul 30 19:48:25 PDT 2024 2024-07-30 19:48:25 -07:00
txtsort Auto-update: Tue Jul 30 19:30:24 PDT 2024 2024-07-30 19:30:24 -07:00
uninstall first commit 2024-06-23 13:47:43 -07:00
up Auto-update: Sat Aug 3 12:14:26 PDT 2024 2024-08-03 12:14:26 -07:00
vitals Auto-update: Mon Sep 23 13:17:54 PDT 2024 2024-09-23 13:17:54 -07:00
vpn Auto-update: Tue Aug 6 14:39:31 PDT 2024 2024-08-06 14:39:31 -07:00
z Auto-update: Tue Jul 30 19:30:24 PDT 2024 2024-07-30 19:30:24 -07:00

PATH-worthy Scripts

Hey folks, this repo is just a collection of various scripts I use frequently enough to justify keeping them in my system PATH. I haven't written documentation for all of these scripts. I might in time. For now, here's just a few highlights.

bates

A simple Python-based utility for extracting Bates numbers from PDF documents and optionally renaming files based on those numbers. Particularly useful for organizing legal documents or any PDFs with sequential numbering.

Overview

This tool helps you:

  • Extract Bates numbers from PDFs (both text-based and scanned documents)
  • Rename files based on their Bates number range
  • Preserve original filenames in macOS Finder comments
  • Process entire folders of PDFs in one go
  • Prepare files for use with my Bates Source Link DEVONthink script

Installation

  1. Install Python dependencies:
pip3 install pdfplumber

If you plan to use OCR capabilities, also install:

pip3 install pytesseract pdf2image
  1. For OCR support, install system dependencies:

On macOS:

brew install tesseract poppler

On Ubuntu/Debian:

sudo apt-get install tesseract-ocr poppler-utils

Basic Usage

Test extraction without renaming files:

python3 bates.py /path/to/folder --prefix "FWS-" --digits 6 --dry-run

Rename files based on Bates numbers:

python3 bates.py /path/to/folder --prefix "FWS-" --digits 6 --name-prefix "FWS "

Options

  • --prefix: The Bates number prefix to search for (default: "FWS-")
  • --digits: Number of digits after the prefix (default: 6)
  • --ocr: Enable OCR for scanned documents
  • --dry-run: Test extraction without renaming files
  • --name-prefix: Prefix to use when renaming files
  • --log: Set logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)

Notes

  • Always test with --dry-run first
  • Original filenames are preserved in Finder comments (macOS only)
  • OCR is disabled by default to keep things fast

vpn

A command-line utility for managing Tailscale exit nodes with privacy-focused features.

Overview

This tool helps you:

  • Start and stop Tailscale exit nodes
  • Select new exit nodes automatically
  • Choose random exit nodes from privacy-friendly countries
  • Verify successful connections using Mullvad's API

Requirements

  • Python 3
  • Tailscale installed and configured
  • requests Python package

Install dependencies:

pip3 install requests

Usage

python3 vpn.py <action>

Available Actions

  • start: Connect to a suggested exit node if not already connected
python3 vpn.py start
  • stop: Disconnect from current exit node
python3 vpn.py stop
  • new: Switch to a new suggested exit node
python3 vpn.py new
  • shh: Connect to a random exit node in a privacy-friendly country
python3 vpn.py shh

Privacy Features

The script considers the following countries as privacy-friendly for the shh command:

  • Sweden
  • Switzerland
  • Germany
  • Finland
  • Netherlands
  • Norway

Configuration

The script uses these default Tailscale arguments:

  • --exit-node-allow-lan-access: Allow access to LAN while using exit node
  • --accept-dns: Use DNS settings from the exit node
  • --accept-routes: Accept advertised routes from the exit node

Verification

The script verifies successful connections by:

  1. Checking Tailscale's reported exit node
  2. Verifying the connection using Mullvad's API
  3. Confirming the hostnames match

Examples

Start using an exit node:

$ python3 vpn.py start
Suggested exit node: stockholm.ts.net
Current exit node hostname: stockholm
Exit node set successfully!

Switch to a privacy-focused node:

$ python3 vpn.py shh
Selected random privacy-friendly exit node: zurich.ts.net
Current exit node hostname: zurich
Exit node set successfully!

Notes

  • The script requires an active Tailscale configuration
  • Internet connectivity is required for verification
  • Some commands may require administrative privileges