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 / gist:1708008
Created January 31, 2012 01:17
이해할 수 없는 에러
sub split_string {
my ($str, $length) = @_;
my $chars = decode( $HttpCharset, $str );
my $first = substr( $chars, 0, $length );
my $last = substr( $chars, $length );
return ( encode( $HttpCharset, $first ), encode( $HttpCharset, $last ) );
}
@gypark
gypark / bashrc
Created February 22, 2012 19:46
수정한 ~/perl5/perlbrew/etc/bashrc
export PERLBREW_BASHRC_VERSION=0.41
[[ -z "$PERLBREW_ROOT" ]] && export PERLBREW_ROOT="$HOME/perl5/perlbrew"
[[ -z "$PERLBREW_HOME" ]] && export PERLBREW_HOME="$HOME/.perlbrew"
if [[ ! -n "$PERLBREW_SKIP_INIT" ]]; then
if [[ -f "$PERLBREW_HOME/init" ]]; then
. "$PERLBREW_HOME/init"
fi
fi
@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)/;
@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 / 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 / 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 / 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 / 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;
" Vim syntax file (for including only)
" html w/ Perl as a preprocessor in __DATA__
" Language: Mojo epl templates stored in Perl __DATA__
" Maintainer: yko <[email protected]>
" Version: 0.04
" Last Change: 2011 Aug 09
" Location: http://github.com/yko/mojo.vim
"
" Thanks to Viacheslav Tykhanovskyi for simplified region syntax
#!/opt/perl
use Mojolicious::Lite;
use JSON;
get '/' => sub {
my $self = shift;
$self->render("index");
};