This file contains 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 Mojo::Reactor::EV; | |
use v5.10; | |
BEGIN { | |
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::EV'; | |
$ENV{MOJO_IOLOOP_DEBUG} = 1; | |
} | |
use Mojo::IOLoop; | |
use Mojo::UserAgent; | |
use AnyEvent::HTTP; |
This file contains 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 Coro::PatchSet 0.04; | |
BEGIN { | |
package IO::Select; | |
use Coro::Select; | |
use IO::Select; | |
} | |
use IO::Socket::Socks qw(:constants :DEFAULT); | |
use Coro; | |
use Coro::Socket; |
This file contains 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; | |
package JUNOS::Config::Parser; | |
sub new { | |
my ($class, %cb) = @_; | |
bless \%cb, $class; | |
} | |
sub parse { |
This file contains 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 feature 'say'; | |
use Geo::Distance; | |
use Geo::Point; | |
use JSON; | |
use LWP::UserAgent::Cached; | |
use Term::ANSIColor; | |
use List::Util 'reduce'; | |
use Math::Trig; |
This file contains 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 Text::CSV; | |
use Text::Trim; | |
use HTML::Entities; | |
binmode STDOUT, ":utf8"; | |
my $dir = shift | |
or die "usage: $0 dir > output"; |
This file contains 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 LWP::UserAgent::Cached 0.06; | |
use HTTP::Date; | |
mkdir '/tmp/cache'; | |
my $ua = LWP::UserAgent::Cached->new(cache_dir => '/tmp/cache'); | |
$ua->nocache_if(sub { | |
my $resp = shift; | |
$resp->code == 304; # do not cache not modified |
This file contains 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 <stdlib.h> | |
#include <stdio.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netdb.h> | |
#include <netinet/in.h> | |
#include <arpa/inet.h> | |
char *sockname(int type) { | |
if (type == SOCK_STREAM) return "SOCK_STREAM"; |
This file contains 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 blib; | |
use Net::DNS_A; | |
for (1..10_000) { | |
Net::DNS_A::lookup("localhost"); | |
} | |
sleep; |
This file contains 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 IO::Socket::IP; | |
use Socket 'IPPROTO_TCP'; | |
use IO::Select; | |
my ($err, @res) = Socket::getaddrinfo("www.google.com", 80, {protocol => IPPROTO_TCP}); | |
die $err if $err; | |
my $ip = IO::Socket::IP->new(Blocking => 0, PeerAddrInfo => \@res) or die $@; | |
my $sel = IO::Select->new($ip); |
This file contains 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
CamlQuery camlQuery = new CamlQuery(); | |
camlQuery.FolderServerRelativeUrl = cFolder.ServerRelativeUrl; | |
List list = ctx.Web.Lists.GetById(listGuid); | |
ctx.Load(list); | |
ctx.ExecuteQuery(); | |
var items = list.GetItems(camlQuery); | |
ctx.Load(items); | |
ctx.ExecuteQuery(); | |
foreach (ListItem i in items) |