# install vagrant
$ gem install vagrant
# download box
$ cd ~/Downloads;
$ curl -L http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130731.box -o CentOS-6.4-x86_64-v20130731.box
# add box
$ vagrant box add centos6.4-x86_64 ./CentOS-6.4-x86_64-v20130309.box
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 strict; | |
use warnings; | |
use Net::HandlerSocket::Simple; | |
my $hs = Net::HandlerSocket::Simple->new(+{ | |
host => 'localhost', | |
port => 9998, | |
wo_host => 'localhost', | |
wo_port => 9999, |
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 strict; | |
use warnings; | |
use Encode qw(decode); | |
my $str = 'あいうえお'; | |
warn length($str); # 10 | |
warn length(decode("euc-jp", $str)); # 5 |
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
$ perl -E 'say scalar (@array=qw(foo bar piyo))' | |
3 | |
$ perl -E 'say scalar qw(foo bar piyo)' | |
piyo | |
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
<!-- JPY --> | |
<add> | |
<doc> | |
<field name="id">JPY</field> | |
<field name="name">One Yen</field> | |
<field name="manu">Bank of Japan</field> | |
<field name="manu_id_s">boj</field> |
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/env perl | |
use utf8; | |
use Mojolicious::Lite; | |
use XML::Feed; | |
use URI; | |
get '/' => sub { | |
my $self = shift; | |
$self->render('index'); |
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
@startuml | |
actor UserAgent | |
participant Client | |
participant "Authorization Server" | |
activate UserAgent | |
UserAgent -> "Authorization Server" : client Identifier & redirection URI | |
activate "Authorization Server" |
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/env/perl | |
use strict; | |
use warnings; | |
use utf8; | |
sub eval_func { |
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
# download box | |
$ cd ~/Downloads; | |
$ curl -L http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130427.box -o CentOS-6.4-x86_64-v20130427.box | |
# add box | |
$ vagrant box add centos6.4-x86_64 ./CentOS-6.4-x86_64-v20130427.box | |
# initialize | |
$ mkdir ~/vagrant; cd ~/vagrant | |
$ vagrant init centos6.4-x86_64 |
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 Fcntl qw(:flock LOCK_NB); | |
use Parallel::ForkManager; | |
my $pm = new Parallel::ForkManager(2); | |
for (1..2) { | |
my $pid = $pm->start and next; | |
write_file(); | |
$pm->finish; | |
} |
OlderNewer