Skip to content

Instantly share code, notes, and snippets.

Avatar
♨️
470

ytnobody / satoshi azuma ytnobody

♨️
470
View GitHub Profile
@ytnobody
ytnobody / env-export
Created Feb 17, 2014
export environment variables as envdir format
View env-export
#!/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 Mar 11, 2014
Perl入学式向け環境構築ツール for Linux
View perl-entrance-setup
#!/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 Apr 10, 2014
自分で作ったXML解析系モジュールのベンチとってみた
View xml_bench.pl
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');
View dump.psgi
use strict;
use Plack::Builder;
use Data::Dumper;
my $app = sub {
[404, [], ['Not Found']];
};
my $psgi = builder {
enable "Debug";
View postscript-simple-issue.md

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 Aug 29, 2015
an example for using SQL::Maker
View sqlmaker.pl
use strict;
use warnings;
use SQL::Maker;
my $maker = SQL::Maker->new(driver => 'mysql');
my ($sql, @binds) = $maker->select(
'book',
['*'],
{price => {'<=' => 1000}},
View damenayatu.txt
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 Aug 29, 2015
mishima.pm #1 向けの仕込み
View sushi-qrcode.pl
#!/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 Aug 29, 2015
benchmark for instantiate that using / not using class generators
View instantiate.pl
use strict;
use Benchmark qw/:all/;
use Data::Dumper;
### Mouse
{
package
MyClass::Mouse;
use Mouse;
@ytnobody
ytnobody / ref_and_undef.pl
Created Sep 1, 2014
answer for "ref ... and ... っていうのは何がしたい?"
View ref_and_undef.pl
use strict;
use warnings;
use Data::Dumper;
### case of scalar
{
my $data = 123;
ref $data and $data = undef;
print Dumper({'SCALAR' => $data});
};