This file contains 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
// zinniaの特徴量抽出は以下を参照 | |
void Features::makeBasicFeature(int offset, | |
const Node *first, | |
const Node *last) { | |
// distance | |
addFeature(offset + 1 , 10 * distance(first, last)); | |
// degree | |
addFeature(offset + 2 , |
This file contains 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 PDL; | |
use PDL::Stats::Basic; | |
# モジュール化するまでも無いのでgistに載せます。 | |
# ランダム要素を無くすと出力がInfになったりするのでそこはご愛嬌ということで。 | |
# また、対角要素は-1になってしまいます。 | |
# 偏相関係数行列を求める関数 | |
sub partial_corr{ |
This file contains 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 Plack::MIME; # mimeタイプ自動判別用 | |
use Data::Dumper; | |
use File::Slurp; # 効率的な静的ファイル応答 | |
# 静的ファイル置き場 | |
my $public_dir = './public'; | |
# ディレクトリインデックスの指定 |
This file contains 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 IO::Socket::SSL; | |
while(1){ | |
my $c = IO::Socket::SSL->new( | |
PeerAddr => "localhost", | |
PeerPort => 5001, | |
Proto => "tcp", | |
SSL_verify_mode => 'SSL_VERIFY_NONE' |
This file contains 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
# You can startup MR worker by one liner below. | |
# $ perl -MYCGL::Lite -e 'YCGL::Lite->new->plack->plackup_eval("/eval");' | |
# Example: Word count | |
use strict; | |
use warnings; | |
use YCGL::Lite; | |
use Data::Dumper; | |
my $ycgl = YCGL::Lite->new(); |
This file contains 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; | |
my $sum = 0; | |
for(1 .. 3_000_000_000){ | |
$sum += $_; | |
} | |
print $sum,"\n"; |
This file contains 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; | |
sub list_unique{ | |
my $left = shift; | |
my $right = shift; | |
my @list = (@$left,@$right); | |
my %tmp1; | |
my @unique = grep { !$tmp1{$_}++ } (@list); | |
return @unique; |
This file contains 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 MapReduce::Framework::Simple; | |
use Data::Dumper; | |
use DBI; | |
my $mfs = MapReduce::Framework::Simple->new(); | |
my $data_bk = |
This file contains 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
eval($code=q{ | |
# Quine like self-rewriting program | |
# 1st : $ perl quine.pl > a1.pl | |
# repeat : $ perl a1.pl > a2.pl ; cat a2.pl ; cp a2.pl a1.pl | |
$str=" | |
XXXXXXXXXX | |
A | |
XXXXXXXXXX | |
"; |
This file contains 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 MapReduce::Framework::Simple; | |
my $mfs = MapReduce::Framework::Simple->new( | |
skip_undef_result => 1, | |
warn_discarded_data => 1 | |
); | |
my $data_map_reduce = [ |
OlderNewer