Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/perl
use strict;
use Email::Folder;
use Email::LocalDelivery::Maildir;
my ($mbox, $mdir) = @ARGV;
Email::LocalDelivery::Maildir->deliver( $_, $mdir )
for Email::Folder->new($mbox)->messages;
use strict;
use constant_tiny;
use constant pi => 4 * atan2(1, 1);
use constant ponies => qw<
Twilight_Sparkle Fluttershy Pinkie_Pie AppleJack Rainbow_Dash Rarity
>;
use constant {
@maddingue
maddingue / SerializerUtils.pm
Last active August 29, 2015 14:13
types coercion
sub coerce_types {
my $struct = shift;
my $ref = ref $struct;
croak "can only work with references" unless $ref;
if ($ref eq "ARRAY") {
for my $i (0..$#{$struct}) {
next unless defined $struct->[$i];
@maddingue
maddingue / twitch-stream
Last active May 1, 2016 16:54
twitch-stream
#!/usr/bin/perl
use v5.10;
use strict;
use warnings;
use Data::Dump qw< dd pp >;
use JSON::XS;
use LWP::Simple;
use URI::Escape;
@maddingue
maddingue / incoming-sms-handler.pl
Created August 30, 2017 09:23
skeleton program for procesing incoming messages, suitable for being used as a Gammu RunOnReceive handler
#!/usr/bin/perl
use utf8;
use strict;
use warnings;
no warnings qw< void >;
use Getopt::Long;
$::PROGRAM = "incoming-sms-handler";
$::VERSION = "0.1.5";
@maddingue
maddingue / speakerbot
Last active March 5, 2018 20:48
speakerbot
#!/opt/perl/current/bin/perl
use v5.14;
use utf8;
use strict;
use warnings;
use AnyEvent;
use AnyEvent::HTTP;
use AnyEvent::IRC::Client;
use AnyEvent::IRC::Util qw< rfc_code_to_name >;