This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from the internet: | |
my @array1 = (1, 2, 3, 4); | |
my @array2 = (2, 3, 4); | |
my @array3 = (2, 5, 4); | |
my %original = (); | |
my @isect = (); | |
map { $original{$_} = 1 } @array1; | |
@isect = grep { $original{$_} } @array2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Imager::Montage; | |
use Data::Printer; | |
my $imgs =# <*.*>; | |
[ | |
'11.JPG', | |
'14.JPG', | |
'2.JPG', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Term::ReadLine; | |
my $servers = [ | |
{ | |
servidor1 => 'mount /dev/x1 /mount/servidor1', | |
}, | |
{ | |
servidor2 => 'mount /dev/x2 /mount/servidor2', | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use HTTP::Tiny; | |
use IO::Uncompress::Gunzip qw(gunzip $GunzipError) ; | |
use Data::Printer; | |
my $ua = HTTP::Tiny->new( | |
agent => "Mozilla/5.0 (Windows 8; rv:24.0) Gecko/20100101 Firefox/24.0" , | |
default_headers => { | |
'Accept-Encoding' => 'gzip' | |
} | |
) ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#quick perl code generator, im pretty sure mst mentioned this tip, so here it is | |
use strict; | |
use warnings; | |
use IO::All; | |
use Encode qw/decode encode/; | |
use v5.10; | |
use Path::Class; | |
my $config = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use Mysql; | |
use strict; | |
use vars qw($school_name); | |
use vars qw($pass); | |
require "./cgi-lib.pl"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Moose; | |
use HTTP::Tiny; | |
use JSON::XS; | |
use DDP; | |
my $video_id = "78802560"; | |
my $ua = HTTP::Tiny->new(); | |
my $res = $ua->get( "http://vimeo.com/".$video_id ); | |
my ( $stuff, $key ) = $res->{ content } =~ m!data-config-url="([^"]+)&s=([a-zA-Z0-9]+)"!; | |
warn $key; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#build your proxy class with the plugins you want | |
package My::Proxy; | |
use Moose; | |
extends qw/HTTP::Proxy::Interceptor/; | |
with qw/ | |
HTTP::Proxy::InterceptorX::Plugin::ContentModifier | |
/; | |
# with qw/ | |
# HTTP::Proxy::InterceptorX::Plugin::File |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package SmallExcerptBetweenTwoWords; | |
use strict; | |
use warnings; | |
use utf8; | |
use DDP; | |
use Moo; | |
=head1 SYNOPSIS | |
Given a book, and two words from that book, create a method to give the smallest number of words between those two words. Assume that the book is large (over 500 pages) and memory usage and performance is a concern. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open FILE, "text"; | |
my $text; | |
while ( read FILE, $text, 10 ) { | |
warn $text; | |
} | |
open FILE, "text"; | |
my $text; | |
while ( sysread FILE, $text, 10 ) { |
OlderNewer