Skip to content

Instantly share code, notes, and snippets.

View briandfoy's full-sized avatar

brian d foy briandfoy

View GitHub Profile
@briandfoy
briandfoy / perl_on_windows.txt
Created July 25, 2012 22:05
Outline for a book on Perl on Windows
Introduction
Why Perl over Powershell?
This isn't Learning Perl on Win32
Perl distributions for Windows
ActivePerl
Strawberry Perl
Cava
cygwin (only briefly)
@briandfoy
briandfoy / github2ohloh.pl
Created July 27, 2012 19:43
Add Github projects to Ohloh
#!/usr/bin/perl
use v5.14;
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new->max_redirects(5);
my $user = $ENV{GITHUB_USER} // '...';
my @committer_names = ( '...', '...', );
$ENV{OHLOH_USER} //= '...';
@briandfoy
briandfoy / looney_toons.pl
Created August 29, 2012 18:23
Extract Looney Toons links
#!/usr/local/perls/perl-5.14.2/bin/perl
use v5.14;
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
my $url = 'http://www.toonarific.com/show_episodes.php?show_id=2177';
my @seasons = $ua->get( $url )
->res
BuiltinFunctions::ProhibitBooleanGrep
BuiltinFunctions::ProhibitStringyEval
BuiltinFunctions::ProhibitStringySplit
BuiltinFunctions::ProhibitUniversalCan
BuiltinFunctions::ProhibitUniversalIsa
ClassHierarchies::ProhibitExplicitISA
ControlStructures::ProhibitMutatingListFunctions
ControlStructures::ProhibitUnreachableCode
ErrorHandling::RequireCarping
InputOutput::ProhibitBarewordFileHandles
@briandfoy
briandfoy / perl-cert.json
Last active December 11, 2015 01:48
A JSON representation of the CERT Perl Secure Coding Standards (https://www.securecoding.cert.org/confluence/display/perl/CERT+Perl+Secure+Coding+Standard)
[
{
"priority" : "P4",
"name" : "Canonicalize path names before validating them",
"rule" : "",
"section" : "1",
"recommedation" : "1",
"level" : "L3",
"url" : "https://www.securecoding.cert.org/confluence/display/perl/IDS00-PL.+Canonicalize+path+names+before+validating+them",
"class" : "IDS00-PL",
use Net::Twitter;
use v5.10;
# get your own credentials at https://dev.twitter.com/apps/new
my $nt = Net::Twitter->new(
traits => [qw/OAuth API::REST/],
map { $_ => $ENV{"twitter_$_"} || die "ENV twitter_$_ not set" }
qw(
consumer_secret
consumer_key
God, give me privileges to change with serenity
the things that cannot be changed,
Permission to change the things
which should be changed,
and the Wisdom to distinguish
the lusers from the users.
Configuring several servers at a time,
Fixing multiple issues at a time,
Accepting hardware as a pathway to Perl,
Getting, as Stallman did,
@briandfoy
briandfoy / crowdtilt_timeline.pl
Last active December 16, 2015 06:59
Sequence a Crowdtilt campaign
#!/Users/brian/bin/perls/perl5.14.2
use v5.14;
use Email::MIME;
use Date::Parse qw(str2time);
# /Users/brian/Library/Mail/V2/IMAP-brian.d.foy@imap.gmail.com/Pinto Campaign.mbox/52D05AC0-3807-4D78-9864-069A09964592/Data/6/0/4/2/Messages
# I'm grabbing the messages out of Apple's Mail, which is fine I guess.
# I have a filter set up for the messages I want.
# If I really wanted something fancy, I'd pull out procmail.
my $folder = $ARGV[0] // q(messages);
#!/usr/local/perls/perl-5.14.2/bin/perl
use Mac::Pasteboard;
my $pb = Mac::Pasteboard->new;
my %tags = $pb->flavor_tags;
my @names = $pb->flavor_flag_names ($flags);
use Data::Dumper;
#!/usr/bin/env perl5.14.2
# retweeter.pl
# https://gist.github.com/briandfoy/5478591
use Net::Twitter;
use v5.10;
die "Specify the original tweet id!\n" unless defined $ARGV[0];
# get your own credentials at https://dev.twitter.com/apps/new
my $nt = Net::Twitter->new(