Skip to content

Instantly share code, notes, and snippets.

View practice's full-sized avatar

shawn.won practice

View GitHub Profile
@practice
practice / uri-basic.clj
Last active May 10, 2017 09:50
URI test
(let [uri (URI. "ceds://host.net/path1/p2?quiet#myidw")]
[(.getHost uri) (.getPath uri) (.getScheme uri) (.getQuery uri) (.getFragment uri)])
==> ["host.net" "/path1/p2" "ceds" "quiet" "myidw"]
@practice
practice / [์—ฌ์„ฑ ํ˜์˜ค๋ฅผ ํ˜์˜คํ•œ๋‹ค], ์šฐ์—๋…ธ ์น˜์ฆˆ์ฝ” ์ดˆ์ฒญ ํŠน๋ณ„ ๊ฐ•์—ฐ.md
Created June 7, 2016 06:38
[์—ฌ์„ฑ ํ˜์˜ค๋ฅผ ํ˜์˜คํ•œ๋‹ค], ์šฐ์—๋…ธ ์น˜์ฆˆ์ฝ” ์ดˆ์ฒญ ํŠน๋ณ„ ๊ฐ•์—ฐ

์›๋ณธ: https://www.evernote.com/shard/s68/sh/ba748859-8d7b-45e4-93bd-f79c98cf8c73/1c3d78abed20952583c2433d56d7d8b0

[์—ฌ์„ฑ ํ˜์˜ค๋ฅผ ํ˜์˜คํ•œ๋‹ค], ์šฐ์—๋…ธ ์น˜์ฆˆ์ฝ” ์ดˆ์ฒญ ํŠน๋ณ„ ๊ฐ•์—ฐ

  • ์•Œ๋ผ๋”˜ ์ธ๋ฌธํ•™์Šคํ„ฐ๋””

  • 2016๋…„ 6์›” 4์ผ ํ† ์š”์ผ ์˜คํ›„ 2์‹œ

  • ๋งˆํฌ๊ตฌ๋ฆฝ ์„œ๊ฐ•๋„์„œ๊ด€ 2์ธต ๋‹ค๋ชฉ์ ์‹ค

  • ํ†ต์—ญ ์„œํ˜œ์ •

  • ๋“ค์œผ๋ฉด์„œ ์ ์—ˆ์œผ๋ฏ€๋กœ ์˜ฎ๊ธฐ๋ฉด์„œ ๋‹ฌ๋ผ์กŒ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

private String r06Display(String code) {
if (code == null) {
return "";
}
if (code.equals("0")) {
return "์—†์Œ";
}
if (code.equals("1")) {
return "1mm ๋ฏธ๋งŒ";
}
@practice
practice / event ๋‚ ์”จ output.json
Last active November 5, 2015 07:32
๋””๋ฐ์ด๋‚ ์”จ API ์ƒ˜ํ”Œ
{
"dday": {
"id": 5728072679555072,
"accountId": "[email protected]",
"name": "์•„์ฃผ๋ฏธ๋ž˜",
"startTime": "2016-01-21 11:53 +0900",
"alarm": true,
"createdTime": "2015-09-23 11:54 +0900",
"enabled": true,
"location": "๋Œ€์ „๊ด‘์—ญ์‹œ ๋Œ€๋•๊ตฌ",

no contents

@practice
practice / cqrs notes.md
Last active August 29, 2015 14:26
cqrs notes
@practice
practice / gist:8c8bbec56f5538b9c665
Last active August 29, 2015 14:23
clojure restful service
;; handler
(def app
(-> (routes
api-routes ;; for rest api
(wrap-routes home-routes middleware/wrap-csrf) ;; for regular web site
base-routes)
middleware/wrap-base))
;; middleware์— ์žˆ๋Š” wrap-base
(defn wrap-formats [handler]
@practice
practice / ์ƒํ™œ์ฝ”๋”ฉ-docker-tutorial
Last active August 29, 2015 14:10
์ƒํ™œ์ฝ”๋”ฉ docker tutorial
http://opentutorials.org/course/128/8657
$ sudo apt-get update
$ curl -sSL https://get.docker.com/ubuntu/ | sudo sh # Docker๋ฅผ ์„ค์น˜ํ•˜์ž.
$ sudo docker images #์ด๋ฏธ์ง€ ๋ชฉ๋ก์„ ์‚ดํŽด๋ณด์ž. ์•„๋ฌด ๊ฒƒ๋„ ์—†๋‹ค.
$ sudo docker pull ubuntu:14.04 # ์šฐ๋ถ„ํˆฌ๋ฅผ ๋•ก์ผœ์˜ค์ž.
$ sudo docker run -i -t ubuntu:14.04 /bin/bash # ๋•ก๊ฒจ์˜จ ์šฐ๋ถ„ํˆฌ๋กœ bash๋ฅผ ์‹คํ–‰ํ•˜์ž.
$ # ๋‹ค๋ฅธ ํ„ฐ๋ฏธ๋„๋กœ ์ ‘์†ํ•ด ์•„๋ž˜์™€ ๊ฐ™์ด docker ps๋ฅผ ํ•˜๋ฉด ๋ฐฉ๊ธˆ ์‹คํ–‰ํ•œ bash๊ฐ€ ๋ณด์ธ๋‹ค. ์ด๊ฒŒ ์ง€๊ธˆ ์ปจํ…Œ์ด๋„ˆ์—์„œ ์‹คํ–‰๋˜๋Š” ๊ฒƒ์ด๋‹ค.
$ sudo docker ps -a # ์‹คํ–‰์ค‘์ธ ์ปจํ…Œ์ด๋„ˆ ๋ชฉ๋ก์„ ๋ณด์ž. -a๋Š” ์ข…๋ฃŒ๋œ ์ปจํ…Œ์ด๋„ˆ๋„ ๋ณด๋Š” ์˜ต์…˜.
@practice
practice / bash_profile_java
Created September 2, 2014 08:38
Switch jdk 6,7,8 from terminal in Mac OS X
# refer http://www.jayway.com/2014/01/15/how-to-switch-jdk-version-on-mac-os-x-maverick/
#creating a special home for Java 8
export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8)
#creating a special home for Java 7
export JAVA_7_HOME=$(/usr/libexec/java_home -v1.7)
#creating a special home for Java 6
export JAVA_6_HOME=$(/usr/libexec/java_home -v1.6)
private byte[] downloadFile(String downloadUrl) throws MalformedURLException,
IOException, ProtocolException {
URL url = new URL(downloadUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
ReadableByteChannel src = Channels.newChannel(connection.getInputStream());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
WritableByteChannel dest = Channels.newChannel(baos);
ChannelTools.fastChannelCopy(src, dest);