Skip to content

Instantly share code, notes, and snippets.

@hobgoblina
Last active March 22, 2025 11:44
Show Gist options
  • Save hobgoblina/1eea65e782e00868c693063a9effcd1f to your computer and use it in GitHub Desktop.
Save hobgoblina/1eea65e782e00868c693063a9effcd1f to your computer and use it in GitHub Desktop.
anti-capital shell script ... lowercase + convert camel to snake_case for everything in the current or provided directory and recursively in all subdirectories without discretion. will break binaries and hashes - this is intended because they were a function of capital
#!/bin/bash
dir=$(pwd)/$1
if [[ $1 = /* ]]; then
dir=$1
fi
regex='s/\([a-z0-9]\)\([A-Z]\)/\1_\2/g;s/\([A-Z0-9]\)\([A-Z0-9]\)\([a-z]\)/\1_\2\3/g;s/\(.*\)/\L\1/g'
find $dir -type f -exec sed -i -e $regex {} \;
@hobgoblina
Copy link
Author

hobgoblina commented Feb 28, 2023

in case you couldn't tell from the name/description, this was made as an anti-capitalism joke. don't actually use this unless you fully understand the consequences from reading the script

@surajsharma
Copy link

lmao this ought to blow up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment