Skip to content

Instantly share code, notes, and snippets.

View therne's full-sized avatar
๐ŸŽฏ
Focusing

Jun Kim therne

๐ŸŽฏ
Focusing
View GitHub Profile
@therne
therne / gist:6177138
Last active December 20, 2015 18:39
MoonlightDriver API Documentation

Codename 'MoonlightDriver' REST API Documentation


1. Summary

๋ฉ”์ธ์„œ๋ฒ„๋Š” Google Web Toolkit (GWT)์„ ์‚ฌ์šฉํ•˜๋ฉฐ, Java EE๋กœ ์ž‘์„ฑ๋˜์—ˆ๋‹ค. ๋ฉ”์ธ์„œ๋ฒ„์— ๋ถ€์†๋œ ํ‘ธ์‹œ์„œ๋ฒ„๋Š” Google Cloud Messaging(GCM) ๊ธฐ์ˆ ์„ ์‚ฌ์šฉํ•˜๋ฉฐ, PHP๋กœ ์ž‘์„ฑ๋˜์—ˆ๋‹ค.

ํด๋ผ์ด์–ธํŠธ๋‹จ์—์„œ ์„œ๋ฒ„๋กœ์˜ ๋ชจ๋“  ํ˜ธ์ถœ์€ ๋น„๋™๊ธฐ์‹์œผ๋กœ ์ด๋ฃจ์–ด์ง€๋ฉฐ(Asynchronize), ์„œ๋ฒ„๋‹จ์—์„œ ์„œ๋ธ”๋ฆฟ์€ ๊ทธ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•ด JSON ํ˜•ํƒœ์˜ ๊ฒฐ๊ณผ๊ฐ’์„ HTTP Response๋กœ ๋ฐ˜ํ™˜ํ•œ๋‹ค.

@therne
therne / README.md
Last active December 30, 2015 22:49
Clutch API Documentation

Clutch Application Server

ํด๋Ÿฌ์น˜ ์„œ๋น„์Šค์˜ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„œ๋ฒ„์ด๋‹ค.

์„œ๋ฒ„ ์–ธ์–ด๋กœ๋Š” Node.js๋ฅผ ์‚ฌ์šฉํ•˜๋ฉฐ, ExpressJs ๋ฐ ejs๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ API์™€ ์›น ๋ฐฑ์—”๋“œ๋ฅผ ๊ตฌ์ถ•ํ•œ๋‹ค. ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—”์ง„์œผ๋กœ๋Š” MongoDB, ๋“œ๋ผ์ด๋ฒ„๋กœ๋Š” mongoose๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

ํด๋ผ์ด์–ธํŠธ๋‹จ์—์„œ ์„œ๋ฒ„๋กœ์˜ ๋ชจ๋“  ํ˜ธ์ถœ์€ ๋น„๋™๊ธฐ์‹์œผ๋กœ ์ด๋ฃจ์–ด์ง€๋ฉฐ(Asynchronize), ์„œ๋ฒ„๋Š” ๊ทธ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•ด JSON ํ˜•ํƒœ์˜ ๊ฒฐ๊ณผ๊ฐ’์„ HTTP ์‘๋‹ต ํ˜•ํƒœ(application/json)๋กœ ๋ฐ˜ํ™˜ํ•œ๋‹ค.

