Skip to content

Instantly share code, notes, and snippets.

View mfontani's full-sized avatar

Marco Fontani mfontani

View GitHub Profile
@mfontani
mfontani / keybase.md
Created September 23, 2014 23:11
Keybase authorization

Keybase proof

I hereby claim:

  • I am mfontani on github.
  • I am mfontani (https://keybase.io/mfontani) on keybase.
  • I have a public key whose fingerprint is 7D94 1D1C CF93 1598 A567 01B3 D47F C150 38AE 4D5E

To claim this, I am signing this object:

#!/usr/bin/env perl
use common::sense;
use DateTime;
use Text::Table;
my $now = DateTime->from_epoch(epoch => time, time_zone => 'UTC');
my @where = qw<
UTC
Europe/London
Europe/Rome
#!/usr/bin/env perl
use Mojolicious::Lite;
get '/' => sub {
my $c = shift;
$c->render( template => 'index' );
};
get '/*' => sub {
my $c = shift;
@mfontani
mfontani / -
Created September 22, 2015 11:45
severity = 1
verbose = 8
# Allows us to set use strict;use warnings before package keyword
[-Modules::RequireExplicitPackage]
[Lax::RequireExplicitPackage::ExceptForPragmata]
# make scripts - like t/ - exempt from this policy
exempt_scripts = 1
# this is what we *use* to make this module work...
@mfontani
mfontani / -
Created September 22, 2015 12:42
severity = 1
verbose = 8
# Allows us to set use strict;use warnings before package keyword
[-Modules::RequireExplicitPackage]
[Lax::RequireExplicitPackage::ExceptForPragmata]
# make scripts - like t/ - exempt from this policy
exempt_scripts = 1
# this is what we *use* to make this module work...
#!/usr/bin/env perl
use Mojolicious::Lite;
my $use_auth = 1; # with auth enabled..
my ( $user, $pass ) = qw/user password/;
if ($use_auth) { plugin 'basic_auth'; }
get '/' => sub { my $self = shift; $self->redirect_to('/upload'); };
get '/upload' => sub {
my $self = shift;
#!/usr/bin/env perl
use strict;
use warnings;
# List of previously installed modules was created with:
# perldoc -o text perllocal | grep '"Module"' | cut -d'"' -f3 | cut -d' ' -f2
my $installed = shift;
$installed = "$ENV{HOME}/perl-installed-20100908-1917.txt" unless defined $installed;
print "Using modules list from $installed\n";
@mfontani
mfontani / 4005150.pl
Created October 23, 2010 17:56
Answer on SO
use strict;
use warnings;
# Column details and sample line, from the post
my $header = q{0 AOZSVIN, TAMSSZ B A A- B+ B B- C+ C C- D+ D D- F CR P PR I I* W WP WF AU NR FN FS};
my $sample = q{0 AAS 150 23 25 16 35 45 14 8 10 2 1 1 4 4 };
# -+--------+-----+-----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---..
# chars 1212345678912345612345612341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234...
# num. chars: 2 9 6 6 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 *
my $unpack = q{A2A9 A6 A6 A4 A4 A4 A4 A4 A4 A4 A4 A4 A4 A4 A4 A4 A4 A4 A4 A4 A4 A4 A4 A4 A4 A4 A*};
@mfontani
mfontani / repack-git-repos.sh
Created November 8, 2010 19:34
Repack all my Git repos, si vous plait!
#!/bin/sh
# Marco Fontani - MFONTANI at cpan dot org
# Repack all the .git repos from the current directory
# using 8 processes at once
find . -type d -name '.git' | \
xargs -I{} -P8 \
sh -c "(cd {}/..; git gc; echo done {})2>/dev/null"
# scripts/capsule.sh
if [ -f 'dist.ini' ]; then
echo "Found dist.ini, using Dist::Zilla"
#dzil authordeps | cpanm
#cpanm --installdeps .
echo "Installing author deps" >> $logfile
dzil authordeps | cpanm >> $logfile 2>&1
echo "Installing dist deps" >> $logfile
dzil listdeps | cpanm >> $logfile 2>&1