Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Profanity search command line tool.
#!/usr/bin/env bash
set -Eeuo pipefail
perl -e '
use Bad::Words;
my $wordref = new Bad::Words;
my $updated = $wordref->remove(qw(
my $regex = join("|", @$updated);
print qq{\\b($regex)\\b}')
# Mac only allows ~5k open files by default
ulimit -Sn 10000
# Search all files except for binaries. That is what the file/awk
# lines are doing here: filtering out binary files.
# cf
find . \
-not -name "*.min.*" \
-not -name "*bootstrap*" \
-not -name "*jquery*" \
-not -name "*lodash*" \
-type f \
-exec file {} + \
| awk -F: '/ASCII text/ {print $1}' \
| parallel -k -j6 -n 4 -m "ack --group --color --nofilter \"${profane_regex}\"" {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment