Acme-KeyboardMarathon
view release on metacpan or search on metacpan
marathon.pl view on Meta::CPAN
use warnings;
my $akm = new Acme::KeyboardMarathon
layout => $ARGV[0] =~ /^--\w/ ? substr shift(@ARGV), 2 : 'qwerty';
our @ARGV;
my $total = Math::BigInt->bzero();
for my $file ( @ARGV ) {
print STDERR "Skipping [$file] as it is not a file\n" and next unless -f $file;
print STDERR "Skipping [$file] as it is a binary file\n" and next if $file =~ /\.(gif|gz|jpe?g|png|tar)$/o or -B $file;
print STDERR "Skipping [$file] as it is likely a git binary file\n" and next if $file =~ /\.git\//;
print STDERR "Reading [$file]\n";
open INFILE, '<', $file;
while ( my $line = <INFILE> ) {
$total += $akm->distance($line);
}
close INFILE;
}
if ( $total > 100000 ) {
source-tree-marathon.pl view on Meta::CPAN
$base_dir = abs_path($ARGV[0]);
}
unless ( $base_dir ) {
print STDERR "Usage: ./source-tree-marathon.pl /source/directory/to/crawl > report.txt\n";
exit 1;
}
### Constants
my $skip_file_extension_regex = qr{\.(binmode|bmp|docx|exe|gif|gz|ico|jar|jpe?g|o|obj|pdf|png|pptx|pyc|so|tar(\.xz)?|tiff?|tgz|ttf|vsd|zip)$};
my $skip_dirs_regex = qr/^(\.git|tpc|debian|linux-kernel)/;
### Bootstrap
my %data;
if ( -f $dbfile ) {
print STDERR "Reusing file: $dbfile\n";
} else {
( run in 1.152 second using v1.01-cache-2.11-cpan-df04353d9ac )