Skip to content

Instantly share code, notes, and snippets.

@sng2c
sng2c / detect_repetition.md
Last active March 6, 2022 10:33
detect_repetition.md

리스트에 기호들이 들어 있을 때, 연속된 기호가 일정한 거리를 두고 다시 나타나는 것을 반복이라고 하기로 하구요. 그 연속되는 기호의 단위 묶음을 반복셋이라고 하겠습니다. 같은 위치에서 시작하는 반복셋은 여러개가 있을 수 있습니다.

A B C A B C 의 경우에는

A _ _ A _ _  : offset 2
A B _ A B _  : offset 1

A B C A B C : offset 0

#!/usr/bin/env perl
use lib './lib';
use Parse::Token::Lite;
use LWP::Simple;
my $urlpat = qr@https?://[0-9a-zA-Z-_#\?=&\.\@\%:/]+@;
my %rules = (
MAIN=>[
{name=>HTML_ENTITY_VAL, re=>qr/&\S+?;/},
{name=>HTML_COMMENT, re=>qr/<!--.+?-->/ms},
{name=>TAG_START_IN, re=>qr/<\!?\w+/, state=>[qw(+TAG_IN)] },
@sng2c
sng2c / startall.pl
Last active December 19, 2015 19:29
Simple scripts starting/stopping daemons with own screen sessions. Make 'autostart' directory, and put symbolic link dirs having 'start.sh' file in it.
#!/usr/bin/env perl
use strict;
use File::pushd;
my @apps = <autostart/*>; # Make 'autostart' directory, and put symbolic link dirs having 'start.sh' file in it.
foreach my $d (@apps){
my $dir = pushd($d);
$d =~ m@([^/]+)$@;
my $name = $1;
  • 올드보이 OST - The Last Waltz
  • 올드보이 OST - The Searchers
  • 올드보이 OST - Cries Of whispers
  • Damien Rice - Blower's Daughter
  • 다이나믹듀오 - 불면증
  • 다이나믹듀오 - 죽일놈
  • 브라운아이드 소울 - 2003.7.14 AM 2:43
  • 브라운아이드 소울 - 바보
@sng2c
sng2c / AREADME.md
Last active December 19, 2015 00:09
AutoHotKey와 Perl을 이용하여, VM에 띄워진 Window가 깜빡일 때 반응하여, Host Linux의 Notify로 띄워주는 스크립트들. Notify on a host os with blinking taskbar's title from a guest os on VM by AHK and Perl scripts.

Host 리눅스 쪽

  1. host인 리눅스 쪽에서는 perl모듈인 Mojolicious가 필요하고, notify-send 명령이 사용가능해야 한다.
  2. perl notify_recv.pl daemon 으로 웹서버를 띄운다. 포트값은 기본으로 3000번

VM내 윈도우 쪽

  1. VM안의 Windows는 Strawberry perl과 AutoHotKey를 설치한다.
  2. AlertFlash.ahk 와 send2linux.pl 을 함께 둔다.
  3. send2linux.pl 내의 IP값을 ipconfig명령의 결과에 보이는 Gateway 로 잡고 포트도 맞춰준다.
  4. AlertFlash.ahk를 실행한다.
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use Net::MyPeople::Bot;
use Data::Printer;
my $APIKEY = $ENV{MYPEOPLE_APIKEY};
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use JSON;
use LWP::UserAgent;
my $m = LWP::UserAgent->new;
binmode(STDOUT,':utf8');

source

#!/usr/bin/env perl 
use 5.010;
use utf8;
use Data::Dumper;
use Data::Dump;
use YAML;
use JSON;
use Data::Printer;

Perl 어플리케이션 배포하기

Abstraction

perl 어플리케이션을 개발하여 각 서버로 배포할 때, 모듈의존성을 해결하는 방법에 대해서 설명합니다.

CPAN

perl 스크립트를 작성할 때 CPAN (https://metacpan.org) 을 이용하면 방대한 양의 모듈, 상세한 문서, 다른 모듈을 기반으로 하여 높은 완성도를 이끌어 내는 perl만의 독특한 공유 문화 덕분에 손쉽게 복잡한 기능을 완벽하게 구현할 수 있습니다.

@sng2c
sng2c / build_crypto.sh
Last active December 16, 2015 17:09
PAR 암호화
# -T 는 임시디렉토리 명시
# -B 는 Core 모듈도 포함
pp -f Crypto -F Crypto -M Filter::Crypto::Decrypt -B -T partmp -o test1 test.pl
pp -f Crypto -F Crypto -M Filter::Crypto::Decrypt -B -o test1 test.pl