Skip to content

Instantly share code, notes, and snippets.

🐪
200 OK

Dai Okabayashi bayashi

🐪
200 OK
Block or report user

Report or block bayashi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Function-Return.diff
diff --git a/lib/Function/Return.pm b/lib/Function/Return.pm
index 59398bc..85e0117 100644
--- a/lib/Function/Return.pm
+++ b/lib/Function/Return.pm
@@ -12,6 +12,8 @@ use Scalar::Util ();
use Scope::Upper ();
use Function::Parameters;
+our $DID_CHECK;
+
@bayashi
bayashi / mylog
Created May 2, 2019
Invoke this from .bashrc for daily log
View mylog
#!/usr/bin/env perl
use strict;
use warnings;
my $SUBLIME = '/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl';
my $BASE_PATH = '/path/to/physical_file';
my $SHORTCUT = '/path/to/Desktop/mylog.md';
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
@bayashi
bayashi / userChrome.css
Created Dec 31, 2018
firefox userChrome.css
View userChrome.css
/* For Mac: ~/Library/Application Support/Firefox/Profiles/FOOBAR.default/chrome/userChrome.css */
/* hide tab bar */
#TabsToolbar { visibility: collapse !important; }
/* hide header of side bar */
#sidebar-header { visibility: collapse; }
/* multiple bookmark toolbar */
#personal-bookmarks {
display: block;
@bayashi
bayashi / gist:9e57147e49c0c6e595cbb39cb56c538e
Created Feb 2, 2018
vertical explain table for DBIx::QueryLog
View gist:9e57147e49c0c6e595cbb39cb56c538e
return sub {
my %args = @_;
return $sth->fetchall_arrayref(+{}) unless defined $args{print} and $args{print};
my $t = Text::ASCIITable->new();
$t->setCols('explain', 'result');
$t->alignCol({explain => 'right', result => 'left'});
my @cols = @{$sth->{NAME}};
for my $records (@{$sth->fetchall_arrayref}) {
View test_slide.md

test だよ


ほげ

ふが

hoge

@bayashi
bayashi / gist:5dbee33e65d5c7e58fa6
Created Aug 21, 2015
YAPC::Asia 2015 Busy Rate
View gist:5dbee33e65d5c7e58fa6
$ 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 Aug 29, 2015
benchmark of building place holder
View build_placeholder.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Benchmarks sub {
my @list = (1..10);
+{
map_join => sub {
join(',', map { '?' } @list);
View gist:ffc7edd26f609af54c46
#!/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;
View awesome.pl
use strict;
use warnings;
use Time::HiRes qw/sleep/;
use Furl;
my %awesome;
{
my $page = 1;
while ( my @index = get_index($page) ) {
View dump-perl-stacktrace.log
$ ./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
You can’t perform that action at this time.