Skip to content

Instantly share code, notes, and snippets.

View gypark's full-sized avatar

Geunyoung Park (Raymundo, @gypark) gypark

View GitHub Profile
@gypark
gypark / backup.sh
Last active June 25, 2019 06:35 — forked from cedricvidal/backup.sh
ElasticSearch log index backup & restore scripts
#!/bin/bash
# herein we backup our indexes! this script should run at like 3 AM every first day of the month, after logstash
# rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas,
# compress the data files and backs up to whatever long term storage.
set -x
. ./config.sh
echo "Checking that index exist in ES"
@gypark
gypark / datetime.pl
Created February 3, 2015 03:15
DateTime math
!/usr/bin/env perl
use strict;
use warnings;
use DateTime;
use 5.010;
foreach my $date (
[ 1, 1 ],
[ 1, 27 ],
[ 1, 28 ],
#!/opt/perl
use Mojolicious::Lite;
use JSON;
get '/' => sub {
my $self = shift;
$self->render("index");
};
" Vim syntax file (for including only)
" html w/ Perl as a preprocessor in __DATA__
" Language: Mojo epl templates stored in Perl __DATA__
" Maintainer: yko <yko@cpan.org>
" Version: 0.04
" Last Change: 2011 Aug 09
" Location: http://github.com/yko/mojo.vim
"
" Thanks to Viacheslav Tykhanovskyi for simplified region syntax
@gypark
gypark / patch.diff
Created March 30, 2013 15:36 — forked from aero/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;
@gypark
gypark / test.c
Created June 29, 2012 03:53
매크로 테스트
#include <stdio.h>
#define debug_printf(x) printf("[%d, %s] %s", __LINE__, __FUNCTION__, (x))
int main() {
debug_printf("hello\n");
}
@gypark
gypark / tree.pl
Created May 9, 2012 09:55
substr과 재귀호출 vs 정규표현식 벤치마크
#!/usr/bin/env perl
use strict;
use warnings;
use Benchmark qw/:all/;
# 입력 (A,(B,(D,(d,_,_),_),(E,_,_)),(C,(F,_,(f,_,_)),(G,(g,_,_),_)))
# 위 입력을 받아 A를 root로 하는 트리 구조를 구성
#
# G
# g
@gypark
gypark / mp3dedup.pl
Created April 24, 2012 23:04
MP3 Duduper Core
#!/usr/bin/env perl
use 5.010;
use utf8;
use strict;
use warnings;
use autodie;
use File::Find;
use MP3::Info;
use Digest::MD5 qw/ md5_hex /;
@gypark
gypark / index.html
Created April 24, 2012 23:04
MP3 Duduper index.html
<html>
<head>
<title>MP3 Deduper</title>
<style type="text/css">
.btnRemove {
color: white;
font-size: 9pt;
background-color: #f66;
border: solid 1px red;
margin-left: 5px;
@gypark
gypark / cat_encode.pl
Created April 18, 2012 08:58
git diff 의 출력을 받아서 cp949 인코딩으로 변환하여 출력
#!/usr/bin/env perl
# git diff 의 출력을 받아서 인코딩을 변환하여 출력
# 예: git diff --color | cat_encode.pl
use strict;
use warnings;
use Encode;
use Encode::Guess;
my $pat_color = qr/(?:\e\[[;\d]*?m)/;