Skip to content

Instantly share code, notes, and snippets.

View parkjinwoo's full-sized avatar

Park Jinwoo parkjinwoo

View GitHub Profile
@parkjinwoo
parkjinwoo / index.php
Last active December 19, 2015 23:39
simple note
<?php
if (isset($_POST['text'])) {
$text = $_POST['text'];
$fo = fopen("./text.txt", "w") or die("can't open file");
fwrite($fo, $text);
fclose($fo);
}
$fc = file_get_contents("./text.txt");
?>
<!DOCTYPE html>
@parkjinwoo
parkjinwoo / encoding.md
Last active February 15, 2017 07:24
Unicode, UTF-8

CodePoint

  • U+0000~U+007F (ASCII)
  • U+AC00~U+D7A3 (가-힣)
  • hex(ord('a')) -> '0x61'
  • chr(int('0x61', 0)) -> 'a'
  • hex(ord('가')) -> '0xac00'
  • chr(int('0xac00', 0)) -> '가'

Unicode != UTF-8

  • U+AC00 != 0xEA B0 80
@parkjinwoo
parkjinwoo / perl.sh
Created July 24, 2013 07:15
Learning Perl
cat example.txt | perl -e 'while($line=<>){$line=~s/print/say/gi;print $line;}'
@parkjinwoo
parkjinwoo / NaverDrag01.url
Last active January 25, 2018 17:37
Naver Drag
javascript: function naver(q){ void(z=q.body.appendChild(q.createElement('script'))); void(z.language='javascript'); void(z.type='text/javascript'); void(z.src='http://userscripts.org/scripts/source/61326.user.js');} function selfw(w) { try{naver(w.document);} catch(e){} for (var i =0; i <w.frames.length; i++) { try{ selfw(w.frames[i]); } catch(e){} } } selfw(self);(function() { var e, i, all; document.onselectstart = null; document.oncontextmenu = null; all = document.getElementsByTagName("*"); for (i = 0; i < all.length; i += 1) { e = all[i]; e.onselectstart = null; e.oncontextmenu = null; } })();
@parkjinwoo
parkjinwoo / centering.html
Last active December 24, 2015 01:09
JavaScript: The Good Parts
<!DOCTYPE html>
<html>
<head>
<title>Centering</title>
<style type="text/css">
html, body, #wrapper {
height:100%;
margin: 0;
padding: 0;
border: none;
#!/usr/bin/env perl
use strict;
use LWP::Simple;
binmode(STDOUT, ":utf8");
my $url = "http://www.naver.com";
my $content = get($url);
die "Couldn't get it!" unless defined $content;
if ($content =~ m/<ol.*?id="realrank"(.*?)<\/ol>/gsmi){
@parkjinwoo
parkjinwoo / CanYourProgrammingLanguageDoThis.md
Last active December 24, 2015 01:29
Functional Programming

Can Your Programming Language Do This?

blah

console.log("Imagine There's No Heaven");
console.log("Imagine There's No Countries");
console.log("Imagine There's No Possessions");
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals, print_function
import sys, zipfile, shutil, os, fileinput
def inflate(filename):
print(filename)
zfile = zipfile.ZipFile(filename)
for f in zfile.namelist():
@parkjinwoo
parkjinwoo / ab_testing.md
Created December 3, 2014 12:35
A/B Testing

고객을 어떻게 나눌까?

  • 가령 운영중인 사이트가 **고객고유번호(user_id)**를 임의의 정수로 관리되고 있는 상태다.
  • 상품 소개 화면에서 구매버튼을 누르면 결제화면으로 넘어가는데,
  • 버튼 색깔에 변화를 줘서 테스트 하고 싶다.
  • 10%의 사용자에게는 빨간버튼을 보여주고,
  • 또 다른 10%의 사용자에게는 파란버튼을 보여주고,
  • 나머지 사용자에게는 원래버튼을 보여주고 싶다. 고객을 어떻게 나눌까?
  • **고객고유번호(user_id)**를 10으로 나눈 나머지는 0부터 9까지다.
  • 이 나머지 값이 같은 사용자끼리 같은 그룹으로 묶는다. 그룹0, 그룹1, ..., 그룹9.
  • 그룹0은 테스트 A로 그룹1는 테스트 B로 지정하고 싶다고 가정하자.
@parkjinwoo
parkjinwoo / 01_postcode.py
Last active August 29, 2015 14:13
Syrup Postcode
#!/usr/bin/env python
import csv
import json
import requests
def get_postcode(loc):
payload = {'q':loc}
res = requests.get('https://api.poesis.kr/post/search.php', params=payload)
result = res.json()