Skip to content

Instantly share code, notes, and snippets.

View wookay's full-sized avatar
📟
갛낲닽랔맟밪상앗잡참칼탇판학

WooKyoung Noh wookay

📟
갛낲닽랔맟밪상앗잡참칼탇판학
View GitHub Profile
@wookay
wookay / prize.scala
Created January 9, 2015 14:35
prize.scala
class Prize {
var winners: List[Int] = List.empty
def play(list: List[Int]) : List[List[Int]] = {
var w = List[Int]()
var l = List[Int]()
for (idx <- 0 until list.length/2) {
val i = idx*2
if (list(i) < list(i+1)) {
w :+= list(i)
$ brew cask install basictex
$ sudo tlmgr update --self
$ sudo tlmgr install latexmk
@wookay
wookay / unary-function-chainer.jl
Created March 20, 2015 08:01
unary-function-chainer.jl
# http://www.codewars.com/kata/unary-function-chainer
# http://stackoverflow.com/questions/28713934/how-to-implement-unary-function-chainer-using-python
f1 = (x) -> x*2
f2 = (x) -> x+2
f3 = (x) -> x^2
chained(funcs) = reduce((f,g)->(n)->n|>f|>g, funcs)
@assert 4 == chained([f1 f2 f3])(0)
@wookay
wookay / gist:657a6c2adefc11f9312c
Created April 17, 2015 07:22
Picture code illustration for 3D face analysis
# https://mrkulk.github.io/www_cvpr15/1999.pdf
function PROGRAM(MU, PC, EV, VERTEX_ORDER)
# Scene Language: Stochastic Scene Gen
face=Dict();
shape = [];
texture = [];
for S in ["shape", "texture"]
for p in ["nose", "eyes", "outline", "lips"]
coeff = MvNormal(0,1,1,99)
@wookay
wookay / test_period.jl
Last active August 29, 2015 14:19
12-hour clock format
# load Dates module
import Base.Dates: AbstractTime, Month, Millisecond, Year, TimeType, Day, Hour, Minute, Second, Period, periodisless, yearmonthday, days, hour, minute, second, millisecond, default
import Base.Dates: DelimitedSlot, Slot, DayOfWeekSlot, slotparse
import Base.Dates: DateFormat, duplicates
Base.show(io::IO,x::DateTime) = print(io,string(x))
DateTime(dt::AbstractString,df::DateFormat=ISODateTimeFormat) = DateTime(parse(dt,df)...)
function getslot(x,slot::DelimitedSlot,df,cursor)
for filename in readdir(".")
if contains(filename, ".mpg")
mp3 = replace(filename, ".mpg", ".mp3")
if !isfile(mp3)
println("ffmpeg -i $filename -vn -ar 44100 -ac 2 -ab 192 -f mp3 $mp3")
end
end
end
@wookay
wookay / kangxi.jl
Created December 11, 2015 10:15
private project test
using KangXi
using FileTools
using Base.Test
db = mapper(f"2500.json", (:id, :hanja, :pinyin))
@test [5] == find(:id=>5, db)
@test [1,2,3,4,5] == find(d->d[:id]<=5, db)
# λ ~/.julia/v0.5/KangXi/test master julia runtests.jl
# Test Summary: | Pass Total
@wookay
wookay / TestSys.swift
Created January 30, 2016 02:58
TestSys.swift
//
// TestSys.swift
// Test
//
// Created by wookyoung on 1/29/16.
// Copyright © 2016 factorcat. All rights reserved.
//
import Foundation
import Foundation
class TestDates: WTestCase {
func test_dates() {
Assert.equal("ko", NSLocale.currentLocale().languageCode)
let d = NSDate(year: 2016, month: 2, day: 5, hour: 13, min: 2, sec: 3)
Assert.equal("", d.string(.NoStyle))
Assert.equal("2016. 2. 5. 오후 1:02", d.string(.ShortStyle))
import Foundation
class TestTranslate: WTestCase {
func test_locales() {
let en = NSLocale(localeIdentifier: "en_US")
Assert.equal("just now", en.translate("just now"))
let ko = NSLocale(localeIdentifier: "ko_KR")
Assert.equal("방금", ko.translate("just now"))