I wrote some code to help with the https://voat.co/v/QRV/3745232 post, titled "Did James Comey use a grille cipher to place a hit on Bobby Kennedy's granddaughter and her son via Twitter or is this just another weird coincidence?" (and also posted it there as a comment).
I'll copy it below. I should really put it on a site to make it easier but then of course it'd be easier to attack. This way, you can run it locally. Run it like:
perl find-word.pl maeve fahey kennedy townsend gideon mckean
and it'll give this output:
Searching ["Our national identity is being remade in real time. What had once seemed a bitter and divided society now seems more like a nation of people finding creative ways to show up for one another." - @nytdavidbrooks]
Searching for [maeve]: found.
Searching for [fahey]: found.
Searching for [kennedy]: found.
Searching for [townsend]: found.
Searching for [gideon]: found.
Searching for [mckean]: found.
Returning [1] ALL FOUND
I put Comey's tweet in as the default text; you can change the text to search by adding "--text='the text to search'".
Note that I didn't code anything to do with the grille cipher; this script just helps with the search for word(s) within a larger text, each word of which might be broken up.
The search matches regardless of whether the letter is capitalized or not.
Code is below, in a "code" block so hopefully it's copy/paste-able (verified during preview; this should work). Also neat that I recorded the time I started as well, so I can say that this took less than an hour to write (the comment, and this post, took longer :) ).
#!/usr/bin/perl
=head1 find-word.pl
This script will search text for specified words; the words might be broken up.
Author: unknown :)
Date: 2020-04-04 Sat 11:27
=cut
=head2 ALWAYS USE STRICT AND WARNINGS
=cut
use strict;
use warnings;
=head2 MODULES USED FROM CPAN
=cut
use Getopt::Long;
=head2 MODULES WRITTEN IN-HOUSE
=cut
=head2 VARIABLE DECLARATIONS
=cut
my $verbose = 0; # invoke with "--verbose" to turn on more output.
my @words; # word(s) to search for, might be broken up.
my $comey = "\"Our national identity is being remade in real time. What had once seemed a bitter and divided society now seems more like a nation of people finding creative ways to show up for one another.\" - \@nytdavidbrooks";
my $string = $comey; # string to search within.
=head2 SUBROUTINE DECLARATIONS
=cut
sub main();
=head2 MAIN FUNCTION
Note that we first call setup_aspect_log(), and THEN exit main() -- previously I had the call to setup_aspect_log() inside the
main() sub, so it wasn't showing "Entering" and "Leaving" main(); now it will.
=cut
exit main();
=head2 SUBROUTINE DEFINITIONS
=cut
=head2 main
Main routine, which will try to find a word in another string. Exits with errorlevel 0 if found, 1 otherwise.
=cut
sub main() {
# Return code; default to failure.
my $rc = -1;
# First, validate our options.
GetOptions( "verbose" => \$verbose,
"word=s" => \@words,
"string=s" => \$string,
) or die "Error in command line arguments.\n";
# Any remaining bare args should go into @words.
push @words, @ARGV;
# Check that we have a word and string passed in.
if ( scalar @words == 0 or !defined $string ) {
die "Error: must define both 'word' and 'string'.";
}
# Get the results, and display them (in the subroutine).
my $found = find_words_in_string( $string, @words );
return $found ? 0 : 1; # errorlevel is basically reverse of the truth :)
}
=head2 find_word_in_string
Given a string and one or more words, see if each word is in the string.
Returns true if all were found, false if not.
=cut
sub find_words_in_string($@) {
my ($string, @words) = @_;
print "Searching [$string]\n";
my $rc = 0; # default to failure
# Planning this out, I think I can do this with a regex. Just add ".*" between each character of $word, then search.
# Wrap that in a loop for each word, and we're good.
my $prev_found = 1; # initially success
foreach my $w ( @words ) {
my @word = split //, $w;
my $search = join ".*", @word;
my $is_in = $string =~ /$search/i;
print " Searching for [$w]: " . ($is_in ? "" : "NOT ") . "found.\n";
if ( $prev_found ) {
if ( $is_in ) {
$rc = 1;
} else {
$rc = $prev_found = 0; # will return failure; however, continue searching for other words.
}
}
}
print "Returning [$rc] " . ($rc ? "ALL FOUND" : "NOT all found") . ".\n";
return $rc;
}
I posted the above (slightly different, as I updated it now for a post) in a comment here: https://voat.co/v/QRV/3745232/23235460
God bless and stay safe everyone!
view the rest of the comments →
23237226? ago
I see a lot of effort and technical interest, but as a regular person I cannot find any relateable INFORMATION which leads to any conclusion regrading anything.
EXPLAIN please what the hell the purpose of this exercise is.
23237849? ago
To make it easier to data-mine Comey's tweets. And other tweets.
"Learn our comms" etc.
I bought NMBRFG a laptop for Christmas because he demonstrated that he had learned the gematria comms. This is a different form of comm.
See https://voat.co/v/QRV/3745232 for the reason I'm doing this.