Skip to content

Instantly share code, notes, and snippets.

View briandfoy's full-sized avatar

brian d foy briandfoy

View GitHub Profile
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use Net::Amazon::AWSSign;
use XML::XPath;
use XML::XPath::XMLParser;
#!/usr/bin/perl
my $start = time;
system { $ARGV[0] } @ARGV; # See the Security chapter!
my $end = time;
printf "The whole time was %d seconds\n", $end - $start;
non forking
path-tiny.pl: 15 lines, 217 characters.
mango@the-perl-review[~]$ perl5.10.1 path-tiny.pl dp-dump.mysql
Rate b h j i a l k g f d e c
b 1137/s -- -7% -11% -11% -11% -11% -12% -12% -12% -12% -13% -13%
h 1218/s 7% -- -4% -4% -5% -5% -5% -5% -5% -6% -6% -6%
j 1273/s 12% 4% -- 0% -1% -1% -1% -1% -1% -2% -2% -2%
i 1273/s 12% 4% 0% -- -1% -1% -1% -1% -1% -2% -2% -2%
<?xml version="1.0" encoding="UTF-8"?>
<!-- OPML generated by NetNewsWire -->
<opml version="1.1">
<head>
<title>mySubscriptions</title>
</head>
<body>
<outline text="Questions tagged perl - Stack Overflow" description="" title="Questions tagged perl - Stack Overflow" type="rss" version="RSS" htmlUrl="http://stackoverflow.com/questions/tagged/?tagnames=perl&amp;amp;sort=active" xmlUrl="http://stackoverflow.com/feeds/tag/perl"/>
<outline text="perl.modules" description="" title="perl.modules" type="rss" version="RSS" htmlUrl="http://www.nntp.perl.org/group/perl.modules/" xmlUrl="http://www.nntp.perl.org/rss/perl.modules.rdf"/>
<outline text="Perl" description="" title="Perl" type="rss" version="RSS" htmlUrl="http://www.reddit.com/r/perl/" xmlUrl="http://www.reddit.com/r/perl/.rss"/>
@briandfoy
briandfoy / perl_file_finder.pl
Created May 17, 2013 15:05
Find all the perl files
use v5.10;
use File::Find qw(find);
use File::MMagic;
my $MM = File::MMagic->new;
my $files = [];
say "ARGV [@ARGV]";
find( generator( $files ), @ARGV );
@briandfoy
briandfoy / get_file_digests
Created May 26, 2013 03:23
Collect the file digests from the Perl files in @inc of the invoking Perl
use Digest::SHA;
use Digest::MD5;
use File::Find;
use File::Spec::Functions qw(no_upwards canonpath);
DIR: foreach my $dir ( @INC ) {
next if $dir =~ /\A\.\.?\Z/;
my( $wanted, $files ) = find_regular_files();
use v5.10;
use Email::MIME;
use File::Basename;
my $message = do { local $/; <> };
my $parsed = Email::MIME->new( $message );
my $count = 1;
foreach my $part ( $parsed->parts ) {
@briandfoy
briandfoy / add_travis_yml.pl
Created August 17, 2013 08:36
Put .travis.yml files in all my git repos
#!/usr/bin/perl
use v5.10;
use utf8;
binmode STDOUT, ':encoding(UTF-8)';
binmode STDERR, ':encoding(UTF-8)';
use File::Basename qw(dirname);
use File::Spec::Functions qw(catfile);
#!perl
use v5.14;
use strict;
use Module::Extract::Namespaces;
LINE: while( <> ) {
chomp;
my @namespaces = Module::Extract::Namespaces->from_file($_);
if( @namespaces == 1 ) {