This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lcd import lcd | |
from functools import reduce | |
def main(): | |
n = reduce(lcd, range(1, 21)) | |
print(n) | |
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
read rcd # get root directory | |
find $rcd -type d -ctime +180 -prune -o -type f -name "*.ppt*" -print | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
packs=($(pip list | awk '{ print $1 }')) | |
length=${#packs[@]} | |
num=1 | |
for p in "${packs[@]} | |
do | |
echo "[$num / $length]: update package: $p" | |
pip install -U $p | |
num=$(( $num + 1 )) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum DesctructError: ErrorProtocol { | |
case outOfIndex(String) | |
} | |
func desctruct<A> (array: [A]) throws -> (A, A) { | |
guard array.count > 1 else { | |
throw DesctructError.outOfIndex("the array doesn't have enough elements.") | |
} | |
return (array[0], array[1]) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
46319725 를 정렬해본다. | |
46319725 : pivot = 4 | |
> < | |
46319725 | |
> < -> 교환! (교환후에는 무조건 1칸씩 전진한다) | |
26319745 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main = do | |
n <- readLn :: IO Int | |
a <- sequence . replicate n $ getLine | |
putStrLn . unwords $ a | |
-- do 가 아닌 모나드 연산자를 이용한 결합. | |
main' = (readLn :: IO Int) >>= (\n -> (sequence . replicate n $ getLine) >>= (\a -> puStrLn . unwords $ a)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private func perms <T>(pos: Int, _ arr:[T]) -> [T] { | |
let divmod: (Int, Int) -> (Int, Int)? = { a, b in | |
guard b != 0 else { return nil } | |
return (a / b, a % b) | |
} | |
let factorial: (Int) -> Int = { x in | |
if x < 2 { return nil } | |
return Array(2...x).reduce(1, combine: *) | |
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtWidgets import QApplication, QWidget | |
from temperature_object import Ui_Form | |
class MyForm(QWidget): | |
def __init__(self): | |
super(MyForm2, self).__init__() | |
# UI 셋업 과정을 위해서는 Ui_Form 인스턴스를 만들고, setupUi를 호출해야 한다. | |
# 이 때 넘겨지는 인자는 자신 혹은 특정한 QWidget 인스턴스이다. | |
self.ui = Ui_Form() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!c:/python34/python.exe | |
#coding:utf-8 | |
from urllib.request import urlopen | |
from bs4 import BeautifulSoup | |
from datetime import datetime | |
URL = "http://www.airkorea.or.kr/sido_compare_p01?itemCode=10007&ymd={}%2023&areaCode=031" | |
def make_datestamp(): | |
now = datetime.now() |