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
| # Cache::KyotoTycoon 0.05 compare with Cache::Memcached::Fast | |
| # kyototycoonとmemcachedは別ホストで実行 | |
| # cpu time | |
| Benchmark: timing 10000 iterations of get, get_memcached, get_rest, set, set_memcached, set_rest... | |
| get: 21 wallclock secs ( 3.08 usr + 0.80 sys = 3.88 CPU) @ 2577.32/s (n=10000) | |
| get_memcached: 8 wallclock secs ( 0.09 usr + 0.15 sys = 0.24 CPU) @ 41666.67/s (n=10000) | |
| get_rest: 13 wallclock secs ( 1.96 usr + 0.87 sys = 2.83 CPU) @ 3533.57/s (n=10000) | |
| set: 12 wallclock secs ( 2.86 usr + 0.81 sys = 3.67 CPU) @ 2724.80/s (n=10000) | |
| set_memcached: 6 wallclock secs ( 0.15 usr + 0.25 sys = 0.40 CPU) @ 25000.00/s (n=10000) |
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
| static int | |
| constant(const char *name) | |
| { | |
| errno = 0; | |
| if (strncmp(name, "CURLE_", 6) == 0) { | |
| name += 6; | |
| switch (*name) { | |
| case 'A': | |
| if (strEQ(name, "ABORTED_BY_CALLBACK")) return CURLE_ABORTED_BY_CALLBACK; |
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; | |
| my @r; | |
| my $text = q{@hoge http://example.com/#@hoge/ aaa #hash aaa @hogehoge aaa http://example.com/}; | |
| my $re = qr{(http://[A-Za-z0-9_\-\~\.\%\?\#\@/]+(?{push @r, ["HTTP", @-,@+] })|(?:^|\s)\@[A-Za-z0-9_]+(?{push @r,["AT", @-,@+]})|(?:^|\s)#[A-Za-z0-9_]+(?{push @r,["HashTag",@-,@+]}))}; | |
| warn $text; | |
| () = $text =~/$re/g; | |
| warn Dumper @r; |
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/perl | |
| # 犬か猫かランダムに選択してワンとかニャーとか言わせたいときどうするか | |
| # http://twitter.com/bulkneets/status/24724786124 | |
| use strict; | |
| package Cat; | |
| sub say { warn "Nya-" } | |
| sub say2 { warn "Mya-" } |
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/local/bin/perl | |
| # DoS tool for memcached | |
| # ulimit -n 15000; perl memcachedos.pl 127.0.0.1 11211 3 | |
| # original: http://gist.github.com/522741 | |
| # This is Public Domain Software | |
| use strict; | |
| use warnings; | |
| use AnyEvent; |
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/perl | |
| use strict; | |
| use Benchmark qw(:all); | |
| use Data::Dumper; | |
| use HTTP::Response; | |
| use HTTP::Headers::Fast; | |
| { | |
| package HTTP::Headers::Fast; | |
| my %CACHE; |
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
| --- ares_init.c.old 2010-04-23 11:46:56.000000000 +0900 | |
| +++ ares_init.c 2010-04-23 12:19:06.000000000 +0900 | |
| @@ -831,12 +831,16 @@ | |
| FILE *fp; | |
| size_t linesize; | |
| int error; | |
| + const char *path_resolv_conf = getenv("ARES_PATH_RESOLV_CONF"); | |
| + if (!path_resolv_conf) { | |
| + path_resolv_conf = PATH_RESOLV_CONF; | |
| + } |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <script type="text/javascript"> | |
| chrome.browserAction.onClicked.addListener(function(tab){ | |
| capture(); | |
| }); |
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
| /* | |
| // mxhr.js | |
| // BSD license | |
| var mxhr = new MXHR; | |
| mxhr.listen(mime, function(body){ process(body) }); | |
| mxhr.listen('complete', function(status_code){ ... }); // 2xx response | |
| mxhr.listen('error', function(status_code){ ... }); // other case | |
| mxhr.open("GET", url, true); // or mxhr.open("POST", url, true); | |
| mxhr.send(""); |
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
| package Plack::Middleware::AsyncSupport; | |
| use strict; | |
| use warnings; | |
| use base qw/Plack::Middleware/; | |
| our $USE_CORO = 1; | |
| use Coro; | |
| use Coro::Channel; | |
| use IO::Handle::Util qw(io_from_getline); |