Skip to content

Instantly share code, notes, and snippets.

View suminb's full-sized avatar

Sumin Byeon suminb

View GitHub Profile
@suminb
suminb / performance_test.py
Last active March 22, 2019 03:29
Tail Recursion Elimination in Python
import timeit
recursive_code = """
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)
@suminb
suminb / convert.py
Last active November 5, 2018 16:25
WordPress 게시물을 .rst 형식으로 변환하는 스크립트
"""Converts old blog posts (from WordPress) to .rst files."""
import os
import re
import warnings
import pypandoc
import yaml
SOURCE_PATH = 'posts.bak'
@suminb
suminb / demo1.py
Last active July 2, 2018 17:17
Demo for a lecture at WISET (2018-05-11)
"""웹브라우저 띄워서 가져오는 예제 (느림)"""
import csv
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
{"context":{"dispatcher":{"stores":{"PageStore":{"currentPageName":"quote","currentRenderTargetId":"default","pagesConfigRaw":{"base":{"quote":{"layout":{"bundleName":"yahoodotcom-layout.TwoColumnLayout","name":"TwoColumnLayout","config":{"enableHeaderCollapse":true,"Header":{"isFixed":true,"uhContainerClasses":"Bgi($uhGrayGradient)","navContainerClasses":"Bgi($navrailGrayGradient) Bxsh($navrailShadow) Pos(r) hasScrolled_Bxsh(headerShadow) Panel-open_Bxsh(headerShadow)","height":135,"navTransitionClasses":"HideNavrail_Translate3d(0,-46px,0) Panel-open_Translate3d(0,-46px,0)","secondaryNavContainerClasses":"hasScrolled_Bdbw(0px) Bxsh($navrailShadow)"},"fetchNewAttribution":true},"meta":{"property":{"twitter:site":"@YahooFinance"}}},"meta":{"property":{"twitter:site":"@YahooFinance"}},"spaceid":95993639,"ads":{"events":{"adFetch":{"ps":"FB2,FB2-1,FB2-2,FB2-3,LDRB,LREC,LREC2,FOOT,FSRVY","firstRender":"FB2,FB2-1,FB2-2,FB2-3,LDRB,LREC"},"AUTO":{"autoDDG":0}},"deferRender":true,"positions":{"MAST":{"fclose":2,"fdb"
@suminb
suminb / aws_latency_map.html
Last active June 18, 2017 06:57
WIP: AWS world latency map
<!DOCTYPE html>
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.9/topojson.min.js"></script>
<script src="datamaps.world.hires.min.js"></script>
<div id="container" style="position: relative; width: 500px; height: 300px;"></div>
<script>
var aws = {
// Tokyo
@suminb
suminb / Nancy.cs
Created June 1, 2017 10:02
Nancy self-hosted web service
using System;
using Nancy;
using Nancy.Hosting.Self;
// netsh http add urlacl url="http://+:8029/" user="Everyone"
namespace WebFrontend
{
public class SampleModule : NancyModule
{
@suminb
suminb / index.tmpl
Created March 29, 2017 17:56
Golang Practice
<!-- This file must be under `templates` directory -->
<h1>Hello World!</h1>
<div>{{.}}</div>
<div>{{ .key }}</div>
from operator import attrgetter
import random
import sys
import click
from logbook import Logger, StreamHandler
StreamHandler(sys.stderr).push_application()
log = Logger(__name__)
@suminb
suminb / ocl_device_query.txt
Last active February 1, 2017 11:41
Run OpenCL code with Python
C:\users\suminb\Downloads\oclDeviceQuery.exe Starting...
OpenCL SW Info:
CL_PLATFORM_NAME: NVIDIA CUDA
CL_PLATFORM_VERSION: OpenCL 1.1 CUDA 6.5.14
OpenCL SDK Revision: 7027912
OpenCL Device Info:
@suminb
suminb / kanpsack.py
Last active October 27, 2016 15:41
이상한 호주 여행기 - 비용 정산 편에 소개 된 배낭 문제 코드입니다.
values = [
16199, 10906, 3382, 84725, 71294, 36372, 21256, 18555, 21636, 19425, 18688,
10482, 7613, 74453, 58176, 50942, 26950, 26582, 9589, 9520, 210198, 50818,
36992, 17732, 16953, 9971, 8031, 5247, 372309]
limit = 312967
def m(i, limit, values, taken, cache):
"""Calculates the maximum value that can be attained with total value less
than or equal to `limit`.