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;
<?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 ) {
@briandfoy
briandfoy / excel-attributes.pl
Last active December 26, 2015 10:59
A demonstration of Excel::Writer::XLSX applied to an exercise from Learning Perl.
#!/usr/bin/perl
use v5.10;
use strict;
use warnings;
die "Directory does not exist!" unless -d $ARGV[0];
my @files = glob( $ARGV[0] );
# make the name column at least as wide as the longest filename
my( $workbook, $worksheet ) = get_book_and_sheet( 'attributes.xlsx', 'attributes' );