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
my $str = '0123456789'; | |
$str =~ s/(?<=.)(?=(?:\d{3})+$)/ /g; |
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
$i++%50||++$j&mkdir($f="folder$j")&($i=1),rename$_,"$f/$i"for<*> |
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/env perl | |
use strict; | |
use Coro::LWP; | |
use Coro; | |
use LWP; | |
use Test::More tests => 1; | |
sub make_broken_http_server { | |
my $serv = IO::Socket::INET->new(Listen => 1); |
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 Tie::IxHash; | |
use JSON::PP; | |
# magic start | |
my $obj_parser_sub = \&JSON::PP::object; | |
*JSON::PP::object = sub { | |
tie my %obj, 'Tie::IxHash'; | |
$obj_parser_sub->(\%obj); |
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 Mojolicious::Lite; | |
use POSIX; | |
get '/' => sub { | |
my $child = fork(); | |
unless (defined $child) { | |
die "fork(): $!"; | |
} | |
elsif ($child == 0) { |
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
#include <iostream> | |
class Ax { | |
public: | |
Ax(int a); | |
bool compare(const Ax &other); | |
private: | |
int m_a; | |
}; |
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 Data::Dumper; | |
use strict; | |
$a = ['google.ru', on_prepare => sub {}, timeout => 10, sub{}]; | |
print Dumper _extract_known_params($a); | |
print Dumper ($a), "-------\n"; | |
$a = ['google.ru', timeout => 10, on_prepare => sub {}, sub{}]; | |
print Dumper _extract_known_params($a); | |
print Dumper ($a), "-------\n"; |
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 AnyEvent::Google::PageRank 'rank_get'; | |
my $cv = AE::cv; | |
rank_get 'http://www.google.ru', sub { | |
print shift, "\n"; | |
$cv->send; | |
}; | |
$cv->recv; |
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 URI; | |
use HTTP::Request; | |
use IO::Lambda qw(:all); | |
use IO::Lambda::HTTP qw(http_request); | |
sub request($) { | |
my $url = URI->new($_[0]); | |
my $req = HTTP::Request->new(GET => $url, [Host => $url->host]); | |
$req->protocol('HTTP/1.1'); |
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
BEGIN { | |
$ENV{SOCKS_DEBUG} = 1; | |
} | |
use IO::Socket::Socks::Wrapper ( | |
Net::FTP => { | |
ProxyAddr => 'localhost', | |
ProxyPort => 1080, | |
SocksVersion => 5 | |
}, | |
Net::FTP::dataconn => { |