Skip to content

Instantly share code, notes, and snippets.

View kazeburo's full-sized avatar

Masahiro Nagano kazeburo

View GitHub Profile
use Proclet;
my $proclet = Proclet->new;
# add service
$proclet->service(
code => sub {
my $job = $jobqueue->grab;
work($job);
},
diff --git a/lib/Net/DNS/Lite.pm b/lib/Net/DNS/Lite.pm
index f3e24e0..deb173a 100644
--- a/lib/Net/DNS/Lite.pm
+++ b/lib/Net/DNS/Lite.pm
@@ -381,6 +381,7 @@ sub parse_resolv_conf {
$self->{search} = [];
my $attempts;
+ my $timeout;
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use Pod::Usage;
GetOptions (
'l|load=f' => \my $threshold,
'i|interval=s' => \my $interval,
'c|continue' => \my $continue,
'h|help' => \my $help,
#include "apr.h"
#include "apr_strings.h"
#include "apr_lib.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
#include "ap_config.h"
#include "httpd.h"
#include "http_config.h"
diff --git a/lib/Plack/Middleware/Scope/Container.pm b/lib/Plack/Middleware/Scope/Container.pm
index ec35abe..294fd4a 100644
--- a/lib/Plack/Middleware/Scope/Container.pm
+++ b/lib/Plack/Middleware/Scope/Container.pm
@@ -4,14 +4,25 @@ use strict;
use warnings;
use parent qw(Plack::Middleware);
use Scope::Container;
+use Plack::Util;
#!/usr/bin/env perl
use strict;
use warnings;
use File::Zglob;
use Getopt::Long;
use Pod::Usage;
our $VERSION=$File::Zglob::VERSION;
#!/usr/bin/env perl
use strict;
use warnings;
use lib 'extlib/lib/perl5';
use DBIx::Sunny;
use Parallel::ForkManager;
use File::Temp qw/tempfile/;
use Time::HiRes qw/gettimeofday tv_interval/;
@kazeburo
kazeburo / http_load.diff
Created November 6, 2012 04:05
http_load_isucon2 patch
--- http_load/http_load-12mar2006/http_load.c 2006-03-13 04:17:03.000000000 +0900
+++ http_load_isucon2/http_load.c 2012-10-29 01:21:42.000000000 +0900
@@ -1019,13 +1019,21 @@
}
else
bytes = snprintf(
- buf, sizeof(buf), "GET %.500s HTTP/1.0\r\n",
+ buf, sizeof(buf), "GET %.500s HTTP/1.1\r\n",
urls[url_num].filename );
bytes += snprintf(
diff -ur httpd-2.2.22.orig/include/httpd.h httpd-2.2.22/include/httpd.h
--- httpd-2.2.22.orig/include/httpd.h 2011-05-19 11:17:37.000000000 +0900
+++ httpd-2.2.22/include/httpd.h 2012-12-10 16:19:36.000000000 +0900
@@ -526,6 +526,7 @@
#define HTTP_LOCKED 423
#define HTTP_FAILED_DEPENDENCY 424
#define HTTP_UPGRADE_REQUIRED 426
+#define HTTP_TOO_MANY_REQUESTS 429
#define HTTP_INTERNAL_SERVER_ERROR 500
#define HTTP_NOT_IMPLEMENTED 501
use Plack::App::CGIBin;
use Plack::App::PHPCGI;
use Plack::Builder;
use File::Zglob;
my $cgibin = Plack::App::CGIBin->new(
root => "/usr/local/nagios/sbin",
exec_cb => sub { my $file = shift; $file =~ m!\.cgi$! and -x $file },
)->to_app;
my $static = Plack::App::File->new(root => "/usr/local/nagios/share")->to_app;