Skip to content

Instantly share code, notes, and snippets.

View aero's full-sized avatar

aero aero

  • Seoul, Republic of Korea
View GitHub Profile
@aero
aero / group5.pl
Created December 11, 2016 00:35
5개씩 묶기
#!/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 November 20, 2016 11:24
Automatically install all dependence modules through cpanminus within core Perl distribution.
#!/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 November 20, 2016 11:23
Automatically install all dependence modules through cpanminus within core Perl distribution.
#!/usr/bin/env perl
BEGIN {
my @REQ_MODULES = qw/
Mojolicious
Text::CSV_XS
/;
require FindBin;
require lib;
@aero
aero / parse.pl
Created January 21, 2016 02:54
text section parsing
#!/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 December 23, 2015 08:46
Solving Mojolicious fork-based multi-processes daemon(eg. hypnotoad) Mojo::mysql connection timeout close issue.
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 / gist:0099cf0db451027af9f1
Last active August 29, 2015 14:22
compile Alien::wxWidgets 0.67 on MacOSX yosemite
perl Build.PL --wxWidgets-extraflags="CFLAGS='-I/usr/local/Cellar/xz/5.2.1/include -I/usr/local/Cellar/jpeg/8d/include' CPPFLAGS='-I/usr/local/Cellar/xz/5.2.1/include -I/usr/local/Cellar/jpeg/8d/include' CXXFLAGS='-I/usr/local/Cellar/xz/5.2.1/include -I/usr/local/Cellar/jpeg/8d/include' LDFLAGS='-L/usr/local/Cellar/xz/5.2.1/lib -L/usr/local/Cellar/jpeg/8d/lib'"
https://github.com/wxWidgets/wxWidgets/pull/40
https://github.com/eranif/codelite/issues/825
https://github.com/wxWidgets/wxWidgets/commit/ad21cc332ac906b9ae8f238ab135cbe410e78eba
http://goharsha.com/blog/compiling-wxwidgets-3-0-2-mac-os-x-yosemite/ 도 참고
# Rexfile
use Expect;
set connection => "OpenSSH";
my $expect_timeout = 5;
my $git_password = 'f00b4r';
my $sudo_password = 'test';
@aero
aero / json_ordered.pl
Last active August 29, 2015 14:20 — forked from olegwtf/json_ordered.pl
json을 읽어 원래 json 필드 순서 유지
use strict;
use Tie::IxHash;
use JSON::PP;
# magic start
my $obj_parser_sub = \&JSON::PP::object;
*JSON::PP::object = sub {
tie my %obj, 'Tie::IxHash';
$obj_parser_sub->(\%obj);
@aero
aero / readline_ev.cpp
Created March 12, 2015 09:12
Example: Integrating readline with libev eventloop.
// g++ -o readline_ev -g readline_ev.cpp -g -lreadline -lev
//
#include <stdlib.h>
#include <unistd.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <ev.h>
#include <fcntl.h>
@aero
aero / bench.pl
Created July 22, 2013 02:15
p5-mop-redux benchmark
#!/usr/bin/env perl
use 5.012;
use warnings;
use blib;
use Benchmark qw/cmpthese/;
use mop; # 2013-07-22
{
package Raw;