Skip to content

Instantly share code, notes, and snippets.

View ytnobody's full-sized avatar
♨️
470

ytnobody / satoshi azuma ytnobody

♨️
470
View GitHub Profile
@ytnobody
ytnobody / env-export
Created February 17, 2014 08:57
export environment variables as envdir format
#!/usr/bin/env perl
use strict;
use warnings;
my $dir = $ARGV[0] || 'env';
mkdir $dir unless -d $dir;
my @data = `env`;
chdir $dir;
for my $entry (@data) {
@ytnobody
ytnobody / perl-entrance-setup
Created March 11, 2014 02:29
Perl入学式向け環境構築ツール for Linux
#!/bin/sh
curl -L http://is.gd/plenvsetup | sh
. ~/.bash_profile
plenv install 5.18.1
plenv global 5.18.1
plenv install-cpanm
@ytnobody
ytnobody / xml_bench.pl
Created April 10, 2014 08:08
自分で作ったXML解析系モジュールのベンチとってみた
use strict;
use Benchmark qw(:all);
use XML::XPath::Diver;
use XML::Diver;
my $xml = do { local $/; <DATA> };
my $xpath_diver = sub {
my $xd = XML::XPath::Diver->new(xml => $xml);
$xd->dive('//food');
use strict;
use Plack::Builder;
use Data::Dumper;
my $app = sub {
[404, [], ['Not Found']];
};
my $psgi = builder {
enable "Debug";

PostScript::Simple is so useful module. But, it makes confused when using with Carton.

Solution, add a line-feed to head of package name of each t/lib/Test/*.pm .

  • as is
package Test::More;
@ytnobody
ytnobody / sqlmaker.pl
Last active August 29, 2015 14:03
an example for using SQL::Maker
use strict;
use warnings;
use SQL::Maker;
my $maker = SQL::Maker->new(driver => 'mysql');
my ($sql, @binds) = $maker->select(
'book',
['*'],
{price => {'<=' => 1000}},
ytnobody@ytnobody-virtual-machine:~/vznope-bash$ cat centos-mysql
create centos@6
set --nameserver 8.8.8.8
start
exec yum -y update
exec yum -y install mysql-server
ytnobody@ytnobody-virtual-machine:~/vznope-bash$ vzn build 102 < centos-mysql
---
RUN: create centos@6
@ytnobody
ytnobody / sushi-qrcode.pl
Last active August 29, 2015 14:03
mishima.pm #1 向けの仕込み
#!/usr/bin/env perl
use strict;
use warnings;
use Furl;
use File::Temp 'tempdir';
use File::Spec;
use File::Slurp;
use Vector::QRCode::IntoPDF;
@ytnobody
ytnobody / instantiate.pl
Last active August 29, 2015 14:05
benchmark for instantiate that using / not using class generators
use strict;
use Benchmark qw/:all/;
use Data::Dumper;
### Mouse
{
package
MyClass::Mouse;
use Mouse;
@ytnobody
ytnobody / ref_and_undef.pl
Created September 1, 2014 02:45
answer for "ref ... and ... っていうのは何がしたい?"
use strict;
use warnings;
use Data::Dumper;
### case of scalar
{
my $data = 123;
ref $data and $data = undef;
print Dumper({'SCALAR' => $data});
};