Skip to content

Instantly share code, notes, and snippets.

View kazeburo's full-sized avatar

Masahiro Nagano kazeburo

View GitHub Profile
diff -ur mysql-4.0.30.o/sql/ha_innodb.cc mysql-4.0.30/sql/ha_innodb.cc
--- mysql-4.0.30.o/sql/ha_innodb.cc 2007-02-13 04:38:48.000000000 +0900
+++ mysql-4.0.30/sql/ha_innodb.cc 2011-10-17 17:40:07.000000000 +0900
@@ -4985,6 +4985,21 @@
if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) {
+ if (lock_type == TL_READ && thd->in_lock_tables) {
+ /* We come here if MySQL is processing LOCK TABLES
+ ... READ LOCAL. MyISAM under that table lock type
package CloudForecast::Data::Bigipvstraffic;
use CloudForecast::Data -base;
use CloudForecast::Log;
use SNMP;
SNMP::loadModules('F5-BIGIP-LOCAL-MIB');
rrds map { [ $_, 'COUNTER' ] } qw /in out/;
graphs 'traffic' => 'Throughput';
#!/usr/bin/env perl
use strict;
use warnings;
use HTTP::Request::Common;
use HTTP::Message::PSGI;
use Plack::Test;
use Plack::Builder;
use Log::Dispatch;
use File::Temp qw/tempfile/;
@kazeburo
kazeburo / gist:1778392
Created February 9, 2012 08:20
nginx HTTP/1.0 upstream keepalive
--- nginx-1.1.14.orig/src/http/ngx_http_upstream.c 2012-01-19 00:07:43.000000000 +0900
+++ nginx-1.1.14/src/http/ngx_http_upstream.c 2012-02-09 17:11:02.000000000 +0900
@@ -3426,6 +3426,13 @@
r->upstream->headers_in.connection_close = 1;
}
+ if (ngx_strlcasestrn(h->value.data, h->value.data + h->value.len,
+ (u_char *) "keep-alive", 10 - 1)
+ != NULL)
+ {
package CloudForecast::Data::Mysqlreplication;
use CloudForecast::Data -base;
rrds map { [ $_, 'GAUGE' ] } qw/sec readpos execpos/;
graphs 'sec' => 'SecondsBehindMaster';
graphs 'pos' => 'PositionBehindMaster';
title {
my $c = shift;
@kazeburo
kazeburo / gist:2318616
Created April 6, 2012 10:07
common::sense Makefile.PL
--- common-sense-3.4.orig/Makefile.PL 2011-01-14 15:36:18.000000000 +0900
+++ common-sense-3.4/Makefile.PL 2012-04-06 18:57:09.000000000 +0900
@@ -1,5 +1,7 @@
use ExtUtils::MakeMaker;
+my $version = MM->parse_version("sense.pm.PL");
+
WriteMakefile(
dist => {
PREOP => 'pod2text sense.pm | tee README >$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;',
@kazeburo
kazeburo / gist:2349121
Created April 10, 2012 07:46
Apache::BumpyLife
package Apache::BumpyLife;
use strict;
use warnings;
use Config;
use Apache::Constants ();
use constant IS_WIN32 => $Config{'osname'} eq 'MSWin32' ? 1 : 0;
our $VERSION = '0.01';
use Coro;
use Coro::Channel;
use Coro::Timer;
use Plack::Request;
my $queue = Coro::Channel->new(100);
for ( 1..10 ) {
async {
while(1) {
my $req = $queue->get();
diff --git a/lib/Furl/HTTP.pm b/lib/Furl/HTTP.pm
index e859786..69a3c16 100644
--- a/lib/Furl/HTTP.pm
+++ b/lib/Furl/HTTP.pm
@@ -645,9 +645,12 @@ sub _read_body_chunked {
READ_CHUNK: while ( $next_len+2 > length($buf) ) {
my $n = $self->read_timeout( $sock,
\$buf, $self->{bufsize}, length($buf), $timeout_at );
- if ( not defined $n ) {
+ if (!$n) {
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use File::Temp qw/tempfile/;
use Parallel::Benchmark;
for my $n ( 1..4 ) {
(undef ,my $db) = tempfile(OPEN => 0);