Skip to content

Instantly share code, notes, and snippets.

aero aero

  • Seoul, Republic of Korea
View GitHub Profile
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 );
View kspell_old.pl
#!/usr/bin/env perl
use strict;
use warnings;
use LWP::UserAgent;
use Encode qw/encode decode from_to/;
my $ua = LWP::UserAgent->new;
my $text = $ARGV[0];
my $unitext = decode('utf8', $text);
View kspell.pl
#!/usr/bin/env perl
# 사용법
# chmod a+x kspell.pl
# ./kspell.pl "안뇽하세요? 방갑습니다."
use strict;
use warnings;
use WebService::KoreanSpeller;
use Encode qw/encode decode/;
my $text = decode('utf8', $ARGV[0]);
View _vimrc
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
"source $VIMRUNTIME/mswin.vim
"behave mswin
"------------------ my config start ------------------
syntax on
set fencs=ucs-bom,utf-8,cp949
"매치하는 괄호를 보여준다.
View nagios_check_port.pl
#!/usr/bin/env perl
use strict;
use warnings;
use IO::Socket;
use threads;
use Thread::Queue;
my $count : shared;
my $hostcnt : shared;
You can’t perform that action at this time.