This file contains hidden or 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
| def primes(start, end): | |
| """ return an generator for primes in range. | |
| >>> next(primes(2,3)) | |
| 2 | |
| >>> list(primes(2,3)) | |
| [2] | |
| >>> list(primes(1,3)) | |
| [1, 2] | |
| >>> list(primes(5,3)) | |
| [3] |
This file contains hidden or 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 os | |
| import time | |
| from zipfile import ZipFile | |
| def unpack(filename, extract_dir=None): | |
| if not extract_dir: | |
| extract_dir = os.path.basename(filename).replace('.zip', '') | |
| with ZipFile(filename) as zf: | |
| for zi in zf.infolist(): |
This file contains hidden or 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
| >>> print('\n'.join([''.join(["%d*%d=%2s "%(i,j,i*j) for i in range(1,10)]) for j in range(1,10)])) | |
| 1*1= 1 2*1= 2 3*1= 3 4*1= 4 5*1= 5 6*1= 6 7*1= 7 8*1= 8 9*1= 9 | |
| 1*2= 2 2*2= 4 3*2= 6 4*2= 8 5*2=10 6*2=12 7*2=14 8*2=16 9*2=18 | |
| 1*3= 3 2*3= 6 3*3= 9 4*3=12 5*3=15 6*3=18 7*3=21 8*3=24 9*3=27 | |
| 1*4= 4 2*4= 8 3*4=12 4*4=16 5*4=20 6*4=24 7*4=28 8*4=32 9*4=36 | |
| 1*5= 5 2*5=10 3*5=15 4*5=20 5*5=25 6*5=30 7*5=35 8*5=40 9*5=45 | |
| 1*6= 6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36 7*6=42 8*6=48 9*6=54 | |
| 1*7= 7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49 8*7=56 9*7=63 | |
| 1*8= 8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64 9*8=72 | |
| 1*9= 9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81 |
This file contains hidden or 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
| #!/usr/bin/env python | |
| #coding:utf8 | |
| from datetime import datetime | |
| from influxdb import InfluxDBClient | |
| import fileinput | |
| import ast | |
| client = InfluxDBClient("localhost", 8086, 'guest', 'guest', 'twER') | |
| files = open('temp').read().splitlines() | |
| points =[] |
This file contains hidden or 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 | |
| def print_lol(the_list,indent=False,level=0,fh=sys.stdout): | |
| for each_item in the_list: | |
| if isinstance(each_item,list): | |
| print_lol(each_item,indent,level+1,fh) | |
| else: | |
| if indent: | |
| for tab_stop in range(level): | |
| print("\t",end='',file=fh) | |
| print(each_item,file=fh) |
We can't make this file beautiful and searchable because it's too large.
This file contains hidden or 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
| hospital name, serial number | |
| θ‘ηη¦ε©ι¨θΊει«ι’εεει’, 0101090019 | |
| θΊεεΈη«θ―ει«ι’, 0101090517 | |
| θ‘ηη¦ε©ι¨εΊιι«ι’, 0111070010 | |
| ζ°εεΈη«θ―ει«ι’, 0131020016 | |
| θ‘ηη¦ε©ι¨ζ¨ηηι€ι’, 0131060010 | |
| θ‘ηη¦ε©ι¨θΊει«ι’, 0131060029 | |
| θ‘ηη¦ε©ι¨ε «ιηι€ι’, 0131230012 | |
| θ‘ηη¦ε©ι¨ιιι«ι’, 0190030516 | |
| εΊιεΈη«ι«ι’, 0211070012 |
This file contains hidden or 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
| #!/usr/bin/env ptyhon | |
| #coding:UTF-8 | |
| import requests, json, re | |
| html = requests.get('http://www.chimei.org.tw/%E6%80%A5%E8%A8%BA%E5%8D%B3%E6%99%82%E8%A8%8A%E6%81%AF/main.aspx') | |
| pending = re.findall('">(.+?)</font>',html.text)[35:] | |
| pending[2:4] = [] | |
| values = [ int(ele) for ele in pending[1:] ] | |
| keys = ['pending_doctor', 'pending_ward', 'pending_icu', 'pending_bed'] | |
| report = { key:value for value, key in zip(values, keys) } |
This file contains hidden or 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
| #!/usr/bin/env ptyhon | |
| #coding:UTF-8 | |
| import requests, json, re | |
| html = requests.get('http://www.chimei.org.tw/%E6%80%A5%E8%A8%BA%E5%8D%B3%E6%99%82%E8%A8%8A%E6%81%AF/main.aspx') | |
| pending = re.findall('">(.+?)</font>',html.text)[21:28] | |
| pending[2:4] = [] | |
| values = [ int(ele) for ele in pending[1:] ] | |
| keys = ['pending_doctor', 'pending_ward', 'pending_icu', 'pending_bed'] | |
| report = { key:value for value, key in zip(values, keys) } |
This file contains hidden or 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
| #!/usr/bin/env python | |
| #coding:UTF-8 | |
| import requests, json, re | |
| html = requests.get('http://www.chimei.org.tw/%E6%80%A5%E8%A8%BA%E5%8D%B3%E6%99%82%E8%A8%8A%E6%81%AF/main.aspx') | |
| pending = re.findall('">(.+?)</font>',html.text)[7:14] | |
| pending[2:4] = [] | |
| values = [ int(ele) for ele in pending[1:] ] | |
| keys = ['pending_doctor', 'pending_ward', 'pending_icu', 'pending_bed'] | |
| report = { key:value for value, key in zip(values, keys) } |
This file contains hidden or 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
| #!/usr/bin/env python | |
| #coding:UTF-8 | |
| import requests, re, json, os | |
| from datetime import datetime | |
| os.environ['TZ'] = 'ROC' | |
| requests.packages.urllib3.disable_warnings() | |
| html = requests.get('https://reg.ntuh.gov.tw/EmgInfoBoard/NTUHEmgInfo.aspx') | |
| pending = re.findall(u'<td>(.+?)δΊΊ</td>', html.text) | |
| #parse like ['0', '2', '75', '4', '10'] |