@therne
therne / gist:9013755
Created February 15, 2014 02:35
Rubbish XML Data...
<xml version="1.0" encoding="utf-8" ?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
<!-- This is an title area -->
<LinearLayout android:layout_width="match_parent" android:layout_height="48dp" android:orientation="horizontal">
<TextView android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center"
android:text="Google" android:textSize="18sp" android:textColor="#FFFFFF"
android:layout_marginLeft="8dp" android:layout_marginRight="16dp" />
<EditText android:layout_width="match_parent" android:layout_height="match_parent"
android:id="@+id/searchField" android:hint="Search Google" android:layout_weight="1.0" />
@therne
therne / Starter.java
Created January 31, 2015 09:10
The super, gorgeous and compatible Entrypoint class for Vert.x Gradle
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
/**
* Starter - Entry point of the Vert.x gradle module.
* @author vista
/**
* Glide (์ด๋ฏธ์ง€ ๋กœ๋”ฉ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ)๋ฅผ ์ดˆ๊ธฐํ™”ํ•œ๋‹ค.
*/
void initGlide() {
Glide.setup(new GlideBuilder(this)
.setDiskCache(DiskLruCacheWrapper.get(Glide.getPhotoCacheDir(this), DISK_CACHE_SIZE))
.setDecodeFormat(DecodeFormat.PREFER_RGB_565)
);
Glide.get(this).register(GlideUrl.class, InputStream.class,
new OkHttpUrlLoader.Factory(new OkHttpClient()));
@therne
therne / ISP.java
Last active August 29, 2015 14:21
SOLID : Interface Segregation Principle Example
/**
* ClientDataReceiver
* ํด๋ผ์ด์–ธํŠธ๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๊ฐ€ ์ˆ˜์‹ ๋  ๋•Œ ํ˜ธ์ถœ๋˜๋Š” ๋ฆฌ์‹œ๋ฒ„์ด๋‹ค.
*/
interface ClientDataReceiver {
public void onLoginDataReceive(User user);
public void onGamePlayDataReceive(PlayData data);
}
/**
@therne
therne / GeneratorFunctionBuilder.js
Last active August 29, 2015 14:26
GeneratorFunctionBuilder - Builds new generator function with code.
'use strict';
var util = require('util');
var GeneratorFunction = (function*(){}).constructor;
module.exports = GeneratorFunctionBuilder;
/**
* Builds new generator function with code.
*/
@therne
therne / kNN.md
Last active March 18, 2016 02:02

k-NN Algorithm

k-NN (k-Nearest Neighbors) ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ์ง€๋„ ํ•™์Šต ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ์ผ์ข…์œผ๋กœ, ์ด๋ฏธ ํŠน์ •ํ•œ ํ•ญ๋ชฉ (๋ผ๋ฒจ)๋กœ ๋ถ„๋ฅ˜๋˜์–ด ์žˆ๋Š” ๋ฐ์ดํ„ฐ๋“ค์„ ๊ฐ€์ง€๊ณ  ์•„์ง ๋ถ„๋ฅ˜๋˜์ง€ ์•Š์€ ์ƒˆ๋กœ์šด ๋ฐ์ดํ„ฐ๋ฅผ ์ž๋™์œผ๋กœ ๋ถ„๋ฅ˜ํ•˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด๋‹ค.

Regression ? Classification?

์ด ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ํšŒ๊ท€ (Regression)๋ณด๋‹ค๋Š” ๋ถ„๋ฅ˜ (Classification)๋ผ๊ณ  ๋ณผ ์ˆ˜ ์žˆ๋‹ค. ํšŒ๊ท€์˜ ๊ฒฝ์šฐ์—๋Š” ์—ฐ์†๋œ ๋ฐ์ดํ„ฐ์— ๊ด€ํ•ด์„œ ๋‹ค์Œ ๋ฐ์ดํ„ฐ์˜ ๊ฐ’์„ ์˜ˆ์ธกํ•˜๊ณ , ๋”ฐ๋ผ์„œ ์˜ˆ์ธก ๊ฒฐ๊ณผ๋Š” ์—ฐ์†๋ณ€์ˆ˜ (continuous variable)์ด ๋  ๊ฒƒ์ด๋‹ค. ํ•˜์ง€๋งŒ ์ด ๊ฒฝ์šฐ์—๋Š” ๋ถˆ์—ฐ์†์ ์ธ ๋ฐ์ดํ„ฐ๋“ค์˜ ์ง‘ํ•ฉ์— ๋Œ€ํ•ด์„œ ๋ถ„๋ฅ˜๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ณ , ์˜ˆ์ธก ๊ฒฐ๊ณผ๋Š” ์นดํ…Œ๊ณ ๋ฆฌ ๋ผ๋ฒจ์ด ๋  ๊ฒƒ์ด๋ฏ€๋กœ ๋ถ„๋ฅ˜๊ฐ€ ์ ํ•ฉํ•˜๋‹ค.

(ํ—ˆ๋‚˜ ํšŒ๊ท€ ์•Œ๊ณ ๋ฆฌ์ฆ˜๊ณผ ๋ถ„๋ฅ˜ ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ์™„์ „ํžˆ ์šฉ๋„๊ฐ€ ๊ตฌ๋ณ„๋œ ๊ฒƒ์ด ์•„๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ์„ ํ˜•ํšŒ๊ท€๋ฅผ ์ด์šฉํ•ด ๊ฒฝ๊ณ„๋ฉด์„ ๋งŒ๋“œ๋Š” ๋ฐฉ์‹์œผ๋กœ ๋ถ„๋ฅ˜๋ฅผ ํ•  ์ˆ˜๋„ ์žˆ๊ณ , k-NN์„ ์ด์šฉํ•ด ํšŒ๊ท€๋ฅผ ํ•  ์ˆ˜๋„ ์žˆ๋‹ค.)

๊ฐ„๋‹จํ•œ ์ด๋ก ์  ์›๋ฆฌ

@therne
therne / 1. Type Checking.md
Last active March 23, 2018 06:56
20160313 ์–ธ์–ด๋ก  ์Šคํ„ฐ๋”” ์ž๋ฃŒ (Lecture 4-2)

Type and Type Checking

์˜ค๋Š˜์˜ PPT ์ž๋ฃŒ ๋งํฌ

Type

์ •์˜ : ์–ด๋– ํ•œ ํ•ญ (Term)์— ๋Œ€ํ•ด์„œ, ๊ทธ ํ•ญ์€ ํƒ€์ž…์„ ๊ฐ€์ง€๊ณ  ์žˆ๊ณ  ๊ทธ ํ•ญ์˜ ์ž…๋ ฅ๊ณผ ๊ฒฐ๊ณผ๋Š” ๊ทธ ํƒ€์ž…์œผ๋กœ ์ œํ•œ๋œ๋‹ค.
ํ‘œ๊ธฐ M : A ๋Š”, M์ด A๋ผ๋Š” ํƒ€์ž…์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค๋Š” ์˜๋ฏธ์ด๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด, Integer List๋ผ๋Š” ํƒ€์ž…์€ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ท€๋‚ฉ์ ์œผ๋กœ ์ •์˜ํ•  ์ˆ˜ ์žˆ๋‹ค : type IntList = Empty | Int ** IntList.

@therne
therne / dataset.py
Created July 9, 2016 13:31
Batch data loader for minibatch training
import copy
import numpy as np
class DataSet:
def __init__(self, data, batch_size=1, shuffle=True, name="dataset"):
assert batch_size <= len(data), "batch size cannot be greater than data size."
self.name = name
self.data = data
self.batch_size = batch_size
self.shuffle = shuffle