Skip to content

Instantly share code, notes, and snippets.

View alexm's full-sized avatar

Alex Muntada alexm

View GitHub Profile
@alexm
alexm / gist:1732411
Created February 3, 2012 20:45
Getopt::Long subs
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use Getopt::Long;
my %opt = ( 'list' => sub { say $_[0] } );
GetOptions( 'list=s' => sub { $opt{ $_[0] }->( $_[1] ) } );
@alexm
alexm / gist:1646641
Created January 20, 2012 10:38
Markdown as shell script
#!/bin/sh
# markdown as shell script
## setup
set -e
set -x
FOOBAR="foobar"
## step 1
@alexm
alexm / barcelona.p6
Created May 5, 2011 10:09
Barcelona.pm T-shirt 2011 (with comments)
# Perl 6
use v6;
my @Barcelona = < Barcelona >;
my @PerlMongers = < Perl >;
# Define Camelia binary operator: »ö«
# https://github.com/perl6/mu/raw/master/misc/camelia.txt
# Takes a pair from the operand arrays and puts a heart in the middle
sub infix:<»ö«> {
@alexm
alexm / new-messages.pl
Created February 21, 2011 08:51
find all imap folders and print total and new number of messages
#!/usr/bin/perl
use strict;
use warnings;
my $SERVER = 'imap.example.com';
my $USER = 'user.name@example.com';
my $PASSWD = '***';
my $PORT = 993;
my $SSL = 1;
#!/usr/bin/perl
#
# vots-pirates.pl
#
# Requeriments:
# sudo apt-get install libnotify-bin libwww-perl
#
use LWP::Simple;