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) |
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
diff --git a/lib/Mojo/Server/Prefork.pm b/lib/Mojo/Server/Prefork.pm | |
index 1052111..96c33f5 100644 | |
--- a/lib/Mojo/Server/Prefork.pm | |
+++ b/lib/Mojo/Server/Prefork.pm | |
@@ -78,8 +78,12 @@ sub run { | |
local $SIG{INT} = local $SIG{TERM} = sub { $self->_term }; | |
local $SIG{CHLD} = sub { | |
while ((my $pid = waitpid -1, WNOHANG) > 0) { | |
- $self->app->log->debug("Worker $pid stopped.") | |
- if delete $self->emit(reap => $pid)->{pool}{$pid}; |
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
find . -type f -regextype posix-egrep -regex '.*\.pm|.*\.c|.*\.h|.*\.xs' ! -regex '\./\.git/|.*ppport\.h' | while read fname; do perl -ne 'print unless /^=h/ .. /^=cut/' < $fname; done | sed '/^$/d;/^#/d' | wc -l |
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 LWP::UserAgent; | |
use Time::HiRes; | |
use strict; | |
my $ua = LWP::UserAgent->new(); | |
my $start = Time::HiRes::time(); | |
my $maxbytes = 1024*1024; | |
my $curspeed = 0; | |
my $received_bytes = 0; |
OlderNewer