Skip to content

Instantly share code, notes, and snippets.

View keitheis's full-sized avatar

Keith Yang keitheis

View GitHub Profile
def print_missing_number(nums):
should_be = 0
current = 0
for i, n in enumerate(nums, 1):
current += n
should_be += i
print(f"should_be: {should_be}, current: {current}")
print(should_be - current)
import re
# module global
room_terms_match = {
'rooms': r'房',
'livingrooms': r'廳',
}
@keitheis
keitheis / 0_Instructions.md
Last active November 18, 2016 08:50 — forked from ccwang002/0_Instructions.md
Miniconda on Windows 64bit

在 Windows 上安裝 Miniconda 選 Python 3.5 64bit

這邊用 Miniconda,選擇 Python 3.5 Windows 64-bit。

安裝 Anaconda 一樣沒有問題,兩個裡面是一樣的, 只是 Anaconda 預設下載了很多常用套件。

開一個 Command Prompt (Win+R -> cmd + [Enter]) 輸入 conda

import logging
logging.basicConfig(level=logging.INFO)
import alog
from threading import Thread
from multiprocessing import Process
def make_log(name, x):
def logging():
for i in range(5):
import alog
from threading import Thread
from multiprocessing import Process
def make_log(x):
def logging():
for i in range(5):
alog.info("loging {}:{}".format(x, i))
return logging
import time
import concurrent.futures
import rx
num_stream = [1, 2, 3, 4, 5]
def heavy_work(data):
time.sleep(1)
return data
@keitheis
keitheis / introrx.md
Created May 18, 2016 07:45 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@keitheis
keitheis / installation.rst
Created March 6, 2016 08:24 — forked from uranusjr/installation.rst
在各作業系統上安裝 Python 3.4。

設定 Python 環境

開始使用 Pyhton 之前,首先要確定電腦上能不能執行 Pyhton 程式。本教學將需要 Python 3.4 或更高的版本,因此請確認電腦上是否有對應版本。若不確定電腦上是否已經安裝 Python,建議直接按照以下步驟設定,以保證教學中的程式皆能夠正常執行。由於各作業系統安裝流程不同,以下請按照作業系統,選擇自己需要的部份閱讀。

Windows

@keitheis
keitheis / bulk_compile_plims.py
Last active August 29, 2015 14:07
Bulk compile plim files to mako files
"""
Usage:
1. Enter your plim templates folder
cd app/templates
2. Run this Python script
python bulk_compile_plims.py
3. Check it out
tree __plim_output
"""
from pathlib import Path
@keitheis
keitheis / failed_test_asset_spec_no_static_view.py
Created July 11, 2014 07:05
Failed test_asset_spec_no_static_view
________________ TestAssetSpecs.test_asset_spec_no_static_view _________________
self = <pyramid_webassets.tests.test_webassets.TestAssetSpecs testMethod=test_asset_spec_no_static_view>
def test_asset_spec_no_static_view(self):
from webassets import Bundle
self.create_files({
'dotted/__init__.py': '',
'dotted/package/__init__.py': '',