Skip to content

Instantly share code, notes, and snippets.

View bayashi's full-sized avatar
💎
OK

bayashi bayashi

💎
OK
View GitHub Profile
@bayashi
bayashi / test_slide.md
Created March 18, 2016 11:03
test slide

test だよ


ほげ

ふが

hoge

@bayashi
bayashi / gist:5dbee33e65d5c7e58fa6
Created August 21, 2015 06:29
YAPC::Asia 2015 Busy Rate
$ perl -MLWP::Simple=get -we 'my %r=(a=>1000, b=>100, c=>120, d=>288, e=>288); for my $room (sort keys %r){ my ($count) = (get("http://api.conbu.net/v1/associations/track_$room") =~ m!:(\d+)!); printf("track".uc($room).": %.2f%%\t%04d/%04d\n", $count/$r{$room}*100, $count, $r{$room}); }'
trackA: 44.60% 0446/1000
trackB: 136.00% 0136/0100
trackC: 66.67% 0080/0120
trackD: 75.35% 0217/0288
trackE: 68.40% 0197/0288
@bayashi
bayashi / build_placeholder.pl
Last active August 29, 2015 14:20
benchmark of building place holder
#!/usr/bin/env perl
use strict;
use warnings;
use Benchmarks sub {
my @list = (1..10);
+{
map_join => sub {
join(',', map { '?' } @list);
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Benchmark qw(cmpthese);
my $h = '25';
my $pattern = '((?:(?:'.$h.'[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))';
my $regexp = qr/$pattern/;
my $regexp_o = qr/$pattern/o;
@bayashi
bayashi / awesome.pl
Created July 14, 2014 04:43
awesome-perl
use strict;
use warnings;
use Time::HiRes qw/sleep/;
use Furl;
my %awesome;
{
my $page = 1;
while ( my @index = get_index($page) ) {
$ ./dump-perl-stacktrace -p 17688 -d
perl_code: open my $fh, '>', qq{/tmp/dump_stacktrace.$$.}.time() or die $!; req
uire Carp; print {$fh} Carp::longmess(q{Dump stacktrace}); close $fh;
init
C
R Attaching to process 17688
Reading symbols from /usr/bin/perl...(no debugging symbols found)...done.
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.s
o...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long qw/GetOptionsFromArray/;
use IO::Stty;
use Digest::HMAC_SHA1 qw//;
our $VERSION = 0.01;
main(\@ARGV);
@bayashi
bayashi / Benchmark.pm
Created March 10, 2013 09:20
patched Benchmark.pm: croak if return values are wrong.
package Benchmark;
use strict;
=head1 NAME
Benchmark - benchmark running times of Perl code
=head1 SYNOPSIS
@bayashi
bayashi / gist:4751969
Created February 11, 2013 02:03
Test: : Do NOT load modules
use strict;
use Test::AllModules;
use Test::More;
BEGIN {
note('compile all modules.');
all_ok(
search_path => 'MyApp',
check => sub {
my $class = shift;
package Test::AllModules;
use strict;
use warnings;
use Module::Pluggable::Object;
use List::MoreUtils qw(any);
use Test::More ();
our $VERSION = '0.01';
use Exporter;