Skip to content

Instantly share code, notes, and snippets.

Avatar

aero aero

  • Seoul, Republic of Korea
View GitHub Profile
@aero
aero / demacboogi.pl
Created Jul 25, 2011
Rename MacOS X NFD hangule to NFC
View demacboogi.pl
#!/usr/bin/env perl
# 사용법
# perl demacboogi.pl *.zip #zip파일만 변환
# perl demacboogi.pl #모든파일 변환
use 5.010;
use strict;
use warnings;
use Encode qw/encode decode/;
use Unicode::Normalize qw/compose/;
use File::Copy;
@aero
aero / group5.pl
Created Dec 11, 2016
5개씩 묶기
View group5.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
my @m = 1..17;
my @m5;
my $step = 5;
@aero
aero / autoinstall2.pl
Last active Nov 20, 2016
Automatically install all dependence modules through cpanminus within core Perl distribution.
View autoinstall2.pl
#!/usr/bin/env perl
BEGIN {
require FindBin;
require lib;
my $locallib_path = "$FindBin::RealBin/locallib/$^V";
lib->import("$locallib_path/lib/perl5");
my $cpanm;
@aero
aero / autoinstall.pl
Last active Nov 20, 2016
Automatically install all dependence modules through cpanminus within core Perl distribution.
View autoinstall.pl
#!/usr/bin/env perl
BEGIN {
my @REQ_MODULES = qw/
Mojolicious
Text::CSV_XS
/;
require FindBin;
require lib;
@aero
aero / parse.pl
Created Jan 21, 2016
text section parsing
View parse.pl
#!/usr/bin/env perl
use strict;
use warnings;
my $s = do { local $/; <DATA> };
my %section = $s =~ m/
^{{{(.*?)}}}-+$
\n(.*?)
(?=\n{{{.*?}}}-+$|\Z)
@aero
aero / mojo_mysql_reconnect.pl
Last active Dec 23, 2015
Solving Mojolicious fork-based multi-processes daemon(eg. hypnotoad) Mojo::mysql connection timeout close issue.
View mojo_mysql_reconnect.pl
use Mojolicious::Lite;
use Mojo::mysql;
helper db => sub {
state $db = Mojo::mysql->new('mysql://user:pass@/task')->db;
if (! $db->ping ) {
$db->dbh( $db->dbh->clone() ) or die "cannot connect to db";
}
return $db;
};
@aero
aero / bench.pl
Created Jul 22, 2013
p5-mop-redux benchmark
View bench.pl
#!/usr/bin/env perl
use 5.012;
use warnings;
use blib;
use Benchmark qw/cmpthese/;
use mop; # 2013-07-22
{
package Raw;
@aero
aero / patch.diff
Created Mar 30, 2013
Mojolicious::Plugin::Directory patch for different user local locale (ex. Korean Windows cp949)
View patch.diff
--- Directory.pm.org 2012-11-12 13:38:22.000000000 +0900
+++ Directory.pm 2013-03-31 00:23:52.000000000 +0900
@@ -5,6 +5,7 @@
use Cwd ();
use Encode ();
+use Encode::Locale;
use DirHandle;
use Mojo::Base qw{ Mojolicious::Plugin };
use Mojolicious::Types;
@aero
aero / Inline_bench.pl
Last active Dec 14, 2015
Pure Perl vs Inline::C, simple function and complex function
View Inline_bench.pl
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use Benchmark;
use Data::Dumper;
timethese(1000000, {
perl => sub { sub_perl(100) },
c => sub { sub_c(100) },
@aero
aero / gist:2514726
Created Apr 28, 2012
Moose vs Mouse vs Moo vs Mo (Loading/Object Creation/Getter/Setter) benchmark
View gist:2514726
Date: 2012-04-28
Moose 2.0403
Mouse 0.97
Moo 0.091 + Class::XSAccessor 1.13
Mo 0.31
* Loading
time perl -e 'use Moose;'
You can’t perform that action at this time.