Skip to content

Instantly share code, notes, and snippets.

View kimhyunkang's full-sized avatar

김현강 kimhyunkang

  • Google
  • Los Angeles, CA, USA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kimhyunkang on github.
  • I am kimhyunkang (https://keybase.io/kimhyunkang) on keybase.
  • I have a public key ASC3xAmiKlKgSuJ9QIDc0u2b3YfpeATJvO2H-k1JoaueAgo

To claim this, I am signing this object:

trait ParentTrait {
fn foo(&self);
}
trait ChildTrait: ParentTrait {
fn bar(&self);
}
struct ChildImpl;
@kimhyunkang
kimhyunkang / google_oauth.py
Created April 20, 2013 04:25
Google OAuth demo
#!/usr/bin/python
'demo Google OAuth'
import sys, os, urllib, urllib2, time, httplib
import hmac, hashlib, random, re, base64
PARAMETERS = {
'oauth_consumer_key': os.getenv('OAUTH_CONSUMER_KEY') or 'anonymous',
'oauth_signature_method': 'HMAC-SHA1',
'oauth_signature': '',
'oauth_timestamp': os.getenv('OAUTH_TIMESTAMP') or '%d' % time.time(),
'oauth_nonce': os.getenv('OAUTH_NONCE') or '%x' % random.getrandbits(64),
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Thu Nov 3 21:59:02 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .. done
(gdb) break rust_task_fail
Function "rust_task_fail" not defined.
@kimhyunkang
kimhyunkang / protobuf.rs
Created April 4, 2013 02:37
This source code fails to compile in rust-0.6
mod protobuf;
#[deriving(Eq)]
pub enum ProtoValue {
Variant(u64),
Fixed64(u64),
Bytes(~[u8]),
Fixed32(u32),
}
@kimhyunkang
kimhyunkang / search.hs
Created September 17, 2012 06:10
코딩 인터뷰 완전 분석 215쪽 문제 18.10 풀이
import System.IO (hFlush, stdout)
import Data.List (intercalate)
import qualified Data.Set as S
import qualified Data.Map as M
type Word = String
type Dict = [Word]
-- 특정 글자를 기준으로 스트링을 잘라 주는 함수
-- splitWith d s 는 d에 포함된 글자가 나오면 그 글자를 기준으로 스트링을 자른다
@kimhyunkang
kimhyunkang / fact_powers.hs
Created September 6, 2012 01:50
코딩 인터뷰 완전 분석 210쪽 17.3 변형 문제 풀이
import System.Environment (getArgs)
-- n = m^p * q
-- => power m n = (p, q)
power :: Int -> Int -> (Int, Int)
power m n | n `rem` m == 0 = let (p, q) = power m (n `quot` m)
in (p+1, q)
| otherwise = (0, n)
mod_exp2 :: Int -> Int
@kimhyunkang
kimhyunkang / cave.rb
Created January 18, 2012 04:55
Solution for Puzzlenode #11 "Hitting Rock Bottom"
class Cave
def initialize(lines)
# @layout is the layout of the cave
@layout = lines
# frontier means how many units of water did run forth at the depth
# @frontiers indicate the frontier of the water at each depth
# @frontiers will be [2, 4, 4, 5, 7] at the layout below
#~~ <-
##~~~ <-