generator에 대한 뭔가를 쓰다가 발견했다.
만들고 싶었던 함수는 이거.
def readlines(filename):
with open(filename, 'r') as f:
for line in f:
yield line
print ''.join(readlines('test.txt'))
#!/usr/bin/env python2.7 | |
# -*- coding: utf-8 -*- | |
''' | |
See also: | |
- Scrapy: framework | |
- lxml (faster parsing) | |
- BeautifulSoup: broken HTML | |
- html5lib | |
- xpath (alt. to CSS selectors) |
To the Citizens of Seoul, | |
I am not a citizen of your city, but I write you today out of urgency and dire concern for the future of your city’s education system. | |
My name is Candy Koh, once known as Hee Kyung Koh (고희경) during my residence in South Korea from the year 1991 to 1998. I am the first of two children between Yooah Park and Seung Duk Koh, a candidate for Seoul’s Superintendent of Education in the current elections. When his candidacy came to my attention recently, I could not, in good conscience, stay silent as his child. Seoul’s citizens deserve know the truth about the person they may be choosing to represent and be in charge of Seoul’s education system: Seung Duk Koh never partook in the education of his own children. | |
I was born in Cambridge, Massachusetts in 1987 while my mother and Koh were still married. After my brother was born in New Jersey in 1991, we all moved to Korea. I have next to no memories of his being present to teach me or my brother anything, even when I was old enough to have s |
# tmux config by Cheol Kang (kang@cheol.net) | |
# Set copy-mode as vi mode | |
set-window-option -g mode-keys vi | |
# Re-bind split-window | |
bind s split-window -v # horizontal | |
bind v split-window -h # vertical | |
# Re-bind select-pane |
/** | |
* Clip images, given as jQuery objects. | |
* @param img_obj jQuery Object | |
*/ | |
window.clipImage = (function() { | |
return function (img_obj) { | |
function setViewport(img, x, y, width, height) { | |
img.style.left = "-" + parseInt(x) + 'px'; | |
img.style.top = "-" + parseInt(y) + 'px'; | |
img.style.width = width === 'auto' ? width : parseInt(width) + 'px'; |
#!/usr/bin/env python | |
# -*- encoding: utf-8 -*- | |
from itertools import izip | |
from random import randint | |
from random import random as rand | |
GA_POPSIZE = 2048 | |
GA_MAXITER = 16384 | |
GA_ELITERATE = 0.1 |
#!/usr/bin/ | |
# -*- encoding:utf-8 -*- | |
from itertools import count, islice, takewhile, imap | |
import time | |
def primes1(candidates = count(2)): | |
# Pick a prime and yield. | |
prime = candidates.next() | |
yield prime |
generator에 대한 뭔가를 쓰다가 발견했다.
만들고 싶었던 함수는 이거.
def readlines(filename):
with open(filename, 'r') as f:
for line in f:
yield line
print ''.join(readlines('test.txt'))
ucat() { | |
cat $@ | native2ascii -encoding UTF-8 -reverse | |
} | |
uhead() { | |
head $@ | native2ascii -encoding UTF-8 -reverse | |
} |
서로 다른 stance에 서서 토론하는 것을 시각적으로 잘 표현한 댓글 시스템을 만들려는 시도.
첫 프로토타입으로 나왔으나 관심을 못 받아서 묻힘-_-;