Skip to content

Instantly share code, notes, and snippets.

Avatar

aero aero

  • Seoul, Republic of Korea
View GitHub Profile
@aero
aero / readline_ev.cpp
Created Mar 12, 2015
Example: Integrating readline with libev eventloop.
View readline_ev.cpp
// 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 / json_ordered.pl
Last active Aug 29, 2015 — forked from olegwtf/json_ordered.pl
json을 읽어 원래 json 필드 순서 유지
View json_ordered.pl
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);
View gist:5cbb4823180bf1bb9438
# Rexfile
use Expect;
set connection => "OpenSSH";
my $expect_timeout = 5;
my $git_password = 'f00b4r';
my $sudo_password = 'test';
@aero
aero / gist:0099cf0db451027af9f1
Last active Aug 29, 2015
compile Alien::wxWidgets 0.67 on MacOSX yosemite
View gist:0099cf0db451027af9f1
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/ 도 참고
View gist:284520
#!/usr/bin/env perl
use strict;
use warnings;
use Schedule::Cron;
use Net::Twitter::Lite;
my $cron = Schedule::Cron->new( sub {} );
$cron->add_entry( '0 0-23 * * *', \&twit );
$cron->run( detach => 0 );
View check_follow.pl
#!/usr/bin/env perl
use strict;
use warnings;
use WWW::Mechanize;
$|=1;
my ( $user, $pass ) = ( 'user_id','user_password' );
my $mech = WWW::Mechanize->new();
#$mech->agent_alias( 'Windows IE 6' );
View josephus.pl
package Person;
# Create a new, living Person with the given position
sub new {
my ($class, %args) = @_;
my $self = bless { %args, alive => 1 };
bless $self, $class;
return $self;
}
# Create a chain of people
View josephus2.pl
package Person;
use parent 'Class::Accessor::Fast';
__PACKAGE__->mk_accessors(qw/position alive succ/);
# Create a new, living Person with the given position
sub new {
my ($class, $args) = @_;
return $class->SUPER::new( { %{$args}, alive => 1 } );
}
View josephus3.pl
package Person;
use Moose;
has 'position' => (is => 'ro', isa => 'Int');
has 'alive' => (is => 'rw', isa => 'Bool', default => 1);
has 'succ' => (is => 'rw', isa => 'Person', default => undef);
# Create a chain of people
sub createChain {
my ($self, $n) = @_;
return $self unless $n > 0;
View josephus4.pl
use MooseX::Declare;
class Person {
has 'position' => (is => 'ro', isa => 'Int');
has 'alive' => (is => 'rw', isa => 'Bool', default => 1);
has 'succ' => (is => 'rw', isa => 'Person', default => undef);
# Create a chain of people
method createChain(Int $n) {
return $self unless $n > 0;
my $succ = Person->new( position => $self->position+1 );
You can’t perform that action at this time.