├── .gitignore ├── LICENSE.md ├── Plugins ├── ApiFramework │ ├── ApiFramework.py │ └── README.md ├── ChatLikeCMD │ ├── ChatLikeCMD.py │ └── README.md ├── CoordinateClient │ ├── CoordinateClient.py │ └── README.md ├── JoyStick │ ├── README.md │ ├── joystick.py │ └── run.py ├── LoadBar │ ├── LoadBar.py │ └── README.md ├── MailNotification │ ├── MailNotification.py │ ├── README.md │ └── config.json ├── MysqlClient │ ├── MysqlClient.py │ ├── README.md │ └── Sqlite3Client.py ├── ProgressBar │ ├── ProgressBar.py │ └── README.md ├── ProgressRecorder │ ├── ProcessRecorder.py │ └── README.md ├── QRCode │ ├── QR.jpg │ ├── QRCode.py │ └── README.md └── Tuling │ ├── tuling.json │ └── tuling.py ├── Programs ├── AutoTranslate │ ├── main.py │ └── models │ │ ├── TranslateClient.py │ │ ├── TranslateClient.pyc │ │ ├── __init__.py │ │ └── __init__.pyc ├── Evernote │ ├── EvernoteController │ │ ├── Oauth.py │ │ ├── README.md │ │ ├── Storage.py │ │ ├── __init__.py │ │ ├── __init__.pyc │ │ ├── controller.py │ │ ├── controller.pyc │ │ ├── oauth.pyc │ │ └── storage.pyc │ ├── Memo │ │ ├── EvernoteController.py │ │ ├── Memo.py │ │ ├── README.md │ │ ├── content.enex │ │ ├── example.png │ │ └── header.enex │ └── PackMemo │ │ ├── EvernoteController.py │ │ ├── Memo.py │ │ ├── PackMemo.bat │ │ ├── PackMemo.py │ │ ├── README.md │ │ ├── content.enex │ │ ├── example.png │ │ └── header.enex ├── LogUpdater │ ├── .gitignore │ ├── README.md │ ├── atta.xml │ ├── client │ │ ├── ExcelClient.py │ │ ├── LogClient.py │ │ ├── LogClient_old.py │ │ ├── OutlookAttachViewClient.py │ │ └── __init__.py │ ├── data │ │ └── storage │ │ │ ├── upload-20160302.xls │ │ │ └── upload-20160303.xls │ ├── infolist │ │ ├── cases.xlsx │ │ ├── config.json │ │ └── userNameStorage.xls │ ├── lib │ │ ├── __init__.py │ │ ├── config.py │ │ ├── makeuploadfile.py │ │ ├── producexml.py │ │ └── uploadlog.py │ └── run.py ├── PCMusicViaWechat │ ├── .gitignore │ ├── README.md │ └── run.py └── SetBurpProxy │ ├── README.md │ └── SetBurpProxy.py ├── README.md └── Scripts ├── ChangeEncode.py ├── DaYuSMS.py ├── ExcelClient.py ├── IdentificationNumber ├── IdentificationNumber.py └── district.cfg ├── LogInput&Output ├── py2.py └── py3.py ├── SMSBomb.py ├── SendToMyself.py ├── TimeCalculate.py ├── TranslateClient.py ├── WechatArticlePicDownloader.py ├── ascii.py ├── baidusearch.py └── qtimageconvert.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.swp 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | **The MIT License (MIT)** 2 | 3 | Copyright (c) 2016 LittleCoder ([littlecodersh@Github](https://github.com/littlecodersh)) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | 11 | -------------------------------------------------------------------------------- /Plugins/ApiFramework/ApiFramework.py: -------------------------------------------------------------------------------- 1 | __all__ = ['ApiFramework'] 2 | 3 | __API_LIST = { 4 | 'document':{ 5 | 'get': 'Get document', 6 | }, 7 | } 8 | class ApiError(AttributeError): 9 | def __init__(self, path): 10 | self.message = "api has no attribute '%s'"%'.'.join(path) 11 | self.args = (self.message,) 12 | class ApiFramework(object): 13 | def __init__(self, apiList = {}, warning = False, path = []): 14 | self.apiList = apiList 15 | self.warning = apiList != {} and warning 16 | self.path = path 17 | def __getattr__(self, s): 18 | try: 19 | tmpApi = self.apiList 20 | for name in self.path + [s]: tmpApi = tmpApi[name] 21 | except: 22 | if self.warning: raise ApiError(self.path + [s]) 23 | api = ApiFramework(self.apiList, self.warning, self.path + [s]) 24 | else: 25 | api = ApiFramework(self.apiList, self.warning, self.path + [s]) 26 | api.__doc__ = tmpApi 27 | return api 28 | def __call__(self, *args, **kwargs): 29 | return self.path 30 | 31 | if __name__ == '__main__': 32 | api = ApiFramework(__API_LIST, True) 33 | print(api.document.get()) 34 | print(api.document.send()) 35 | -------------------------------------------------------------------------------- /Plugins/ApiFramework/README.md: -------------------------------------------------------------------------------- 1 | #ApiFramework 160427 2 | Aimed at: 3 | Create api in a quiet easy way 4 | Environment: 5 | Windows 8.1 - 64 6 | Python 2.7.10 7 | Attention: 8 | Pay attention to the setting of api list 9 | 10 | 目标: 11 | 简单快速,创建api 12 | 环境: 13 | Windows 8.1 - 64 14 | Python 2.7.10 15 | 注意事项: 16 | 注意api list的创建 17 | -------------------------------------------------------------------------------- /Plugins/ChatLikeCMD/ChatLikeCMD.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import thread, time, sys, os, platform 3 | 4 | try: 5 | import termios, tty 6 | termios.tcgetattr, termios.tcsetattr 7 | import threading 8 | OS = 'Linux' 9 | except (ImportError, AttributeError): 10 | try: 11 | import msvcrt 12 | OS = 'Windows' 13 | except ImportError: 14 | raise Exception('Mac is currently not supported') 15 | OS = 'Mac' 16 | else: 17 | getch = msvcrt.getwch 18 | else: 19 | def fn(): 20 | try: 21 | fd = sys.stdin.fileno() 22 | old_settings = termios.tcgetattr(fd) 23 | tty.setraw(fd) 24 | ch = sys.stdin.read(1) 25 | except: 26 | termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) 27 | raise Exception 28 | termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) 29 | return ch 30 | getch = fn 31 | 32 | CMD_HISTORY = 30 33 | 34 | class ChatLikeCMD(): 35 | def __init__(self, header = 'LittleCoder', symbol = '>', inPip = None, inputMaintain = False): 36 | self.strBuff = [] 37 | self.cmdBuff = [] 38 | self.historyCmd = -1 39 | self.cursor = 0 40 | self.inPip = [] if inPip == None else inPip 41 | self.outPip = [] 42 | self.isLaunch = False 43 | self.isPause = False 44 | self.header = header 45 | self.symbol = symbol 46 | self.inputMaintain = inputMaintain 47 | def reprint_input(self): 48 | sys.stdout.write(self.header + self.symbol) 49 | if self.strBuff: 50 | for i in self.strBuff: sys.stdout.write(i) 51 | sys.stdout.flush() 52 | def getch(self): 53 | c = getch() 54 | return c if c != '\r' else '\n' 55 | def get_history_command(self, direction): 56 | if direction == 'UP': 57 | if self.historyCmd < CMD_HISTORY - 1 and self.historyCmd < len(self.cmdBuff) - 1: self.historyCmd += 1 58 | else: 59 | if self.historyCmd == 0: return '' 60 | if self.historyCmd > 0: self.historyCmd -= 1 61 | if -1 < self.historyCmd < len(self.cmdBuff): return self.cmdBuff[self.historyCmd] 62 | def output_command(self, s): 63 | self.outPip.append(s if isinstance(s, unicode) else s.decode(sys.stdin.encoding)) 64 | if len(self.cmdBuff) >= CMD_HISTORY: self.cmdBuff = self.cmdBuff[::-1].pop()[::-1] 65 | self.cmdBuff.append(s) 66 | def print_thread(self): 67 | while self.isLaunch: 68 | if self.inPip: 69 | sys.stdout.write('\r' + ' ' * 50 + '\r') 70 | sys.stdout.flush() 71 | print self.inPip.pop() 72 | # linux special 73 | sys.stdout.write('\r') 74 | sys.stdout.flush() 75 | self.reprint_input() 76 | time.sleep(0.01) 77 | def fast_input_test(self): 78 | timer = threading.Timer(0.001, thread.interrupt_main) 79 | c = None 80 | try: 81 | timer.start() 82 | c = getch() 83 | except: 84 | pass 85 | timer.cancel() 86 | return c 87 | def process_direction_char(self, c): 88 | if OS == 'Windows': 89 | if ord(c) == 72: 90 | c = 'A' 91 | elif ord(c) == 80: 92 | c = 'B' 93 | elif ord(c) == 77: 94 | c = 'C' 95 | elif ord(c) == 75: 96 | c = 'D' 97 | if ord(c) == 68: # LEFT 98 | self.process_char('\b') 99 | return 100 | # cursor bugs 101 | if self.cursor > 0: 102 | if OS == 'Windows': 103 | sys.stdout.write(chr(224) + chr(75)) 104 | else: 105 | sys.stdout.write(chr(27) + '[C') 106 | self.cursor -= 1 107 | elif ord(c) == 67: # RIGHT 108 | return 109 | # cursor bugs 110 | if self.cursor < len(self.strBuff): 111 | if OS == 'Windows': 112 | sys.stdout.write(chr(224) + chr(77)) 113 | else: 114 | sys.stdout.write(chr(27) + '[D') 115 | self.cursor += 1 116 | elif ord(c) == 65: # UP 117 | hc = self.get_history_command('UP') 118 | if not hc is None: 119 | self.strBuff = [i for i in hc] 120 | self.cursor = len(hc) 121 | sys.stdout.write('\r' + ' ' * 50 + '\r') 122 | self.reprint_input() 123 | elif ord(c) == 66: # DOWN 124 | hc = self.get_history_command('DOWN') 125 | if not hc is None: 126 | self.strBuff = [i for i in hc] 127 | self.cursor = len(hc) 128 | sys.stdout.write('\r' + ' ' * 50 + '\r') 129 | self.reprint_input() 130 | else: 131 | raise Exception(c) 132 | def process_char(self, c): 133 | if ord(c) == 27: # Esc 134 | if OS == 'Linux': 135 | fitc1 = self.fast_input_test() 136 | if ord(fitc1) == 91: 137 | fitc2 = self.fast_input_test() 138 | if 65 <= ord(fitc2) <= 68: 139 | self.process_direction_char(fitc2) 140 | return 141 | sys.stdout.write('\r' + ' ' * 50 + '\r') 142 | sys.stdout.flush() 143 | self.reprint_input() 144 | self.outPip.append(c) 145 | time.sleep(0.02) 146 | if 'fitc1' in dir(): 147 | self.process_char(fitc1) 148 | self.cursor += 1 149 | if 'fitc2' in dir(): 150 | self.process_char(fitc2) 151 | self.cursor += 1 152 | elif ord(c) == 3: # Ctrl+C 153 | self.stop() 154 | self.isPause = True 155 | if raw_input('Exit?(y) ') == 'y': 156 | sys.stdout.write('Command Line Exit') 157 | else: 158 | self.start() 159 | self.isPause = False 160 | elif ord(c) in (8, 127): # Backspace 161 | if self.strBuff: 162 | if ord(self.strBuff[-1]) < 128: 163 | sys.stdout.write('\b \b') 164 | else: 165 | sys.stdout.write('\b\b \b') 166 | if OS == 'Linux': 167 | self.strBuff.pop() 168 | self.strBuff.pop() 169 | self.strBuff.pop() 170 | self.cursor -= 1 171 | elif c == '\n': 172 | if self.strBuff: 173 | if self.inputMaintain: 174 | sys.stdout.write(c) 175 | else: 176 | sys.stdout.write('\r' + ' ' * 50 + '\r') 177 | sys.stdout.flush() 178 | self.reprint_input() 179 | self.output_command(''.join(self.strBuff)) 180 | self.strBuff = [] 181 | self.historyCmd = -1 182 | elif ord(c) == 224: # Windows direction 183 | if OS == 'Windows': 184 | direction = self.getch() 185 | self.process_direction_char(direction) 186 | else: 187 | sys.stdout.write(c) 188 | sys.stdout.flush() 189 | self.strBuff.append(c) 190 | self.cursor += 1 191 | def command_thread(self): 192 | c = None 193 | while self.isLaunch: 194 | c = self.getch() 195 | self.process_char(c) 196 | time.sleep(0.01) 197 | def start(self): 198 | self.isLaunch = True 199 | thread.start_new_thread(self.print_thread, ()) 200 | self.reprint_input() 201 | thread.start_new_thread(self.command_thread, ()) 202 | def stop(self): 203 | sys.stdout.write('\r' + ' ' * 50 + '\r') 204 | sys.stdout.flush() 205 | self.isLaunch = False 206 | def print_line(self, msg = None): 207 | self.inPip.append(msg) 208 | def clear(self): 209 | os.system('cls' if platform.system() == 'Windows' else 'clear') 210 | self.reprint_input() 211 | def get_command_pip(self): 212 | return self.outPip 213 | def set_header(self, header): 214 | self.header = header 215 | 216 | if __name__ == '__main__': 217 | c = ChatLikeCMD() 218 | s = c.get_command_pip() 219 | c.start() 220 | def loopinput(c): 221 | while True: 222 | c.print_line('LOOP INPUT......') 223 | time.sleep(3) 224 | thread.start_new_thread(loopinput, (c,)) 225 | while c.isLaunch or c.isPause: 226 | if s: 227 | c.print_line(s.pop()) 228 | time.sleep(0.01) 229 | -------------------------------------------------------------------------------- /Plugins/ChatLikeCMD/README.md: -------------------------------------------------------------------------------- 1 | #ChatLikeCMD 160125 2 | Aimed at: 3 | let input and output of command line not to disturb each other 4 | create a command line environment like chatroom 5 | Environment: 6 | Windows 8.1 - 64 7 | Python 2.7.10 8 | Attention: 9 | some Mac is not supported currently 10 | more than 50 letters on one line will result into residual letters 11 | 12 | 目标: 13 | 使命令行的输入与命令行的输出互不影响 14 | 创建聊天室般的命令行环境 15 | 环境: 16 | Windows 8.1 - 64 17 | Python 2.7.10 18 | 注意事项: 19 | 目前一些Mac电脑暂时无法支持 20 | 单行超过五十个字符(二十五个中文)会出现残留字符问题 21 | -------------------------------------------------------------------------------- /Plugins/CoordinateClient/CoordinateClient.py: -------------------------------------------------------------------------------- 1 | from PIL import Image 2 | import sys, os 3 | 4 | class CoordinateClient(): 5 | def __init__(self, size = {'x':1000,'y':1000}, splitline = {'x':[100,200], 'y':[500]} 6 | , blank = {'x':0, 'y':0}, padding = {'x':0, 'y':0}, backgroundcolor = (255,255,255)): 7 | self.color = { 'black': (0,0,0), 'white':(255,255,255), 'red':(255,0,0), 'grey':(96,96,96) } 8 | self.size = {xy: value + 1 for xy, value in size.items()} 9 | self.splitline = splitline 10 | self.blank = blank 11 | self.maxlayer = 0 12 | self.padding = padding 13 | self.backgroundcolor = backgroundcolor 14 | self.img = self.create_img(self.size, self.blank, self.padding) # self.img = Image.open(fileName) 15 | self.create_splitline(splitline) 16 | def create_img(self, size, blank, padding): 17 | def fn(xy): return (2 * size[xy] - 1) * blank[xy] + (size[xy] - 1) * padding[xy] + size[xy] 18 | img = Image.new("RGB",(fn('x'), fn('y')), self.backgroundcolor) 19 | return img 20 | def inside_xy_change(self, x, y, blank = None, padding = None): 21 | if blank is None: blank = self.blank 22 | if padding is None: padding = self.padding 23 | def fn(i, xy): return (1 + 2 * blank[xy] + padding[xy]) * i 24 | return (fn(x, 'x'), fn(y, 'y')) 25 | def get_point(self, x, y, adjust = None, img = None, blank = None, padding = None): 26 | if img is None: img = self.img 27 | if adjust is None: adjust = (0,0) 28 | inside_xy = self.inside_xy_change(x, y, blank, padding) 29 | return img.getpixel((inside_xy[0] + adjust[0], inside_xy[1] + adjust[1])) 30 | def add_point(self, x, y, color = None): 31 | def is_blank(x, y, adjust = None): return self.get_point(x, y, adjust) in (self.backgroundcolor, self.color['grey']) 32 | def has_space(layer, x, y): 33 | for adjust in range(layer + 1): 34 | # * * * 1. first test point in xy direction 35 | # * * * 2. then test the rest layer in order of distance 36 | # * * * 3. return adjust if has space else false 37 | for direction in (-1, 1): # up, right, down, left 38 | if is_blank(x, y, (adjust * direction, layer)): return (adjust * direction, layer) 39 | if is_blank(x, y, (layer, adjust * direction)): return (layer, adjust * direction) 40 | if is_blank(x, y, (adjust * direction, -layer)): return (adjust * direction, -layer) 41 | if is_blank(x, y, (-layer, adjust * direction)): return (-layer, adjust * direction) 42 | return False 43 | if color is None: color = self.color['black'] 44 | addPointAdjust = (0,0) 45 | if not is_blank(x, y): 46 | layer = 1 47 | currentLayer = self.blank['y'] if self.blank['y'] < self.blank['x'] else self.blank['x'] 48 | while layer <= currentLayer: 49 | adjust = has_space(layer, x, y) 50 | if adjust: break 51 | layer += 1 52 | if currentLayer < layer: 53 | self.resize_img(blank = {'x': self.blank['x'] if layer < self.blank['x'] else layer, 54 | 'y': self.blank['y'] if layer < self.blank['y'] else layer}) 55 | adjust = (0, layer) 56 | if self.maxlayer < layer: self.maxlayer = layer 57 | addPointAdjust = adjust 58 | inside_xy = self.inside_xy_change(x,y) 59 | self.img.putpixel((inside_xy[0] + addPointAdjust[0], inside_xy[1] + addPointAdjust[1]), color) 60 | def create_splitline(self, splitline = None): 61 | if splitline is None: splitline = self.splitline 62 | for x in splitline['x']: 63 | for y in range(self.size['y']): 64 | self.add_point(x, y, self.color['grey']) 65 | for y in splitline['y']: 66 | for x in range(self.size['x']): 67 | self.add_point(x, y, self.color['grey']) 68 | def resize_img(self, size = None, blank = {'x':0, 'y':0}, padding = {'x':0, 'y':0}): 69 | size = self.size if size is None else {xy: value + 1 for xy, value in size.items()} 70 | old_img = self.img 71 | old_size = self.size 72 | old_blank = self.blank 73 | old_padding = self.padding 74 | self.size = size 75 | self.blank = blank 76 | self.padding = padding 77 | self.img = self.create_img(size, blank, padding) 78 | self.create_splitline() 79 | for x in range(1, old_size['x']): 80 | for y in range(1, old_size['y']): 81 | # add the xy point 82 | pointColor = self.get_point(x, y, None, old_img, old_blank, old_padding) 83 | if pointColor != self.backgroundcolor: self.add_point(x, y, pointColor) 84 | # add the point in blank areas 85 | blank_min = {'x': old_blank['x'] if old_blank['x'] < blank['x'] else blank['x'], 86 | 'y': old_blank['y'] if old_blank['y'] < blank['y'] else blank['y']} 87 | for adjust_x in range(-blank_min['x'], blank_min['x'] + 1): 88 | for adjust_y in range(-blank_min['y'], blank_min['y'] + 1): 89 | if self.get_point(x, y, (adjust_x, adjust_y), old_img, old_blank, old_padding) != self.backgroundcolor: 90 | if (adjust_x, adjust_y) != (0,0): self.add_point(x, y, pointColor) 91 | def save(self, filename = 'coordinate.png'): 92 | save_img = self.create_img(self.size, self.blank, self.padding) 93 | x_size, y_size = self.img.size 94 | for x in range(x_size): 95 | for y in range(y_size): 96 | save_img.putpixel((x, y), self.img.getpixel((x, y_size - y - 1))) 97 | save_img.save(filename, 'PNG') 98 | 99 | if __name__ == '__main__': 100 | cc = CoordinateClient(size = {'x':5, 'y':5}, splitline = {'x':range(0, 6), 'y': range(0, 6)}) 101 | cc.save() 102 | -------------------------------------------------------------------------------- /Plugins/CoordinateClient/README.md: -------------------------------------------------------------------------------- 1 | #CoordinateClient 160223 2 | Aimed at: 3 | Make some data analyze with picture coordinate 4 | Environment: 5 | Windows 8.1 - 64 6 | Python 2.7.10 (with Image installed) 7 | Attention: 8 | Variables: 9 | size: produce a x-y size coordinate 10 | splitline: build splitline on specific points of both axis 11 | blank: blank space for data point to expand 12 | padding: padding of two data point, blank is not in padding 13 | Functions: 14 | create_img: create image 15 | inside_xy_change: change user's input xy to actual position on picture 16 | get_point: return state of point specificed by user's input xy 17 | add_point: add data (blank->filled, filled->expand to blank) based on input xy 18 | create_splitline: create splitline 19 | resize_img: resize the image 20 | save: save the image 21 | Tips: 22 | Image will automatically resize when blank is not enough for expanditure 23 | xy will not change with the actual size, so don't worry 24 | 25 | 目标: 26 | 使用图片坐标轴直观的展示数据分布、趋势情况 27 | 环境: 28 | Windows 8.1 - 64 29 | Python 2.7.10 (使用Image插件) 30 | 注意事项: 31 | 变量解释: 32 | size: 生成x * y的坐标轴 33 | splitline: x, y轴特定值上建立辅助线 34 | blank: 每个数据节点边上空出的扩张区间 35 | padding: 两个数据之间(数据包括了其blank)的间隔,即blank不在padding内 36 | 方法解释: 37 | create_img: 创建图片 38 | inside_xy_change: 将用户输入的x, y值转化为图片上实际的像素点坐标 39 | get_point: 获取用户输入的x, y值的点目前的状态(颜色) 40 | add_point: 在用户输入的x, y 值的点增加一个数据(无颜色->有颜色,有颜色->扩张) 41 | create_splitline: 添加辅助线 42 | resize_img: 重置图片大小 43 | save: 保存图片 44 | 特殊内容: 45 | 当blank不能容纳下数据节点的数据时图片会自动扩张 46 | 使用时不必在意图片的实际大小,任何大小时的xy值含义相同 47 | 48 | -------------------------------------------------------------------------------- /Plugins/JoyStick/README.md: -------------------------------------------------------------------------------- 1 | # joystick 160912 2 | 3 | joystick 提供了一个方便、易懂的操作手柄的方式 4 | 5 | ## Install 6 | 7 | 可以通过两种方式使用该代码段: 8 | 9 | **一种是通过安装remote-joystick** 10 | 11 | 通过该命令安装remote-joystick 12 | 13 | ```bash 14 | pip install remote-joystick 15 | ``` 16 | 17 | 之后在项目中这样导入joystick代码段: 18 | 19 | ```python 20 | from remote-joystick.models.controller.joystick import joystick 21 | ``` 22 | 23 | **另一种是直接将该代码直接放在项目目录下** 24 | 25 | 当然,你还是需要安装pygame 26 | 27 | ```bash 28 | pip install pygame 29 | ``` 30 | 31 | 之后在项目中这样导入joystick代码段: 32 | 33 | ```python 34 | from joystick import joystick 35 | ``` 36 | 37 | ## Usage 38 | 39 | 手柄有三种类型的输入:Button, Axis, Hat(按键,摇杆,方向板) 40 | 41 | 相对应的,这里给出三种注册装饰符:button_register, axis_register, hat_register 42 | 43 | 例如,我需要获取手柄上的A按键的状态,就可以这么写: 44 | 45 | ```python 46 | #coding=utf8 47 | from remotejoystick.models.controller.joystick import joystick 48 | 49 | js = joystick() 50 | 51 | # A为0号按键 52 | @js.button_register(0) 53 | def button_fn(motion): 54 | if motion == 'down': 55 | print('A is pressed') 56 | elif motion == 'up': 57 | print('A is released') 58 | 59 | if js.init(): 60 | js.start() 61 | try: 62 | print('Joystick is connected, press Ctrl-C to exit.') 63 | while 1: raw_input() 64 | except: 65 | print('Bye~') 66 | js.stop() 67 | else: 68 | print('Restart this program when joystick is plugged in') 69 | ``` 70 | 71 | 同样的,剩下的两种输入也是类似的注册。 72 | 73 | 具体如何操作可以参考我给出的[示例程序][demo-program] 74 | 75 | ## Attention 76 | 77 | 该程序在Windows 8.1 -64 Python 2.7.10 通过测试 78 | 79 | [demo-program]: https://github.com/littlecodersh/EasierLife/tree/master/Plugins/JoyStick/README.md 80 | -------------------------------------------------------------------------------- /Plugins/JoyStick/joystick.py: -------------------------------------------------------------------------------- 1 | import time, threading 2 | 3 | import pygame 4 | 5 | SCAN_TIME = 1.0 / 50 6 | 7 | class joystick(object): 8 | __functionDict = {'button':{}, 'axis':{}, 'hat':{}, } 9 | __statusDict = {'axis':{}, 'hat':{}, } 10 | __joyStick = None 11 | __alive = False 12 | def __init__(self): 13 | for i in range(5): self.__statusDict['axis'][i] = 0 14 | for i in range(2): self.__statusDict['hat'][i] = 0 15 | self.mainThread = threading.Thread(target=self.__main_thread_fn) 16 | self.mainThread.setDaemon(True) 17 | def __main_thread_fn(self): 18 | while 1: 19 | for event in pygame.event.get(): 20 | if event.type == pygame.JOYBUTTONDOWN: 21 | self.__functionDict['button'][event.button]('down') 22 | elif event.type == pygame.JOYBUTTONUP: 23 | self.__functionDict['button'][event.button]('up') 24 | for i in range(self.__joyStick.get_numaxes()): 25 | self.__switch_determine('axis', i, 26 | self.__get_axis_status(self.__joyStick.get_axis(i))) 27 | hatValue = self.__joyStick.get_hat(0) 28 | for i in range(2): self.__switch_determine('hat', i, hatValue[i]) 29 | def __get_axis_status(self, axisValue): 30 | if abs(axisValue) < .5: 31 | return 0 32 | elif axisValue < 0: 33 | return -1 34 | else: 35 | return 1 36 | def __switch_determine(self, part, number, status): 37 | if status != self.__statusDict[part][number]: 38 | if self.__statusDict[part][number] != 0: 39 | self.__functionDict[part].get( 40 | number, lambda x: None)(0) 41 | if status != 0: 42 | self.__functionDict[part].get( 43 | number, lambda x: None)(status) 44 | self.__statusDict[part][number] = status 45 | def available(self): 46 | return __joyStick is not None 47 | def init(self, stickNumber=0): 48 | try: 49 | pygame.init() 50 | pygame.joystick.init() 51 | self.__joyStick = pygame.joystick.Joystick(0) 52 | self.__joyStick.init() 53 | return True 54 | except pygame.error: 55 | return False 56 | def button_register(self, number): 57 | if not 0 <= number <= 9: 58 | raise Exception('No button %s.' % number) 59 | def _button_register(fn): 60 | self.__functionDict['button'][number] = fn 61 | return fn 62 | return _button_register 63 | def axis_register(self, number): 64 | if not 0 <= number <= 4: 65 | raise Exception('No axis %s.' % number) 66 | def _axis_register(fn): 67 | self.__functionDict['axis'][number] = fn 68 | return fn 69 | return _axis_register 70 | def hat_register(self, number): 71 | if not 0 <= number <= 1: 72 | raise Exception('No hat %s.' % number) 73 | def _hat_register(fn): 74 | self.__functionDict['hat'][number] = fn 75 | return fn 76 | return _hat_register 77 | def start(self): 78 | self.__alive = True 79 | self.mainThread.start() 80 | def stop(self): 81 | self.__alive = False 82 | pygame.quit() 83 | -------------------------------------------------------------------------------- /Plugins/JoyStick/run.py: -------------------------------------------------------------------------------- 1 | from joystick import joystick 2 | 3 | BUTTON_DICT = { 4 | 0: 'A', 1: 'B', 2: 'X', 3: 'Y', 4: 'L', 5 | 5: 'R', 6: 'C', 7: 'S', 8: 'U', 9: 'D', } 6 | DIRECTION_LIST = [ 7 | (0, 'left', 'right'), (1, 'up', 'down'), 8 | (2, 'E', 'F'), (3, 'G', 'H'), (4, 'I', 'J') ] 9 | HAT_LIST = [(0, 'M', 'N'), (1, 'O', 'P')] 10 | 11 | js = joystick() 12 | 13 | def key_down(key): 14 | print('%s is pressed' % key) 15 | def key_up(key): 16 | print('%s is released' % key) 17 | def registe_button(k, v): 18 | @js.button_register(k) 19 | def button_fn(motion): 20 | if motion == 'down': 21 | key_down(v) 22 | elif motion == 'up': 23 | key_up(v) 24 | def registe_axis_or_hat(register, i, neg, pos): 25 | @register(i) 26 | def axis_fn(status): 27 | if status == 0: 28 | key_up(neg); key_up(pos) 29 | elif status == 1: 30 | key_down(pos) 31 | elif status == -1: 32 | key_down(neg) 33 | 34 | for k, v in BUTTON_DICT.items(): registe_button(k, v) 35 | for directionTuple in DIRECTION_LIST: registe_axis_or_hat(js.axis_register, *directionTuple) 36 | for hatTuple in HAT_LIST: registe_axis_or_hat(js.hat_register, *hatTuple) 37 | 38 | js.init() 39 | js.start() 40 | try: 41 | while 1: raw_input() 42 | except: 43 | pass 44 | js.stop() 45 | -------------------------------------------------------------------------------- /Plugins/LoadBar/LoadBar.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | 3 | import getpass 4 | import thread 5 | import time 6 | import sys 7 | 8 | class LoadBar(object): 9 | progress = ("> ", ">> ", ">>>", " >>", " >", " ") 10 | clearLine = "\r" + " " * 40 + "\r" 11 | message = None 12 | isLaunch = False 13 | counter = 0 14 | 15 | @staticmethod 16 | def set_message(message, needLaunch=False): 17 | LoadBar.message = message 18 | if not LoadBar.isLaunch and needLaunch: 19 | LoadBar.launch() 20 | 21 | @staticmethod 22 | def launch(): 23 | LoadBar.counter = 0 24 | LoadBar.isLaunch = True 25 | thread.start_new_thread(LoadBar.draw, ()) 26 | 27 | @staticmethod 28 | def stop(): 29 | LoadBar.counter = -1 30 | print_line(LoadBar.clearLine, "") 31 | LoadBar.isLaunch = False 32 | 33 | @staticmethod 34 | def exit(code=0): 35 | LoadBar.stop() 36 | 37 | @staticmethod 38 | def draw(): 39 | try: 40 | if not LoadBar.isLaunch: 41 | return 42 | 43 | while LoadBar.counter >= 0: 44 | print_line(LoadBar.clearLine, "") 45 | LoadBar.counter += 1 46 | print_line("%s : %s" % (LoadBar.progress[LoadBar.counter % len(LoadBar.progress)], LoadBar.message), "") 47 | time.sleep(0.3) 48 | except: 49 | pass 50 | 51 | def LoadBarPause(fn, *args, **kwargs): 52 | def wrapped(*args, **kwargs): 53 | 54 | if not LoadBar.isLaunch: 55 | return fn(*args, **kwargs) 56 | 57 | LoadBar.stop() 58 | result = fn(*args, **kwargs) 59 | LoadBar.launch() 60 | return result 61 | 62 | return wrapped 63 | 64 | def LoadBarStop(fn, *args, **kwargs): 65 | def wrapped(*args, **kwargs): 66 | 67 | if not LoadBar.isLaunch: 68 | return fn(*args, **kwargs) 69 | 70 | LoadBar.stop() 71 | result = fn(*args, **kwargs) 72 | return result 73 | 74 | return wrapped 75 | 76 | @LoadBarPause 77 | def get_user_credentials(): 78 | username = raw_input("Login: ") 79 | password = getpass.getpass("Password: ") 80 | return (username, password) 81 | 82 | @LoadBarPause 83 | def confirm(message): 84 | print_line(message) 85 | while True: 86 | answer = raw_input("Yes/No: ") 87 | if answer.lower() in ["yes", "ye", "y"]: 88 | return True 89 | if answer.lower() in ["no", "n"]: 90 | return False 91 | print('Incorrect answer "%s", ' 92 | 'please try again:\n' % answer) 93 | 94 | @LoadBarPause 95 | def log_print(message): 96 | print message 97 | 98 | @LoadBarStop 99 | def exit_message(message): 100 | print_line(message, "\n") 101 | 102 | def print_line(line, endLine="\n", out=sys.stdout): 103 | message = line + endLine 104 | out.write(message) 105 | out.flush() 106 | 107 | if __name__ == '__main__': 108 | # Equals to LoadBar.set_message('..',True) >> 109 | LoadBar.set_message('Demonstrate of LoadBar') 110 | LoadBar.launch() 111 | # Equals to LoadBar.set_message('..',True) << 112 | time.sleep(3) 113 | 114 | msg = 'You have entered: ' + str(get_user_credentials()) 115 | log_print(msg) 116 | # Change LoadBar message 117 | LoadBar.set_message('You have entered the credentials') 118 | time.sleep(3) 119 | 120 | if confirm('CONTINUE?'): 121 | LoadBar.set_message('You have confirmed to continue') 122 | time.sleep(3) 123 | exit_message('Process Succeed') 124 | else: 125 | exit_message('You interrupted the process') 126 | -------------------------------------------------------------------------------- /Plugins/LoadBar/README.md: -------------------------------------------------------------------------------- 1 | #LoadBar 2 | Aimed at: 3 | Use LoadBar to tell user program is processing without stop interacting 4 | Environment: 5 | Windows 8.1 - 64 6 | Python 2.7.10 7 | Attention: 8 | Use LoadBar.set_message() to update the log bar on screen 9 | Use print_log() to print something on screen 10 | DON'T use normal output function when LoadBar is launching 11 | 12 | 目标: 13 | 通过进度栏在不影响交互的情况下让用户了解程序进行中 14 | 环境: 15 | Windows 8.1 - 64 16 | Python 2.7.10 17 | 注意事项: 18 | 通过 LoadBar.set_message() 更新进度栏 19 | 通过 print_log() 向屏幕上输出内容 20 | 在进度栏正在进行时,不要使用普通的输出方式 21 | 22 | Get From: geeknote 23 | -------------------------------------------------------------------------------- /Plugins/MailNotification/MailNotification.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import smtplib, json, time 3 | from email.mime.text import MIMEText 4 | 5 | RECEIVE_ACCOUNT = '2807342354@qq.com' 6 | 7 | class MailNotification(): 8 | def __init__(self): 9 | pass 10 | def __enter__(self): 11 | self.receiveAccount = RECEIVE_ACCOUNT 12 | self.get_account() 13 | self.connect_host() 14 | return self 15 | def get_account(self): 16 | with open('config.json') as f: 17 | config = json.loads(f.read()) 18 | self.account = config['account'] 19 | self.password = config['password'] 20 | self.host = config['host'] 21 | self.postfix = config['postfix'] 22 | def connect_host(self): 23 | self.server = smtplib.SMTP() 24 | self.server.connect(self.host) 25 | self.server.ehlo() 26 | self.server.starttls() 27 | self.server.ehlo() 28 | self.server.set_debuglevel(1) 29 | self.server.login(self.account, self.password) 30 | def send_text(self, from_, to_, subject, text, text_type): 31 | msg = MIMEText(text.encode('utf-8'), _subtype=text_type, _charset='utf-8') 32 | msg['Subject'] = subject.encode('utf-8') 33 | me = '<' + from_ + '>' 34 | msg['From'] = me 35 | msg['To'] = ';'.join(to_) 36 | self.server.sendmail(from_, to_, msg.as_string()) 37 | def send_notification(self, notification): 38 | self.send_text(self.account + self.postfix, [self.receiveAccount], 39 | 'Notification From Client', 40 | notification + '\n' + time.ctime(), 41 | 'plain') 42 | def __exit__(self, exc_type, exc_value, exc_tb): 43 | self.server.close() 44 | 45 | if __name__=='__main__': 46 | with MailNotification() as mail: 47 | mail.send_notification('First mail notification!') 48 | -------------------------------------------------------------------------------- /Plugins/MailNotification/README.md: -------------------------------------------------------------------------------- 1 | #MailNotification 160107 2 | Aimed at: 3 | Send emails to your email account 4 | It enables in-time update for time consuming tasks even if you are out 5 | If you want SMS notification, you may choose mail.139.com:) 6 | Environment: 7 | Windows 8.1 - 64 8 | Python 2.7.10 9 | Setting: 10 | config.json (like other json format files) 11 | 12 | 目标: 13 | 向指定的邮箱发送邮件 14 | 经常有一些耗时的任务,完成或者出问题时这样出门也能接到提醒 15 | 如果需要短信提醒建议使用139邮箱,有免费的短信:) 16 | 环境: 17 | Windows 8.1 - 64 18 | Python 2.7.10 19 | 设置: 20 | config.json (看后缀名也知道什么格式吧) 21 | -------------------------------------------------------------------------------- /Plugins/MailNotification/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "account": "account", 3 | "password": "pass", 4 | "host": "smtp.qq.com", 5 | "postfix": "@qq.com" 6 | } 7 | -------------------------------------------------------------------------------- /Plugins/MysqlClient/MysqlClient.py: -------------------------------------------------------------------------------- 1 | import MySQLdb, re, thread 2 | import json, sys 3 | 4 | DEFAULT_CONFIG = {'host': '127.0.0.1', 'port': 3306, 'user': 'root', 'passwd': 'root', 'db': 'witcampus', 'charset': 'utf8'} 5 | MAX_NUM = int(1e5) 6 | 7 | class MysqlClient: 8 | def __init__(self, **config): 9 | if not config: config = DEFAULT_CONFIG 10 | self._connection = MySQLdb.connect(**config) 11 | self._cursor = self._connection.cursor() 12 | self._storedDataSource = None 13 | self._cursor.execute('set sql_notes = 0') # disable warnings 14 | def set_emergency_mode(): 15 | self._cursor.execute('set global max_allowed_packet = 1024M') 16 | self._cursor.execute('set global wait_timeout = 600') 17 | def query(self, sql): 18 | self._cursor.execute(sql) 19 | return self._cursor.fetchall() 20 | def insert_data(self, tableName, items = []): 21 | items = ['"%s"'%item for item in items] 22 | self._cursor.execute('insert into %s values(%s)'%(tableName,', '.join(items))) 23 | self._connection.commit() 24 | def restruct_table(self, tableName, orderBy, restructedTableName = None): 25 | if restructedTableName is None: restructedTableName = 'restructed_' + tableName 26 | orderByString = ', '.join(['%s %s'%(key[0], key[1]) for key in orderBy]) 27 | self.query(self.query('show create table %s'%tableName)[0][1].replace(tableName, restructedTableName, 1)) 28 | sys.stdout.write('Restructuring the data storage...\r') 29 | totalNum = self.query('select count(*) from %s'%tableName)[0][0] 30 | s = self.data_source('select * from %s order by %s'%(tableName, orderByString)) 31 | count = 0 32 | totalCount = 0 33 | process = -1 34 | for data in s: 35 | insertSql = 'insert into %s values (%s)'%(restructedTableName, ', '.join(['%s' for i in range(len(data))])) 36 | self._cursor.execute(insertSql, data) 37 | count += 1 38 | totalCount += 1 39 | if process < totalCount * 100 / totalNum: 40 | process = totalCount * 100 / totalNum 41 | sys.stdout.flush() 42 | sys.stdout.write('Restructuring the data storage: %s%s\r'%(process, '%')) 43 | if count >= MAX_NUM: 44 | count = 0 45 | self._connection.commit() 46 | self._connection.commit() 47 | print 'Restructuring Finished' 48 | return restructedTableName 49 | def simple_data_source(self, sql): # return a function to provide one data at a time 50 | c = self._connection.cursor() 51 | c.execute(sql) 52 | for item in c.fetchall(): yield item 53 | def parallel_get_source_of_data_source(self, sql, beginNumber = 0): 54 | regex = re.compile('from (\S+)') 55 | tableName = re.findall(regex, sql)[0] 56 | totalNum = self.query('select count(*) from %s'%tableName)[0][0] 57 | unitNumber = totalNum / MAX_NUM + 1 58 | self._storedDataSource = self.simple_data_source('%s limit %s, %s'%(sql, beginNumber, MAX_NUM)) 59 | def get(i): 60 | self._storedDataSource = self.simple_data_source('%s limit %s, %s'%(sql, i * MAX_NUM, MAX_NUM)) 61 | if unitNumber == beginNumber / MAX_NUM: yield self._storedDataSource 62 | for i in range(beginNumber / MAX_NUM + 1, unitNumber + 1): 63 | while self._storedDataSource is None: print 'Thread sucks' 64 | r = self._storedDataSource 65 | self._storedDataSource = None 66 | thread.start_new_thread(get, (i,)) 67 | yield r 68 | def data_source(self, sql): # limit is now useless here 69 | regex = re.compile('(select .*? from .*?)(?: limit (\S+),.*)?$') 70 | r = re.findall(regex, sql)[0] 71 | sourceOfDataSource = self.parallel_get_source_of_data_source(r[0], int(r[1]) if r[1] else 0) 72 | for dataSource in sourceOfDataSource: 73 | for data in dataSource: yield data 74 | 75 | if __name__ == '__main__': 76 | mc = MysqlClient() 77 | mc.restruct_table('device', [('dev_id',''), ('node_des','desc')]) 78 | 79 | # a = {'a':'1',} 80 | # import datetime 81 | # mc.insert_data('acrecenv', ['json', datetime.datetime.now(), MySQLdb.escape_string(json.dumps(a))]) 82 | 83 | # r = mc.data_source('select * from dev_loc order by node_id limit 300, 100') 84 | # for item in r: print item 85 | -------------------------------------------------------------------------------- /Plugins/MysqlClient/README.md: -------------------------------------------------------------------------------- 1 | #MysqlClient 160223 2 | Aimed at: 3 | Save time when dealing with MySQL and make it easy to get data one by one 4 | Environment: 5 | Windows 8.1 - 64 6 | Python 2.7.10 (MySQLdb installed: https://pypi.python.org/pypi/MySQL-python/1.2.5) 7 | Attention: 8 | paralled input and fetch is in paralled_get_source_of_data_source function 9 | get function which is used to get data one by one from data_source function 10 | MAX_NUM can be changed based on local calculating speed and time consuming of data processing 11 | Deal to thread limit of sqlite3, I strongly recommended to use with statement 12 | 13 | 目标: 14 | 节省MySQL相关操作的时间以及实现逐条读出MySQL中的数据 15 | 环境: 16 | Windows 8.1 - 64 17 | Python 2.7.10 (安装MySQLdb: https://pypi.python.org/pypi/MySQL-python/1.2.5) 18 | 注意事项: 19 | 并行读取与输出的操作在paralled_get_source_of_data_source中 20 | 通过data_source方法获取用于逐个取出数据的方法 21 | MAX_NUM的量可以通过本机速度与数据处理语句的多少自行修改 22 | 由于Sqlite3的线程限制操作,建议每次使用都采取with语句 23 | -------------------------------------------------------------------------------- /Plugins/MysqlClient/Sqlite3Client.py: -------------------------------------------------------------------------------- 1 | import sqlite3, re, thread 2 | import json, sys 3 | 4 | MAX_NUM = int(2e4) 5 | 6 | class Sqlite3Client: 7 | def __enter__(self): 8 | return self 9 | def __init__(self, sqlDir): 10 | self.sqlDir = sqlDir 11 | self._connection = sqlite3.connect(sqlDir) 12 | self._cursor = self._connection.cursor() 13 | self._storedDataSource = None 14 | def execute(self, sql, data = []): 15 | self._cursor.execute(sql, data) 16 | self._connection.commit() 17 | def query(self, sql, data = []): 18 | self._cursor.execute(sql, data) 19 | return self._cursor.fetchall() 20 | def insert_data(self, tableName, items = []): 21 | self._cursor.execute('insert into %s values(%s)'%(tableName, 22 | ', '.join(['?' for i in items])), items) 23 | self._connection.commit() 24 | # the following 4 functions don't use safe execute and may cause problems 25 | # please make sure the input is safe before use them 26 | def restruct_table(self, tableName, orderBy, restructedTableName = None): 27 | if restructedTableName is None: restructedTableName = 'restructed_' + tableName 28 | orderByString = ', '.join(['%s %s'%(key[0], key[1]) for key in orderBy]) 29 | self.query(self.query('show create table %s'%tableName)[0][1].replace(tableName, restructedTableName, 1)) 30 | sys.stdout.write('Restructuring the data storage...\r') 31 | totalNum = self.query('select count(*) from %s'%tableName)[0][0] 32 | s = self.data_source('select * from %s order by %s'%(tableName, orderByString)) 33 | count = 0 34 | totalCount = 0 35 | process = -1 36 | for data in s: 37 | self.insert_data(restructedTableName, data) 38 | count += 1 39 | totalCount += 1 40 | if process < totalCount * 100 / totalNum: 41 | process = totalCount * 100 / totalNum 42 | sys.stdout.flush() 43 | sys.stdout.write('Restructuring the data storage: %s%s\r'%(process, '%')) 44 | if count >= MAX_NUM: 45 | count = 0 46 | self._connection.commit() 47 | self._connection.commit() 48 | print 'Restructuring Finished' 49 | return restructedTableName 50 | def simple_data_source(self, sql): # return a function to provide one data at a time 51 | c = self._connection.cursor() 52 | c.execute(sql) 53 | for item in c.fetchall(): yield item 54 | def parallel_get_source_of_data_source(self, sql, beginNumber = 0): 55 | regex = re.compile('from (\S+)') 56 | tableName = re.findall(regex, sql)[0] 57 | totalNum = self.query('select count(*) from %s'%tableName)[0][0] 58 | unitNumber = totalNum / MAX_NUM + 1 59 | self._storedDataSource = self.simple_data_source('%s limit %s, %s'%(sql, beginNumber, MAX_NUM)) 60 | def get(i): 61 | self._storedDataSource = self.simple_data_source('%s limit %s, %s'%(sql, i * MAX_NUM, MAX_NUM)) 62 | if unitNumber == beginNumber / MAX_NUM: yield self._storedDataSource 63 | for i in range(beginNumber / MAX_NUM + 1, unitNumber + 1): 64 | while self._storedDataSource is None: print 'Thread sucks' 65 | r = self._storedDataSource 66 | self._storedDataSource = None 67 | thread.start_new_thread(get, (i,)) 68 | yield r 69 | def data_source(self, sql): # limit is now useless here 70 | regex = re.compile('(select .*? from .*?)(?: limit (\S+),.*)?$') 71 | r = re.findall(regex, sql)[0] 72 | sourceOfDataSource = self.parallel_get_source_of_data_source(r[0], int(r[1]) if r[1] else 0) 73 | for dataSource in sourceOfDataSource: 74 | for data in dataSource: yield data 75 | def __exit__(self, *args): 76 | if self._cursor: self._cursor.close() 77 | if self._connection: self._connection.close() 78 | 79 | if __name__ == '__main__': 80 | with Sqlite3Client('wcStorage.db') as s3c: 81 | s3c.insert_data('message', items = [str({'a':'a'}),'a:""','a','a']) 82 | r = s3c.data_source('select * from message') 83 | for item in r: 84 | print item 85 | -------------------------------------------------------------------------------- /Plugins/ProgressBar/ProgressBar.py: -------------------------------------------------------------------------------- 1 | import sys, time 2 | 3 | class ProgressBar: 4 | def __enter__(self): 5 | return self 6 | def __init__(self, count=0, total=100, width=50): 7 | self.count=count 8 | self.total=total 9 | self.width=width 10 | def move(self, i=1): 11 | self.count+=i 12 | return True 13 | def move_to(self,count): 14 | self.count=count 15 | def log(self,s=''): 16 | if self.count > self.total: 17 | print 18 | raise Exception('Task Done!') 19 | sys.stdout.write(' '*(self.width+9)+'\r') 20 | sys.stdout.flush() 21 | if s != '': print s 22 | progress = self.width * self.count / self.total 23 | sys.stdout.write('{0:3}/{1:3}:'.format(self.count, self.total)) 24 | sys.stdout.write('|'*progress + '-'*(self.width - progress) + '\r') 25 | sys.stdout.flush() 26 | def __exit__(self, exc_type, exc_value, exc_tb): 27 | pass 28 | 29 | if __name__ == '__main__': 30 | with ProgressBar(0,50,50) as p: 31 | try: 32 | i = 0 33 | while p.move(): 34 | i+=1 35 | p.log('This is: ' + str(i)) 36 | time.sleep(.1) 37 | except Exception, e: 38 | print e 39 | -------------------------------------------------------------------------------- /Plugins/ProgressBar/README.md: -------------------------------------------------------------------------------- 1 | #ProgressBar 2 | Aimed at: 3 | Use progress bar to show how's the task processing 4 | Environment: 5 | Windows 8.1 - 64 6 | Python 2.7.10 7 | Attention: 8 | Use log() to update the progress bar on screen or print something on screen 9 | DON'T use normal output function after the first log() and before the final log() 10 | Total should be no more than 999 11 | 12 | 目标: 13 | 通过进度条类可以监控任务进程 14 | 环境: 15 | Windows 8.1 - 64 16 | Python 2.7.10 17 | 注意事项: 18 | 通过log()方法更新进度条或者向屏幕上输出内容 19 | 在第一次使用log()和最后一次使用log()之前,不要使用其他的普通输出方式 20 | total数值不要超过999哦(为嘛一定要超过呢) 21 | -------------------------------------------------------------------------------- /Plugins/ProgressRecorder/ProcessRecorder.py: -------------------------------------------------------------------------------- 1 | import sys, json 2 | 3 | class ProcessRecorder: 4 | def __enter__(self): 5 | return self 6 | def __init__(self, processName = 'DefaultProcess', localDataSet = {}, begin = None, total = None, warningMessage = '', jsonDir = ''): 7 | self.processName = processName 8 | self.localDataSet = localDataSet 9 | self.warningMessage = warningMessage 10 | self.jsonDir = jsonDir 11 | self.count = begin 12 | self.total = total 13 | self.process = -1 14 | self.jsonStorage = {} 15 | self.load_process() 16 | def load_process(self): 17 | try: 18 | with open('%sProcessRecorder.json'%self.jsonDir) as f: self.jsonStorage = json.loads(f.read()) 19 | process_data = self.jsonStorage[self.processName] 20 | # only dictate above may move to except 21 | for key in self.localDataSet: 22 | if process_data.has_key(key): self.localDataSet[key] = process_data[key] 23 | if self.count is None: self.count = process_data['__count'] 24 | if self.total is None: self.total = process_data['__total'] 25 | except: 26 | if self.count is None: self.count = 0 27 | if self.total is None: self.total = 100 28 | def store_process(self): 29 | if self.jsonStorage.has_key(self.processName): 30 | for key, value in self.localDataSet.items(): self.jsonStorage[self.processName][key] = self.localDataSet[key] 31 | else: 32 | self.jsonStorage[self.processName] = self.localDataSet 33 | self.jsonStorage[self.processName]['__count'] = self.count 34 | self.jsonStorage[self.processName]['__total'] = self.total 35 | with open('%sProcessRecorder.json'%self.jsonDir, 'w') as f: f.write(json.dumps(self.jsonStorage)) 36 | def clear_storage(self): 37 | tmp_json = self.jsonStorage 38 | del tmp_json[self.processName] 39 | with open('%sProcessRecorder.json'%self.jsonDir, 'w') as f: f.write(json.dumps(tmp_json)) 40 | def add(self, i = 1): 41 | self.count += i 42 | if self.process < self.count * 100 / self.total: 43 | self.process = self.count * 100 / self.total 44 | sys.stdout.write('%s: %s%s\r'%(self.warningMessage, self.process, '%')) 45 | sys.stdout.flush() 46 | def __exit__(self, exc_type, exc_value, exc_tb): 47 | self.store_process() 48 | 49 | if __name__ == '__main__': 50 | import time 51 | with ProcessRecorder(localDataSet = {'name':None, 'num':None, 'price':1}, warningMessage = 'First recorder') as pr: 52 | for key, value in pr.localDataSet.items(): print '%s: %s'%(key, value) 53 | for i in range(30): 54 | pr.add() 55 | time.sleep(0.05) 56 | pr.localDataSet['name'] = 'LittleCoder' 57 | pr.localDataSet['num'] = 1 58 | pr.localDataSet['price'] = '$1.99' 59 | print 'Pretent the program is closed and we start a new one' 60 | with ProcessRecorder(localDataSet = {'name':None, 'num':None, 'price':None}, warningMessage = 'First recorder') as pr: 61 | for key, value in pr.localDataSet.items(): print '%s: %s'%(key, value) 62 | for i in range(30): 63 | pr.add() 64 | time.sleep(0.05) 65 | -------------------------------------------------------------------------------- /Plugins/ProgressRecorder/README.md: -------------------------------------------------------------------------------- 1 | #ProcessRecorder 160226 2 | Aimed at: 3 | Automatically output the process of program 4 | Store environment when exception occurs and get that whenever you want 5 | Environment: 6 | Windows 8.1 - 64 7 | Python 2.7.10 8 | Attention: 9 | Use add function to update process and output 10 | 11 | 目标: 12 | 自动输出程序进度 13 | 在异常出现时保护环境变量并在下一次调用时取出 14 | 环境: 15 | Windows 8.1 - 64 16 | Python 2.7.10 17 | 注意事项: 18 | 通过add方法增加进度并输出 19 | -------------------------------------------------------------------------------- /Plugins/QRCode/QR.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Plugins/QRCode/QR.jpg -------------------------------------------------------------------------------- /Plugins/QRCode/QRCode.py: -------------------------------------------------------------------------------- 1 | from PIL import Image 2 | import sys, os 3 | 4 | QR_DIR = '.' 5 | try: 6 | b = u'\u2588' 7 | sys.stdout.write(b + '\r') 8 | sys.stdout.flush() 9 | except UnicodeEncodeError: 10 | BLOCK = 'MM' 11 | else: 12 | BLOCK = b 13 | 14 | class QRCode(): 15 | pass 16 | def print_cmd_qr(fileDir, size = 37, padding = 3, 17 | white = BLOCK, black = ' '): 18 | img = Image.open(fileDir) 19 | times = img.size[0] / (size + padding * 2) 20 | rgb = img.convert('RGB') 21 | sys.stdout.write(' '*50 + '\r') 22 | sys.stdout.flush() 23 | qr = white * (size + 2) + '\n' 24 | startPoint = padding + 0.5 25 | for y in range(size): 26 | qr += white 27 | for x in range(size): 28 | r,g,b = rgb.getpixel(((x + startPoint) * times, (y + startPoint) * times)) 29 | qr += white if r > 127 else black 30 | qr += white + '\n' 31 | qr += white * (size + 2) + '\n' 32 | sys.stdout.write(qr) 33 | 34 | if __name__ == '__main__': 35 | # 37 is for picture size without padding, 3 is padding 36 | # q = QRCode(os.path.join(QR_DIR, 'QR.jpg'), 37, 3, 'BLACK') 37 | print_cmd_qr(os.path.join(QR_DIR, 'QR.jpg')) 38 | -------------------------------------------------------------------------------- /Plugins/QRCode/README.md: -------------------------------------------------------------------------------- 1 | #QRCode 160216 2 | Aimed at: 3 | Output QRCode with size known 4 | Environment: 5 | Windows 8.1 - 64 6 | Python 2.7.10 (with Image installed) 7 | Attention: 8 | Remember to set the size when using 9 | 10 | 目标: 11 | 在命令行输出已知大小的标准二维码 12 | 环境: 13 | Windows 8.1 - 64 14 | Python 2.7.10(安装了Image) 15 | 注意事项: 16 | 调用的时候要注意设定二维码的大小 17 | -------------------------------------------------------------------------------- /Plugins/Tuling/tuling.json: -------------------------------------------------------------------------------- 1 | { 2 | "key": "e0daf2ded41fdc6e471377**********" 3 | } 4 | -------------------------------------------------------------------------------- /Plugins/Tuling/tuling.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import sys, os 3 | import requests, json 4 | 5 | try: 6 | with open('tuling.json') as f: key = json.loads(f.read())['key'] 7 | except: 8 | key = '' # if key is '', get_response will return None 9 | # raise Exception('There is something wrong with the format of you plugin/config/tuling.json') 10 | 11 | def get_response(msg, storageClass = None, userName = None, userid = 'ItChat'): 12 | url = 'http://www.tuling123.com/openapi/api' 13 | payloads = { 14 | 'key': key, 15 | 'info': msg, 16 | 'userid': userid, 17 | } 18 | try: 19 | r = requests.post(url, data = json.dumps(payloads)).json() 20 | except: 21 | return 22 | if not r['code'] in (100000, 200000, 302000, 308000, 313000, 314000): return 23 | if r['code'] == 100000: # 文本类 24 | return '\n'.join([r['text'].replace('
','\n')]) 25 | elif r['code'] == 200000: # 链接类 26 | return '\n'.join([r['text'].replace('
','\n'), r['url']]) 27 | elif r['code'] == 302000: # 新闻类 28 | l = [r['text'].replace('
','\n')] 29 | for n in r['list']: l.append('%s - %s'%(n['article'], n['detailurl'])) 30 | return '\n'.join(l) 31 | elif r['code'] == 308000: # 菜谱类 32 | l = [r['text'].replace('
','\n')] 33 | for n in r['list']: l.append('%s - %s'%(n['name'], n['detailurl'])) 34 | return '\n'.join(l) 35 | elif r['code'] == 313000: # 儿歌类 36 | return '\n'.join([r['text'].replace('
','\n')]) 37 | elif r['code'] == 314000: # 诗词类 38 | return '\n'.join([r['text'].replace('
','\n')]) 39 | 40 | if __name__ == '__main__': 41 | try: 42 | ipt = raw_input 43 | ipt = lambda: raw_input('>').decode(sys.stdin.encoding) 44 | except: 45 | ipt = lambda: input('>') 46 | while True: 47 | a = ipt() 48 | print(get_response(a, 'ItChat')) 49 | -------------------------------------------------------------------------------- /Programs/AutoTranslate/main.py: -------------------------------------------------------------------------------- 1 | #!python3 2 | import sys, threading 3 | import traceback 4 | 5 | from PyQt5.QtWidgets import (QApplication, QMainWindow, QDesktopWidget, 6 | QPushButton, QTextEdit) 7 | from PyQt5.QtCore import pyqtSignal, QObject, Qt 8 | 9 | from models.TranslateClient import TranslateClient 10 | 11 | PORT = 1080 12 | RETRY = 3 13 | 14 | class Clipboard(object): 15 | def __init__(self, clipboard): 16 | self.clipboard = clipboard 17 | self.lock = False 18 | self.contentThread = self._content_thread() 19 | def _content_thread(self): 20 | def __clipboard_set(msg): 21 | self.lock = True 22 | def fn(): self.lock = False 23 | self.clipboard.setText(msg) 24 | threading.Timer(.1, fn).start() 25 | while 1: 26 | __clipboard_set((yield)) 27 | def set(self, msg): 28 | self.contentThread.send(None) 29 | self.contentThread.send(msg) 30 | def get(self): 31 | data = self.clipboard.mimeData() 32 | if not data.hasText(): return '' 33 | return data.text() 34 | class Communication(QObject): 35 | translateFinish = pyqtSignal() 36 | class MainWindow(QMainWindow): 37 | text = '' 38 | def __init__(self, app): 39 | super().__init__(None, Qt.WindowStaysOnTopHint) 40 | self.init_ui() 41 | self.set_communication() 42 | self.set_clipboard(app) 43 | self.set_translation() 44 | self.show_info('准备好了') 45 | def init_ui(self): 46 | self.setWindowOpacity(.7) 47 | self.setWindowTitle('翻译小能手') 48 | self.resize(200, 100) 49 | screen = QDesktopWidget().screenGeometry() 50 | size = self.geometry() 51 | self.move((screen.width() - size.width())/2, (screen.height() - size.height())/2) 52 | self.textEdit = QTextEdit() 53 | self.setCentralWidget(self.textEdit) 54 | def set_communication(self): 55 | self.communication = Communication() 56 | self.communication.translateFinish.connect(self.update_main_window) 57 | def set_clipboard(self, app): 58 | clipboard = app.clipboard() 59 | clipboard.dataChanged.connect(self.clipboard_changed) 60 | self.clipboard = Clipboard(clipboard) 61 | def set_translation(self): 62 | self.tc = TranslateClient() 63 | self.tc.set_proxies({}) 64 | def update_main_window(self, finish = True): 65 | if self.text: 66 | self.show_text(self.text) 67 | self.show_info('翻译成功' if finish else '翻译中') 68 | # set function should be run in main thread 69 | if finish: self.clipboard.set(self.text) 70 | else: 71 | self.show_info('翻译失败') 72 | def clipboard_changed(self): 73 | if self.clipboard.lock: return 74 | text = self.clipboard.get() 75 | if text == '': return 76 | self.text = text 77 | self.update_main_window(False) 78 | translateThread = threading.Thread(target = self._translate, args = (text, )) 79 | translateThread.setDaemon(True) 80 | translateThread.start() 81 | def _translate(self, text): 82 | for i in range(RETRY): # set retry 83 | try: 84 | text = self.tc.get(text) 85 | except: 86 | if i == 2: 87 | traceback.print_exc() 88 | self.text = '' 89 | break 90 | else: 91 | self.text = text 92 | self.communication.translateFinish.emit() 93 | def show_text(self, msg): 94 | self.textEdit.setText(msg) 95 | def show_info(self, msg): 96 | self.statusBar().showMessage(msg) 97 | 98 | def main(): 99 | app = QApplication(sys.argv) 100 | mainWindow = MainWindow(app) 101 | mainWindow.show() 102 | mainWindow.show_text('测试') 103 | sys.exit(app.exec_()) 104 | 105 | if __name__ == '__main__': 106 | main() 107 | -------------------------------------------------------------------------------- /Programs/AutoTranslate/models/TranslateClient.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | proxies = { 4 | "http": "http://127.0.0.1:1080", 5 | "https": "https://127.0.0.1:1080", } 6 | headers = { 7 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0', } 8 | url = 'http://translate.google.cn/translate_a/t' 9 | 10 | class TranslateClient(object): 11 | def __init__(self): 12 | self.params = { 13 | 'client': 'p', 14 | 'ie': 'UTF-8', 15 | 'oe': 'UTF-8', 16 | 'tl': None, 17 | 'sl': None, 18 | 'text': None, } 19 | self.proxies = proxies 20 | def get(self, text, tl = 'zh-CN', sl = 'auto'): 21 | self.params['text'] = text 22 | self.params['tl'] = tl 23 | self.params['sl'] = sl 24 | return requests.post(url, self.params, headers = headers, proxies = self.proxies).json()[0] 25 | def set_proxies(self, proxies): 26 | self.proxies = proxies 27 | 28 | if __name__ == '__main__': 29 | tc = TranslateClient() 30 | tc.set_proxies({ 31 | "http": "http://127.0.0.1:22397", 32 | "https": "https://127.0.0.1:22397", }) 33 | print(tc.get('测试')) 34 | -------------------------------------------------------------------------------- /Programs/AutoTranslate/models/TranslateClient.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/AutoTranslate/models/TranslateClient.pyc -------------------------------------------------------------------------------- /Programs/AutoTranslate/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/AutoTranslate/models/__init__.py -------------------------------------------------------------------------------- /Programs/AutoTranslate/models/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/AutoTranslate/models/__init__.pyc -------------------------------------------------------------------------------- /Programs/Evernote/EvernoteController/Oauth.py: -------------------------------------------------------------------------------- 1 | import requests, getpass 2 | 3 | class Oauth(object): 4 | def __init__(self, consumerKey, consumerSecret, sandbox = True, isInternational = False): 5 | if sanbox: 6 | self.host = 'sandbox.evernote.com' 7 | elif isInternational: 8 | self.host = 'app.evernote.com' 9 | else: 10 | self.host = 'app.yinxiang.com' 11 | self.host = host 12 | self.consumerKey = consumerKey 13 | self.consumerSecret = consumerSecret 14 | def oauth(self): 15 | self.__get_tmp_token() 16 | self.__get_ver() 17 | return self.__get_token() 18 | def __get_tmp_token(self): 19 | payload = { 20 | 'oauth_callback': '127.0.0.1', 21 | 'oauth_consumer_key': self.consumerKey, 22 | 'oauth_signature': self.consumerSecret, 23 | 'oauth_signature_method': 'PLAINTEXT', 24 | } 25 | r = requests.get('https://%s/oauth'%self.host, params = payload) 26 | if not 'oauth_token' in r.text: raise Exception('oauth_token not found') 27 | self.tmpOauthToken = dict(item.split('=',1) for item in unquote(r.text).split('&'))['oauth_token'], 28 | def __get_login_info(self): 29 | account = raw_input('Username: ') 30 | password = getpass.getpass('Password: ') 31 | return account, password 32 | def __get_ver(self): 33 | while 1: 34 | account, password = self.__get_login_info() 35 | access = { 36 | 'authorize': 'Authorize', 37 | 'oauth_token': self.tmpOauthToken, 38 | 'username': account, 39 | 'password': password, 40 | } 41 | r = requests.post('https://%s/OAuth.action'%self.host, data = access) 42 | if 'oauth_verifier' in r.url: break 43 | self.verifier = dict(item.split('=', 1) for item in r.url.split('?')[-1].split('&'))['oauth_verifier'] 44 | def __get_token(self): 45 | payload = { 46 | 'oauth_consumer_key': self.consumerKey, 47 | 'oauth_token': self.tmpOauthToken, 48 | 'oauth_verifier': self.verifier, 49 | 'oauth_signature': self.consumerSecret, 50 | 'oauth_signature_method': 'PLAINTEXT', 51 | } 52 | r = requests.get('https://%s/oauth'%self.host, params = payload) 53 | 54 | if not ('oauth_token' in r.text and 'edam_expires' in r.text): raise Exception('Token Not Found') 55 | return (dict(item.split('=',1) for item in unquote(r.text).split('&'))['oauth_token'], 56 | dict(item.split('=',1) for item in unquote(r.text).split('&'))['edam_expires'], self.host) 57 | 58 | if __name__=='__main__': 59 | key = '' 60 | secret = '' 61 | print Oauth(key, secret).oauth() 62 | -------------------------------------------------------------------------------- /Programs/Evernote/EvernoteController/README.md: -------------------------------------------------------------------------------- 1 | #EvernoteController 160114 2 | Aimed at: 3 | Simplify Evernote API as mush as possible 4 | The following contents can be added: 5 | Oauth.py: get oauth automatically (added when DEV_TOKEN isn't set) 6 | Storage.py: local storage to accelerate searching (added when LOCAL_STORAGE is True) 7 | Environment: 8 | Windows 8.1 - 64 9 | Python 2.7.10 10 | Attention: 11 | Please fill in the evernote key and secret in Oauth.py before runing this 12 | Evernote provided sandbox, where normal account can't be used 13 | Expunge functions can only be used when using DeveloperToken 14 | For sake of safety, evernote key and secret is not provided. I'm available if you need help. 15 | 16 | 目标: 17 | 将Evernote API的调用尽可能的简化 18 | 以下内容可以选择添加: 19 | Oauth.py: 自动完成开放授权(DEV_TOKEN未被设置时自动添加) 20 | Storage.py: 增加本地存储功能,加速浏览(LOCAL_STORAGE为真时添加) 21 | 环境: 22 | Windows 8.1 - 64 23 | Python 2.7.10 24 | 注意事项: 25 | 在使用之前请填写Oauth.py中的evernote key和secret 26 | 印象笔记提供了沙盒环境,沙盒环境中是无法使用普通账号的 27 | 彻底删除笔记与笔记本仅在使用 针对单个笔记的DeveloperToken 时才能使用 28 | 出于安全考虑,没有提供key与secret,需要帮助可以联系我 29 | -------------------------------------------------------------------------------- /Programs/Evernote/EvernoteController/Storage.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import sys 3 | import evernote.edam.type.ttypes as Types 4 | import evernote.edam.notestore.NoteStore as NoteStore 5 | 6 | # Data Structure 7 | # notebookName:{ 8 | # 'notebook': notebook 9 | # 'notes': { 10 | # noteName: note 11 | # ... 12 | # } 13 | # } 14 | # noteDictFormat: { 15 | # 'notebookName':[('note1', timeStamp), ..], 16 | # } 17 | 18 | class Storage(): 19 | storage = {} 20 | def __init__(self): 21 | self.available = False 22 | def update(self, token, noteStore): 23 | for nb in noteStore.listNotebooks(): 24 | self.storage[nb.name] = {} 25 | self.storage[nb.name]['notebook'] = nb 26 | self.storage[nb.name]['notes'] = {} 27 | f = NoteStore.NoteFilter() 28 | f.notebookGuid = nb.guid 29 | for ns in noteStore.findNotes(token, f, 0, 999).notes: 30 | self.storage[nb.name]['notes'][ns.title] = ns 31 | self.defaultNotebook = noteStore.getDefaultNotebook(token).name 32 | def create_note(self, note, notebookName = None): 33 | if notebookName is None: notebookName = self.defaultNotebook 34 | self.storage[notebookName]['notes'][note.title] = note 35 | return True 36 | def create_notebook(self, notebook): 37 | if self.storage.get(notebook.name) is None: return False 38 | self.storage[notebook.name] = {} 39 | self.storage[notebook.name]['notebook'] = notebook 40 | self.storage[notebook.name]['notes'] = {} 41 | return True 42 | def copy_note(self, fullNotePath, _to = None): 43 | if _to is None: _to = self.defaultNotebook 44 | note = self.get(fullNotePath) 45 | if note is None: return False 46 | self.storage[_to]['notes'][note.title] = note 47 | return True 48 | def move_note(self, fullNotePath, _to = None): 49 | r = self.copy_note(fullNotePath, _to) 50 | if r == False: return False 51 | del self.storage[fullNotePath.split('/')[0]]['notes'][note.title] 52 | return True 53 | def delete_note(self, fullNotePath): 54 | if self.get(fullNotePath) is None: return False 55 | del self.storage[fullNotePath.split('/')[0]]['notes'][fullNotePath.split('/')[1]] 56 | return True 57 | def delete_notebook(self, notebook): 58 | if self.get(notebook) is None: return False 59 | del self.storage[notebook] 60 | return True 61 | def get(self, s): 62 | f = s.split('/') 63 | r = self.storage.get(f[0]) 64 | if r is None: return 65 | if '/' in s: return r['notes'].get(f[1]) 66 | return r.get('notebook') 67 | def get_note_dict(self): 68 | noteDict = {} 69 | for nbName, nb in self.storage.iteritems(): 70 | noteDict[nbName] = [] 71 | for nName, n in nb['notes'].iteritems(): 72 | noteDict[nbName].append((nName, n.updated / 1000)) 73 | return noteDict 74 | def show_notebook(self): 75 | for bn, nb in self.storage.items(): print_line(bn) 76 | def show_notes(self, notebook = None): 77 | for bn, nb in self.storage.items(): 78 | if not notebook: print_line(bn + ':') 79 | if not notebook or bn == notebook: 80 | for nn, ns in nb['notes'].items(): 81 | print_line(('' if notebook else ' ')+nn) 82 | def print_line(s): 83 | t = sys.getfilesystemencoding() 84 | print s.decode('UTF-8').encode(t) 85 | -------------------------------------------------------------------------------- /Programs/Evernote/EvernoteController/__init__.py: -------------------------------------------------------------------------------- 1 | from controller import EvernoteController 2 | from oauth import Oauth 3 | 4 | __all__ = ['EvernoteController', 'Oauth'] 5 | -------------------------------------------------------------------------------- /Programs/Evernote/EvernoteController/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/Evernote/EvernoteController/__init__.pyc -------------------------------------------------------------------------------- /Programs/Evernote/EvernoteController/controller.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import sys, hashlib, re, time 3 | import evernote.edam.type.ttypes as Types 4 | import evernote.edam.notestore.NoteStore as NoteStore 5 | from evernote.api.client import EvernoteClient 6 | 7 | from storage import Storage 8 | 9 | class EvernoteController(object): 10 | def __init__(self, token, isSpecialToken = False, sandbox = False, isInternational = False): 11 | self.token = token 12 | if sandbox: 13 | self.client = EvernoteClient(token=self.token) 14 | elif isInternational: 15 | self.client = EvernoteClient(token=self.token, service_host='app.evernote.com') 16 | else: 17 | self.client = EvernoteClient(token=self.token, service_host='app.yinxiang.com') 18 | self.isSpecialToken = isSpecialToken 19 | self.userStore = self.client.get_user_store() 20 | self.noteStore = self.client.get_note_store() 21 | self.storage = Storage() 22 | def create_notebook(self, title): 23 | if self.get(title): return False 24 | notebook = Types.Notebook() 25 | notebook.name = title 26 | notebook = self.noteStore.createNotebook(notebook) 27 | self.storage.create_notebook(notebook) 28 | return True 29 | def create_note(self, noteFullPath, content = None, fileDir = None): 30 | if self.get(noteFullPath): return False 31 | if '/' in noteFullPath: 32 | notebook = noteFullPath.split('/')[0] 33 | title = noteFullPath.split('/')[1] 34 | else: 35 | notebook = self.storage.defaultNotebook 36 | title = noteFullPath 37 | note = Types.Note() 38 | note.title = title 39 | note.content = '' 40 | note.content += '' 41 | note.content += content or '' 42 | if self.get(notebook) is None: self.create_notebook(notebook) 43 | note.notebookGuid = self.get(notebook).guid 44 | if not fileDir is None: 45 | with open(fileDir, 'rb') as f: fileBytes = f.read() 46 | fileData = Types.Data() 47 | fileData.bodyHash = self._md5(fileBytes) 48 | fileData.size = len(fileBytes) 49 | fileData.body = fileBytes 50 | fileAttr = Types.ResourceAttributes() 51 | fileAttr.fileName = title + '.md' 52 | fileAttr.attachment = True 53 | fileResource = Types.Resource() 54 | fileResource.data = fileData 55 | fileResource.mime = 'application/octet-stream' 56 | fileResource.attributes = fileAttr 57 | note.resources = [fileResource] 58 | note.content += ''%fileData.bodyHash 59 | note.content += '' 60 | note = self.noteStore.createNote(note) 61 | self.storage.create_note(note, notebook) 62 | return True 63 | def update_note(self, noteFullPath, content = None, fileDir = None): 64 | note = self.get(noteFullPath) 65 | if note is None: return self.create_note(noteFullPath, content or '', fileDir) 66 | if '/' in noteFullPath: 67 | notebook = noteFullPath.split('/')[0] 68 | title = noteFullPath.split('/')[1] 69 | else: 70 | notebook = self.storage.defaultNotebook 71 | title = noteFullPath 72 | oldContent = self.get_content(noteFullPath) 73 | header = '' 74 | guid = note.guid 75 | oldContent = re.sub('', '', oldContent) 76 | note = Types.Note() 77 | note.guid = guid 78 | note.title = title 79 | note.content = header 80 | note.content += '' 81 | note.content += content or oldContent 82 | if not fileDir is None: 83 | with open(fileDir, 'rb') as f: fileBytes = f.read() 84 | fileData = Types.Data() 85 | fileData.bodyHash = self._md5(fileBytes) 86 | fileData.size = len(fileBytes) 87 | fileData.body = fileBytes 88 | fileAttr = Types.ResourceAttributes() 89 | fileAttr.fileName = title + '.md' 90 | fileAttr.attachment = True 91 | fileResource = Types.Resource() 92 | fileResource.data = fileData 93 | fileResource.mime = 'application/octet-stream' 94 | fileResource.attributes = fileAttr 95 | note.resources = [fileResource] 96 | note.content += ''%fileData.bodyHash 97 | note.content += '' 98 | self.noteStore.updateNote(self.token, note) 99 | self.storage.delete_note(noteFullPath) 100 | self.storage.create_note(note, notebook) 101 | return True 102 | def get_content(self, noteFullPath): 103 | note = self.get(noteFullPath) 104 | if note is None: return 105 | r = self.noteStore.getNoteContent(note.guid) 106 | try: 107 | content = re.compile('.*?(.*?)').findall(r)[0] 108 | except: 109 | content = '' 110 | return content 111 | def get_attachment(self, noteFullPath): 112 | note = self.get(noteFullPath) 113 | return {resource.attributes.fileName: self.noteStore.getResourceData(resource.guid) for resource in (note.resources or {})} 114 | def move_note(self, noteFullPath, _to): 115 | if self.get(noteFullPath) is None: return False 116 | if type(self.get(noteFullPath)) != type(Types.Note()) or type(self.get(_to)) != type(Types.Notebook()): raise Exception('Type Error') 117 | self.noteStore.copyNote(self.token, self.get(noteFullPath).guid, self.get(_to).guid) 118 | if self.isSpecialToken: 119 | self.noteStore.expungeNote(self.token, self.get(noteFullPath).guid) 120 | else: 121 | self.noteStore.deleteNote(self.token, self.get(noteFullPath).guid) 122 | self.storage.move_note(noteFullPath, _to) 123 | return True 124 | def delete_note(self, noteFullPath): 125 | if self.get(noteFullPath) is None: return False 126 | if type(self.get(noteFullPath)) != type(Types.Note()): raise Exception('Types Error') 127 | if self.isSpecialToken: 128 | self.noteStore.expungeNote(self.token, self.get(noteFullPath).guid) 129 | else: 130 | self.noteStore.deleteNote(self.token, self.get(noteFullPath).guid) 131 | self.storage.delete_note(noteFullPath) 132 | return True 133 | def delete_notebook(self, notebook): 134 | if self.get(notebook) or not self.isSpecialToken: return False 135 | if type(self.get(notebook)) != type(Types.Notebook()): raise Exception('Types Error') 136 | self.noteStore.expungeNotebook(self.token, self.get(notebook).guid) 137 | self.storage.delete_notebook(notebook) 138 | return True 139 | def get(self, s): 140 | return self.storage.get(s) 141 | def show_notebook(self): 142 | self.storage.show_notebook() 143 | def show_notes(self, notebook=None): 144 | self.storage.show_notes(notebook) 145 | def _md5(self, s): 146 | m = hashlib.md5() 147 | m.update(s) 148 | return m.hexdigest() 149 | 150 | if __name__ == '__main__': 151 | # You can get this from 'https://%s/api/DeveloperToken.action'%SERVICE_HOST >> 152 | # In China it's https://app.yinxiang.com/api/DeveloperToken.action << 153 | token = 'S=s1:U=91eca:E=15be6680420:C=1548eb6d760:P=1cd:A=en-devtoken:V=2:H=026e6ff5f5d0753eb37146a1b4660cc9' 154 | e = EvernoteController(token, True, True) 155 | # e.update_note('Hello', 'Test', 'Changed', 'README.md') 156 | e.create_note('Test/中文', 'Chinese') 157 | 158 | if False: 159 | e.create_notebook('Notebook1') 160 | e.create_note('Hello', 'Hello, world!', 'Notebook1') 161 | e.create_notebook('Notebook2') 162 | e.show_notes() 163 | e.move_note('Notebook1/Hello', 'Notebook2') 164 | e.show_notes() 165 | e.delete_note('Notebook2/Hello') 166 | # deleting notebook can only be available when you use developer token for you own evernote 167 | e.delete_notebook('Notebook1') 168 | e.delete_notebook('Notebook2') 169 | e.show_notes() 170 | -------------------------------------------------------------------------------- /Programs/Evernote/EvernoteController/controller.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/Evernote/EvernoteController/controller.pyc -------------------------------------------------------------------------------- /Programs/Evernote/EvernoteController/oauth.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/Evernote/EvernoteController/oauth.pyc -------------------------------------------------------------------------------- /Programs/Evernote/EvernoteController/storage.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/Evernote/EvernoteController/storage.pyc -------------------------------------------------------------------------------- /Programs/Evernote/Memo/EvernoteController.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import sys 3 | 4 | import evernote.edam.type.ttypes as Types 5 | import evernote.edam.notestore.NoteStore as NoteStore 6 | # from Oauth import Oauth 7 | # from Storage import Storage 8 | from evernote.api.client import EvernoteClient 9 | 10 | # * If you are international user, replace all the yinxiang with evernote 11 | 12 | # SANDBOX = True 13 | # SERVICE_HOST = 'sandbox.evernote.com' 14 | SANDBOX = False 15 | SERVICE_HOST = 'app.yinxiang.com' 16 | 17 | # * If you are international user, replace all the yinxiang with evernote 18 | 19 | # You can get this from 'https://%s/api/DeveloperToken.action'%SERVICE_HOST >> 20 | SPECIAL_DEV_TOKEN = True 21 | DEV_TOKEN = '' 22 | # SPECIAL_DEV_TOKEN = False 23 | # DEV_TOKEN = '' 24 | # In China it's https://app.yinxiang.com/api/DeveloperToken.action << 25 | 26 | LOCAL_STORAGE = False 27 | 28 | class EvernoteController: 29 | def __init__(self): 30 | if DEV_TOKEN: 31 | self.token = DEV_TOKEN 32 | else: 33 | self.token = Oauth(SANDBOX).oauth() 34 | 35 | sys.stdout.write('Logging\r') 36 | if SANDBOX: 37 | self.client = EvernoteClient(token=self.token) 38 | else: 39 | self.client = EvernoteClient(token=self.token, service_host=SERVICE_HOST) 40 | self.userStore = self.client.get_user_store() 41 | self.noteStore = self.client.get_note_store() 42 | if LOCAL_STORAGE: self.__set_storage() 43 | print 'Login Succeed as ' + self.userStore.getUser().username 44 | def __set_storage(self): 45 | print 'Loading Storage' 46 | self.storage = Storage(self.noteStore, self.token) 47 | print 'Storage loaded' 48 | def create_notebook(self,title): 49 | notebook = Types.Notebook() 50 | notebook.name = title 51 | notebook = self.noteStore.createNotebook(notebook) 52 | if LOCAL_STORAGE: self.storage.create_notebook(notebook) 53 | print_line('Created notebook: %s successfully'%title) 54 | def create_note(self, title, content, notebook = None): 55 | note = Types.Note() 56 | note.title = title 57 | note.content = '' 58 | note.content += content 59 | #'Hello, world!' 60 | if notebook: note.notebookGuid = self.myfile(notebook).guid 61 | note = self.noteStore.createNote(note) 62 | if LOCAL_STORAGE: self.storage.create_note(note, notebook) 63 | print_line('Created note: %s successfully' %title) 64 | def move_note(self, note, _to): 65 | if type(self.myfile(note)) != type(Types.Note()) or type(self.myfile(_to)) != type(Types.Notebook()): raise Exception('Type Error') 66 | self.noteStore.copyNote(self.token, self.myfile(note).guid, self.myfile(_to).guid) 67 | if SPECIAL_DEV_TOKEN: 68 | self.noteStore.expungeNote(self.token, self.myfile(note).guid) 69 | else: 70 | self.noteStore.deleteNote(self.token, self.myfile(note).guid) 71 | if LOCAL_STORAGE: self.storage.move_note(note, _to) 72 | print_line('Move %s to %s successfully'%(note,_to)) 73 | def delete_note(self, note): 74 | if type(self.myfile(note)) != type(Types.Note()): raise Exception('Types Error') 75 | self.noteStore.deleteNote(self.token, self.myfile(note).guid) 76 | # BUG 77 | if LOCAL_STORAGE: self.storage.delete_note(note) 78 | print_line('Deleted %s successfully'%note) 79 | def delete_notebook(self, notebook): 80 | if SPECIAL_DEV_TOKEN: 81 | if type(self.myfile(notebook)) != type(Types.Notebook()): raise Exception('Types Error') 82 | self.noteStore.expungeNotebook(self.token, self.myfile(notebook).guid) 83 | # BUG 84 | if LOCAL_STORAGE: self.storage.delete_notebook(notebook) 85 | print_line('Deleted %s successfully'%notebook) 86 | def myfile(self, s): 87 | if LOCAL_STORAGE: return self.storage.myfile(s) 88 | f = s.split('/') 89 | if '/' in s: 90 | for nb in self.noteStore.listNotebooks(): 91 | if nb.name == f[0]: 92 | fi = NoteStore.NoteFilter() 93 | fi.notebookGuid = nb.guid 94 | for ns in self.noteStore.findNotes(self.token, fi, 0, 999).notes: 95 | if ns.title == f[1]: return ns 96 | else: 97 | for nb in self.noteStore.listNotebooks(): 98 | if nb.name == f[0]: return nb 99 | raise Exception('%s not found'%s) 100 | def show_notebook(self): 101 | if LOCAL_STORAGE: 102 | self.storage.show_notebook() 103 | else: 104 | for nb in self.noteStore.listNotebooks(): print_line(nb.name) 105 | def show_notes(self, notebook=None): 106 | if LOCAL_STORAGE: 107 | self.storage.show_notes(notebook) 108 | else: 109 | for nb in self.noteStore.listNotebooks(): 110 | if not notebook: print_line(nb.name + ':') 111 | if not notebook or nb.name == notebook: 112 | f = NoteStore.NoteFilter() 113 | f.notebookGuid = nb.guid 114 | for ns in self.noteStore.findNotes(self.token, f, 0, 999).notes: 115 | print_line(('' if notebook else ' ') + ns.title) 116 | 117 | def print_line(s): 118 | t = sys.getfilesystemencoding() 119 | print s.decode('UTF-8').encode(t) 120 | 121 | if __name__ == '__main__': 122 | e = EvernoteController() 123 | e.create_notebook('Notebook1') 124 | e.create_note('Hello', 'Hello, world!', 'Notebook1') 125 | e.create_notebook('Notebook2') 126 | e.show_notes() 127 | e.move_note('Notebook1/Hello', 'Notebook2') 128 | e.show_notes() 129 | e.delete_note('Notebook2/Hello') 130 | # deleting notebook can only be available when you use developer token for you own evernote 131 | e.delete_notebook('Notebook1') 132 | e.delete_notebook('Notebook2') 133 | e.show_notes() 134 | -------------------------------------------------------------------------------- /Programs/Evernote/Memo/Memo.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | TEMPLATE_CONTENT_DIR = 'content.enex' 4 | TEMPLATE_HEADER_DIR = 'header.enex' 5 | FIRST_MONDAY_DATE = datetime.datetime(2016, 1, 4) 6 | 7 | class Memo: 8 | def __init__(self): 9 | self.memoData=[] 10 | self.now = datetime.datetime.now() 11 | self.dataList = {} 12 | self.load_memo_template() 13 | self.load_time() 14 | self.update_template() 15 | def load_memo_template(self): 16 | with open(TEMPLATE_CONTENT_DIR) as f: self.memoData.append(f.read()) 17 | with open(TEMPLATE_HEADER_DIR) as f: self.memoData.append(f.read()) 18 | def load_time(self): 19 | self.dataList['month'] = self.now.strftime('%B') 20 | # if it's weekends, this will produce next week's memo 21 | if self.now.weekday() > 4: 22 | self.now += datetime.timedelta(days = 7 - self.now.weekday()) 23 | else: 24 | self.now -= datetime.timedelta(days = self.now.weekday()) 25 | self.dataList['day'] = self.now.strftime('%d') 26 | # self.dataList['week'] = str((self.now - FIRST_MONDAY_DATE).days / 7 + 1) 27 | self.dataList['week'] = self.now.strftime('%U') 28 | for i in range(7): 29 | self.dataList[str(i)] = (self.now + datetime.timedelta(days = i) - datetime.timedelta(self.now.weekday())).strftime('%y%m%d') 30 | def update_template(self): 31 | for key, value in self.dataList.items(): 32 | for i in range(2): 33 | self.memoData[i] = self.memoData[i].replace('[^'+key+']',value) 34 | print 'Memo Created!' 35 | print 'Week: %s' %(self.dataList['week']) 36 | print 'Day : %s - %s' %(self.dataList['0'],self.dataList['6']) 37 | def output_memo(self): 38 | return self.memoData[1].replace('[^content]',self.memoData[0]) 39 | def raw_memo(self): 40 | return self.memoData[0] 41 | 42 | if __name__ == '__main__': 43 | m = Memo() 44 | with open('OUTPUT.enex', 'w') as o: 45 | o.write(m.output_memo()) 46 | -------------------------------------------------------------------------------- /Programs/Evernote/Memo/README.md: -------------------------------------------------------------------------------- 1 | #Memo 160111 2 | Aimed at: 3 | Automatically make a note of memo style 4 | Output a '*.enex' file to be imported into Evernote 5 | Environment: 6 | Windows 8.1 - 64 7 | Python 2.7.10 8 | Attention: 9 | The style of memo can be changed through changing 'content.enex' 10 | This is only a blank template, details should be filled by yourself 11 | 12 | 目标: 13 | 自动生成一份Memo格式的记事 14 | 导出可以导入印象笔记的 '*.enex' 格式文件 15 | 环境: 16 | Windows 8.1 - 64 17 | Python 2.7.10 18 | 注意事项: 19 | Memo格式可以通过修改 'content.enex' 更改 20 | 这只是一个空白模板,具体内容要自己往里填哟 21 | 22 | -------------------------------------------------------------------------------- /Programs/Evernote/Memo/content.enex: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | [^month] [^day] (Week [^week]) 7 | 8 | 9 | 10 |
11 |
12 |
13 |
14 | 15 |
16 | Monday [^0] 17 |
18 |
19 |
20 |
21 |
22 | Tuesday [^1] 23 |
24 |
25 |
26 |
27 |
28 | Wednesday [^2] 29 |
30 |
31 |
32 |
33 |
34 | Thursday [^3] 35 |
36 |
37 |
38 |
39 |
40 | Friday [^4] 41 |
42 |
43 |
44 |
45 |
46 | Saturday [^5] 47 |
48 |
49 |
50 |
51 |
52 | Sunday [^6] 53 |
54 |
55 |
56 |
57 |
58 | 之后的时间 59 | 60 |
61 |
sth
62 |
63 | -------------------------------------------------------------------------------- /Programs/Evernote/Memo/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/Evernote/Memo/example.png -------------------------------------------------------------------------------- /Programs/Evernote/Memo/header.enex: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Memo 6 | 7 | 9 | 10 | [^content] 11 | ]]> 12 | 13 | 20160114T000000Z 14 | [^0]T000000Z 15 | 16 | 17 | -------------------------------------------------------------------------------- /Programs/Evernote/PackMemo/EvernoteController.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import sys 3 | 4 | import evernote.edam.type.ttypes as Types 5 | import evernote.edam.notestore.NoteStore as NoteStore 6 | # from Oauth import Oauth 7 | # from Storage import Storage 8 | from evernote.api.client import EvernoteClient 9 | 10 | # * If you are international user, replace all the yinxiang with evernote 11 | 12 | # SANDBOX = True 13 | # SERVICE_HOST = 'sandbox.evernote.com' 14 | SANDBOX = False 15 | SERVICE_HOST = 'app.yinxiang.com' 16 | 17 | # * If you are international user, replace all the yinxiang with evernote 18 | 19 | # You can get this from 'https://%s/api/DeveloperToken.action'%SERVICE_HOST >> 20 | SPECIAL_DEV_TOKEN = True 21 | DEV_TOKEN = '' 22 | # SPECIAL_DEV_TOKEN = False 23 | # DEV_TOKEN = '' 24 | # In China it's https://app.yinxiang.com/api/DeveloperToken.action << 25 | 26 | LOCAL_STORAGE = False 27 | 28 | class EvernoteController: 29 | def __init__(self): 30 | if DEV_TOKEN: 31 | self.token = DEV_TOKEN 32 | else: 33 | self.token = Oauth(SANDBOX).oauth() 34 | 35 | sys.stdout.write('Logging\r') 36 | if SANDBOX: 37 | self.client = EvernoteClient(token=self.token) 38 | else: 39 | self.client = EvernoteClient(token=self.token, service_host=SERVICE_HOST) 40 | self.userStore = self.client.get_user_store() 41 | self.noteStore = self.client.get_note_store() 42 | if LOCAL_STORAGE: self.__set_storage() 43 | print 'Login Succeed as ' + self.userStore.getUser().username 44 | def __set_storage(self): 45 | print 'Loading Storage' 46 | self.storage = Storage(self.noteStore, self.token) 47 | print 'Storage loaded' 48 | def create_notebook(self,title): 49 | notebook = Types.Notebook() 50 | notebook.name = title 51 | notebook = self.noteStore.createNotebook(notebook) 52 | if LOCAL_STORAGE: self.storage.create_notebook(notebook) 53 | print_line('Created notebook: %s successfully'%title) 54 | def create_note(self, title, content, notebook = None): 55 | note = Types.Note() 56 | note.title = title 57 | note.content = '' 58 | note.content += content 59 | #'Hello, world!' 60 | if notebook: note.notebookGuid = self.myfile(notebook).guid 61 | note = self.noteStore.createNote(note) 62 | if LOCAL_STORAGE: self.storage.create_note(note, notebook) 63 | print_line('Created note: %s successfully' %title) 64 | def move_note(self, note, _to): 65 | if type(self.myfile(note)) != type(Types.Note()) or type(self.myfile(_to)) != type(Types.Notebook()): raise Exception('Type Error') 66 | self.noteStore.copyNote(self.token, self.myfile(note).guid, self.myfile(_to).guid) 67 | if SPECIAL_DEV_TOKEN: 68 | self.noteStore.expungeNote(self.token, self.myfile(note).guid) 69 | else: 70 | self.noteStore.deleteNote(self.token, self.myfile(note).guid) 71 | if LOCAL_STORAGE: self.storage.move_note(note, _to) 72 | print_line('Move %s to %s successfully'%(note,_to)) 73 | def delete_note(self, note): 74 | if type(self.myfile(note)) != type(Types.Note()): raise Exception('Types Error') 75 | self.noteStore.deleteNote(self.token, self.myfile(note).guid) 76 | # BUG 77 | if LOCAL_STORAGE: self.storage.delete_note(note) 78 | print_line('Deleted %s successfully'%note) 79 | def delete_notebook(self, notebook): 80 | if SPECIAL_DEV_TOKEN: 81 | if type(self.myfile(notebook)) != type(Types.Notebook()): raise Exception('Types Error') 82 | self.noteStore.expungeNotebook(self.token, self.myfile(notebook).guid) 83 | # BUG 84 | if LOCAL_STORAGE: self.storage.delete_notebook(notebook) 85 | print_line('Deleted %s successfully'%notebook) 86 | def myfile(self, s): 87 | if LOCAL_STORAGE: return self.storage.myfile(s) 88 | f = s.split('/') 89 | if '/' in s: 90 | for nb in self.noteStore.listNotebooks(): 91 | if nb.name == f[0]: 92 | fi = NoteStore.NoteFilter() 93 | fi.notebookGuid = nb.guid 94 | for ns in self.noteStore.findNotes(self.token, fi, 0, 999).notes: 95 | if ns.title == f[1]: return ns 96 | else: 97 | for nb in self.noteStore.listNotebooks(): 98 | if nb.name == f[0]: return nb 99 | raise Exception('%s not found'%s) 100 | def show_notebook(self): 101 | if LOCAL_STORAGE: 102 | self.storage.show_notebook() 103 | else: 104 | for nb in self.noteStore.listNotebooks(): print_line(nb.name) 105 | def show_notes(self, notebook=None): 106 | if LOCAL_STORAGE: 107 | self.storage.show_notes(notebook) 108 | else: 109 | for nb in self.noteStore.listNotebooks(): 110 | if not notebook: print_line(nb.name + ':') 111 | if not notebook or nb.name == notebook: 112 | f = NoteStore.NoteFilter() 113 | f.notebookGuid = nb.guid 114 | for ns in self.noteStore.findNotes(self.token, f, 0, 999).notes: 115 | print_line(('' if notebook else ' ') + ns.title) 116 | 117 | def print_line(s): 118 | t = sys.getfilesystemencoding() 119 | print s.decode('UTF-8').encode(t) 120 | 121 | if __name__ == '__main__': 122 | e = EvernoteController() 123 | e.create_notebook('Notebook1') 124 | e.create_note('Hello', 'Hello, world!', 'Notebook1') 125 | e.create_notebook('Notebook2') 126 | e.show_notes() 127 | e.move_note('Notebook1/Hello', 'Notebook2') 128 | e.show_notes() 129 | e.delete_note('Notebook2/Hello') 130 | # deleting notebook can only be available when you use developer token for you own evernote 131 | e.delete_notebook('Notebook1') 132 | e.delete_notebook('Notebook2') 133 | e.show_notes() 134 | -------------------------------------------------------------------------------- /Programs/Evernote/PackMemo/Memo.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | TEMPLATE_CONTENT_DIR = 'content.enex' 4 | TEMPLATE_HEADER_DIR = 'header.enex' 5 | FIRST_MONDAY_DATE = datetime.datetime(2016, 1, 4) 6 | 7 | class Memo: 8 | def __init__(self): 9 | self.memoData=[] 10 | self.now = datetime.datetime.now() 11 | self.dataList = {} 12 | self.load_memo_template() 13 | self.load_time() 14 | self.update_template() 15 | def load_memo_template(self): 16 | with open(TEMPLATE_CONTENT_DIR) as f: self.memoData.append(f.read()) 17 | with open(TEMPLATE_HEADER_DIR) as f: self.memoData.append(f.read()) 18 | def load_time(self): 19 | self.dataList['month'] = self.now.strftime('%B') 20 | # if it's weekends, this will produce next week's memo 21 | if self.now.weekday() > 4: 22 | self.now += datetime.timedelta(days = 7 - self.now.weekday()) 23 | else: 24 | self.now -= datetime.timedelta(days = self.now.weekday()) 25 | self.dataList['day'] = self.now.strftime('%d') 26 | # self.dataList['week'] = str((self.now - FIRST_MONDAY_DATE).days / 7 + 1) 27 | self.dataList['week'] = self.now.strftime('%U') 28 | for i in range(7): 29 | self.dataList[str(i)] = (self.now + datetime.timedelta(days = i) - datetime.timedelta(self.now.weekday())).strftime('%y%m%d') 30 | def update_template(self): 31 | for key, value in self.dataList.items(): 32 | for i in range(2): 33 | self.memoData[i] = self.memoData[i].replace('[^'+key+']',value) 34 | print 'Memo Created!' 35 | print 'Week: %s' %(self.dataList['week']) 36 | print 'Day : %s - %s' %(self.dataList['0'],self.dataList['6']) 37 | def output_memo(self): 38 | return self.memoData[1].replace('[^content]',self.memoData[0]) 39 | def raw_memo(self): 40 | return self.memoData[0] 41 | 42 | if __name__ == '__main__': 43 | m = Memo() 44 | with open('OUTPUT.enex', 'w') as o: 45 | o.write(m.output_memo()) 46 | -------------------------------------------------------------------------------- /Programs/Evernote/PackMemo/PackMemo.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | python PackMemo.py 3 | echo Pack Finished, Press Any Key to Exit... 4 | pause>nul 5 | -------------------------------------------------------------------------------- /Programs/Evernote/PackMemo/PackMemo.py: -------------------------------------------------------------------------------- 1 | from EvernoteController import EvernoteController 2 | from Memo import Memo 3 | 4 | MEMO_NAME = 'Memo' 5 | MEMO_DIR = 'Memo' 6 | MEMO_STORAGE_DIR = 'S-Memo' 7 | 8 | def f(fn, *args, **kwargs): 9 | try: 10 | fn(*args, **kwargs) 11 | except: 12 | pass 13 | 14 | m = Memo() 15 | e = EvernoteController() 16 | f(e.create_notebook, MEMO_DIR) 17 | f(e.create_notebook, MEMO_STORAGE_DIR) 18 | f(e.move_note, MEMO_DIR+'/'+MEMO_NAME, MEMO_STORAGE_DIR) 19 | e.create_note('Memo', m.raw_memo(), MEMO_DIR) 20 | -------------------------------------------------------------------------------- /Programs/Evernote/PackMemo/README.md: -------------------------------------------------------------------------------- 1 | #PackMemo 160112 2 | Aimed at: 3 | Pack the Memo of last week to specific position if there is one 4 | Replace the old Memo with a new one 5 | Environment: 6 | Windows 8.1 - 64 7 | Python 2.7.10 (with evernote installed) 8 | Attention: 9 | You should fill in your dev_token in EvernoteController.py before using this 10 | The position of Memo and packing memo can be changed with the settings 11 | You can see how to use this on Youku(http://v.youku.com/v_show/id_XMTQ0OTExNzk5Ng==) 12 | 13 | 目标: 14 | 将上周的Memo备份到相应的位置(如果有的话) 15 | 用一份空白Memo替代旧Memo 16 | 环境: 17 | Windows 8.1 - 64 18 | Python 2.7.10 (安装了evernote插件) 19 | 注意事项: 20 | 在使用这一程序之前,请确保EvernoteController.py中的dev_token已经赋值 21 | Memo位置与Memo备份位置都可以通过修改配置更改 22 | 你能在优酷(http://v.youku.com/v_show/id_XMTQ0OTExNzk5Ng==)上观看演示 23 | -------------------------------------------------------------------------------- /Programs/Evernote/PackMemo/content.enex: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | [^month] [^day] (Week [^week]) 7 | 8 | 9 | 10 |
11 |
12 |
13 |
14 | 15 |
16 | Monday [^0] 17 |
18 |
19 |
20 |
21 |
22 | Tuesday [^1] 23 |
24 |
25 |
26 |
27 |
28 | Wednesday [^2] 29 |
30 |
31 |
32 |
33 |
34 | Thursday [^3] 35 |
36 |
37 |
38 |
39 |
40 | Friday [^4] 41 |
42 |
43 |
44 |
45 |
46 | Saturday [^5] 47 |
48 |
49 |
50 |
51 |
52 | Sunday [^6] 53 |
54 |
55 |
56 |
57 |
58 | 之后的时间 59 | 60 |
61 |
sth
62 |
63 | -------------------------------------------------------------------------------- /Programs/Evernote/PackMemo/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/Evernote/PackMemo/example.png -------------------------------------------------------------------------------- /Programs/Evernote/PackMemo/header.enex: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Memo 6 | 7 | 9 | 10 | [^content] 11 | ]]> 12 | 13 | 20160114T000000Z 14 | [^0]T000000Z 15 | 16 | 17 | -------------------------------------------------------------------------------- /Programs/LogUpdater/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /Programs/LogUpdater/README.md: -------------------------------------------------------------------------------- 1 | #LogUpdater 160215 2 | Aimed at: 3 | Read in xml record get from OutlookAttachView and automatically produce work log and update 4 | Environment: 5 | OutlookAttachView v2.8.7 6 | Windows 8.1 - 64 7 | Python 2.7.10 8 | Attention: 9 | Use `python run.py` to run this program 10 | Put the xml format attachment list in root path as atta.xml 11 | Fill in sheets in infolist path 12 | Use producexml.py, makeuploadfile.py, uploadlog.py in this order 13 | Follow the instruction to modify input and output files 14 | 15 | 目标: 16 | 通过读取OutlookAttachView导出Outlook邮件的xml记录,自动生成工作日志并上传 17 | 环境: 18 | OutlookAttachView v2.8.7 19 | Windows 8.1 - 64 20 | Python 2.7.10 21 | 注意事项: 22 | 使用`python run.py`来开始程序 23 | 将OutlookAttachView导出的xml形式附件列表改为atta.xml放入目录 24 | 填写完成infolist文件夹中的各项数据 25 | 依次使用producexml.py, makeuploadfile.py, uploadlog.py 26 | 按照说明修改输入输出文件 27 | -------------------------------------------------------------------------------- /Programs/LogUpdater/atta.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/LogUpdater/atta.xml -------------------------------------------------------------------------------- /Programs/LogUpdater/client/ExcelClient.py: -------------------------------------------------------------------------------- 1 | #coding = utf8 2 | ''' 3 | getData() returns a LIST contains a row in order 4 | storeData() stores a LIST contains a row in order 5 | ''' 6 | import xlrd, xlwt 7 | 8 | class ExcelClient: 9 | def __init__(self, sourceDir = None, outputDir = None, sourceIndex = None, outputHeader = None): 10 | self.sourceDir = sourceDir 11 | self.outputDir = outputDir if outputDir else 'DemoExcelClientOutput.xls' 12 | self.source = self.getSource(sourceIndex) if sourceIndex else None 13 | self.output = self.setOutput() 14 | self.storeData(outputHeader) 15 | def getSource(self, dataRange): # content will be the first 16 | with xlrd.open_workbook(self.sourceDir) as workbook: 17 | table = workbook.sheets()[0] 18 | for i in range(1, table.nrows): # ignore header 19 | yield [table.row_values(i)[j] for j in dataRange] 20 | def setOutput(self): 21 | workbook = xlwt.Workbook() 22 | table = workbook.add_sheet('metaData') 23 | row = 0 24 | while True: 25 | if self.outputData: 26 | for col in range(len(self.outputData)): table.write(row, col, self.outputData[col]) 27 | row += 1 28 | workbook.save(self.outputDir) 29 | yield True 30 | else: 31 | yield False 32 | def getData(self): # returns a LIST contains a row in order 33 | try: 34 | return self.source.next() 35 | except StopIteration, AttributeError: 36 | return None 37 | def storeData(self, data): # stores a LIST contains a row in order 38 | self.outputData = data 39 | return self.output.next() 40 | 41 | if __name__ == '__main__': 42 | iec = ExcelClient(sourceDir = '1.xlsx', sourceIndex = (0,1)) 43 | oec = ExcelClient(outputDir = '1.xlsx', outputHeader = ['subject', 'time']) 44 | for i in range(3): 45 | data = iec.getData() 46 | oec.storeData(data) 47 | 48 | -------------------------------------------------------------------------------- /Programs/LogUpdater/client/LogClient.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import requests, os, re 3 | 4 | DEBUG = False 5 | 6 | class LogClient: 7 | def __init__(self, userID, password, baseUrl): 8 | self.userID = userID 9 | self.password = password 10 | self.baseUrl = baseUrl 11 | self.s = requests.Session() 12 | self.set_env() 13 | self.read_in_personal_info() 14 | if not self.login(): os._exit() 15 | self.get_view_settings() 16 | def set_env(self): 17 | self.headers = { 18 | 'Accept-Language': 'en-US,en;q=0.8,zh-Hans-CN;q=0.5,zh-Hans;q=0.3', 19 | 'User-Agent': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; InfoPath.3; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729)', 20 | 'Content-Type': 'application/x-www-form-urlencoded', } 21 | def login(self): 22 | def try_login(): 23 | payloads = { 24 | 'userID': self.userID, 25 | 'password': self.password, 26 | 'rememberuser': '1', 27 | 'RegisterSource': '', } 28 | r = self.s.post(self.baseUrl + '/login/loginresult.aspx', 29 | data = payloads, headers = self.headers) 30 | return r.url 31 | if 'mydesktop' in try_login(): 32 | cookiesList = {name:data for name,data in self.s.cookies.items()} 33 | self.OfficeID = cookiesList['UserOffice'] 34 | self.emplId = cookiesList['User'] 35 | return True 36 | print 'UserId or Password is incorrect' 37 | return False 38 | def get_view_settings(self): 39 | r = self.s.get(self.baseUrl + '/worklog/worklogregister.aspx', headers = self.headers) 40 | regex = { 41 | '__VIEWSTATE': 'id="__VIEWSTATE" value="(.*?)" />', 42 | '__VIEWSTATEGENERATOR': 'id="__VIEWSTATEGENERATOR" value="(.*?)" />', 43 | '__EVENTVALIDATION': 'id="__EVENTVALIDATION" value="(.*?)" />', } 44 | for key, value in regex.items(): regex[key] = re.compile(value) 45 | self.viewSetting = {key: re.findall(value, r.text) for key, value in regex.items()} 46 | def upload_log(self, clientId, caseId, date, description, hours = 0): 47 | try: 48 | payloads = { 49 | "__VIEWSTATE": self.viewSetting['__VIEWSTATE'], 50 | '__VIEWSTATEGENERATOR': self.viewSetting['__VIEWSTATEGENERATOR'], 51 | "__EVENTVALIDATION": self.viewSetting['__EVENTVALIDATION'], 52 | 'temp_hour1': '0', 53 | 'temp_minute1': '0', 54 | 'temp_hour2': '0', 55 | 'temp_minute2': '0', 56 | 'Savebtn1': '\261\243 \264\346', 57 | 'wl_category' : '0', 58 | 'wl_work_type': '01', 59 | 'OfficeID' : self.OfficeID, 60 | 'wl_empl_id' : self.emplId, 61 | 'wl_client_id' : clientId, 62 | 'wl_case_id' : caseId, 63 | 'workdate': date, 64 | 'wl_own_hours': hours, 65 | 'wl_description': description.encode('gbk'), } 66 | r = self.s.post(self.baseUrl + '/worklog/worklogregister.aspx', data = payloads, headers = self.headers) 67 | if DEBUG: 68 | with open('debug.htm','w') as f: f.write(r.content) 69 | return True if 'document.frmSaveSubmit.submit' in r.text else False 70 | except: 71 | return False 72 | 73 | if __name__ == '__main__': 74 | lc = LogClient() 75 | r = lc.upload_log('0210866', '021M20140034', '2016-3-1', u'测试', 0) 76 | -------------------------------------------------------------------------------- /Programs/LogUpdater/client/LogClient_old.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import requests, os 3 | 4 | class LogClient: 5 | def __init__(self, userID, password, baseUrl): 6 | self.userID = userID 7 | self.password = password 8 | self.baseUrl = baseUrl 9 | self.s = requests.Session() 10 | while not 'userstatus' in self.login(): print 'Try Again' 11 | print 'Login Succeed' 12 | def login(self): 13 | r = self.s.get(self.baseUrl + '/count.asp', stream = True) 14 | with open('count.jpg', 'wb') as f: f.write(r.content) 15 | os.startfile('count.jpg') 16 | mofei = raw_input('mofei: ') 17 | payloads = { 18 | 'userID': self.userID, 19 | 'password': self.password, 20 | 'mofei': mofei, } 21 | headers = { 'Content-Type': 'application/x-www-form-urlencoded', } 22 | r = self.s.post(self.baseUrl + '/loginResult.asp', 23 | data = payloads, headers = headers) 24 | return r.url 25 | def upload_log(self, clientId, caseId, date, description, hours = 0): 26 | try: 27 | payloads = { 28 | 'RegisterType': 'NEW', 29 | 'wl_category' : '0', 30 | 'wl_client_id' : clientId, 31 | 'wl_case_id' : caseId, 32 | 'wl_empl_id' : '111', 33 | 'wl_work_type': '01', 34 | 'wl_date': date, 35 | 'wl_own_hours': hours, 36 | 'wl_start_date': '09:00', 37 | 'wl_description': description.encode('gbk'),} 38 | headers = { 'Content-Type': 'application/x-www-form-urlencoded', } 39 | r = self.s.post(self.baseUrl + '/worklog/WorklogSave.asp', data = payloads, headers = headers) 40 | return True if 'document.frmWorklog.submit' in r.text else False 41 | except: 42 | return False 43 | 44 | if __name__ == '__main__': 45 | lc = LogClient() 46 | r = lc.upload_log('0210340', '021G20110002', '2016-2-3', u'测试', 0) 47 | -------------------------------------------------------------------------------- /Programs/LogUpdater/client/OutlookAttachViewClient.py: -------------------------------------------------------------------------------- 1 | import re 2 | import xml.dom.minidom 3 | 4 | def re_solve(fileDir): 5 | regex = { 6 | 'info': '={50}\n([\s\S]*?)\n={50}', 7 | 'item': 'item.*?: (.*?)\n', 8 | 'requiredItems': ['Filename', 'From', 'To', 'Subject', 'Created On', 'Inline'],} 9 | for item in regex['requiredItems']: regex[item] = regex['item'].replace('item', item) 10 | regex = {key: (re.compile(value) if isinstance(value, basestring) else None) for key, value in regex.items()} 11 | 12 | with open(fileDir) as f: data = f.read().decode('utf-16') 13 | attaList = re.findall(regex['info'], data) 14 | infoList = [{key: re.search(value, atta) for key, value in regex.items()} for atta in attaList] 15 | 16 | return infoList 17 | 18 | def xml_solve(fileDir): 19 | requiredItems = ['to', 'to_email', 'from', 'from_email', 'filename', 'created_on', 'subject'] 20 | infoList = [] 21 | dom = xml.dom.minidom.parse(fileDir) 22 | root = dom.documentElement 23 | for node in root.getElementsByTagName('item'): 24 | if node.getElementsByTagName('inline')[0].firstChild.data != 'Yes': 25 | info = {key: node.getElementsByTagName(key)[0].firstChild.data 26 | if node.getElementsByTagName(key)[0].firstChild else '' for key in requiredItems} 27 | infoList.append(info) 28 | requiredItems[1] = requiredItems[1].lower() 29 | requiredItems[3] = requiredItems[3].lower() 30 | return infoList 31 | 32 | if __name__ == '__main__': 33 | infoList = xml_solve('atta.xml') 34 | for info in infoList: 35 | for key, value in info.items(): 36 | print '%s: %s'%(key, value) 37 | print 38 | -------------------------------------------------------------------------------- /Programs/LogUpdater/client/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/LogUpdater/client/__init__.py -------------------------------------------------------------------------------- /Programs/LogUpdater/data/storage/upload-20160302.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/LogUpdater/data/storage/upload-20160302.xls -------------------------------------------------------------------------------- /Programs/LogUpdater/data/storage/upload-20160303.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/LogUpdater/data/storage/upload-20160303.xls -------------------------------------------------------------------------------- /Programs/LogUpdater/infolist/cases.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/LogUpdater/infolist/cases.xlsx -------------------------------------------------------------------------------- /Programs/LogUpdater/infolist/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "userID": "**********", 3 | "password": "**********", 4 | "baseUrl": "http://192.168.1.1", 5 | "userNameStorage": "userNameStorage.xls", 6 | "caseStorage": "cases.xlsx", 7 | "xmlInput": "atta.xml", 8 | "metaStorage": "mailinfo.xls", 9 | "uploadFile": "upload.xls", 10 | "debugFile": "debugFile.xls" 11 | } 12 | -------------------------------------------------------------------------------- /Programs/LogUpdater/infolist/userNameStorage.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/LogUpdater/infolist/userNameStorage.xls -------------------------------------------------------------------------------- /Programs/LogUpdater/lib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littlecodersh/EasierLife/ad9143a6362d70489ef4b36651ce58a3cc1d0fa3/Programs/LogUpdater/lib/__init__.py -------------------------------------------------------------------------------- /Programs/LogUpdater/lib/config.py: -------------------------------------------------------------------------------- 1 | import os, json 2 | 3 | while 1: 4 | try: 5 | with open(os.path.join('infolist', 'config.json')) as f: configInfo = json.loads(f.read()) 6 | break 7 | except: 8 | print 'Load config.json failed, please check whether anything is wrong' 9 | 10 | # Login info 11 | userID = configInfo['userID'] 12 | password = configInfo['password'] 13 | baseUrl = configInfo['baseUrl'] 14 | 15 | # Infomation provided by user about cases and users 16 | userNameStorage = os.path.join('infolist', configInfo['userNameStorage']) 17 | caseStorage = os.path.join('infolist', configInfo['caseStorage']) 18 | xmlInput = configInfo['xmlInput'] 19 | 20 | # Sheets stored for use 21 | metaStorage = os.path.join('data', configInfo['metaStorage']) 22 | uploadFile = os.path.join('data', configInfo['uploadFile']) 23 | debugFile = os.path.join('data', configInfo['debugFile']) 24 | -------------------------------------------------------------------------------- /Programs/LogUpdater/lib/makeuploadfile.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import random 3 | 4 | import config 5 | from client.ExcelClient import ExcelClient 6 | 7 | def get_stored_cases(storageDir): 8 | # case_num, case_id, project 9 | ec = ExcelClient(storageDir, sourceIndex = (0,2,3)) 10 | r = {} 11 | while 1: 12 | userInfo = ec.getData() 13 | if userInfo is None: break 14 | r[userInfo[1]] = [userInfo[0], userInfo[1]] 15 | return r 16 | 17 | def makeuploadfile(): 18 | print 'Getting the %s file.'%config.metaStorage 19 | caseDict = get_stored_cases(config.caseStorage) 20 | unfoundList = [] 21 | 22 | print 'Please wait for about half a minute' 23 | oec = ExcelClient(outputDir = config.uploadFile, outputHeader = ['case_num', 'case_id', 'date', 'time', 'description']) 24 | # to, filename, created_on, case_id, subject 25 | iec = ExcelClient(config.metaStorage, sourceIndex = (0,4,5,7,6)) 26 | while 1: 27 | mailInfo = iec.getData() 28 | if mailInfo is None: break 29 | outputList = [] 30 | for key, value in caseDict.items(): 31 | if '' != mailInfo[3] == key: 32 | def clear_colon(s): 33 | return s.encode('utf8').split(':')[-1].split(':')[-1].replace(' ', '').decode('utf8') 34 | outputList = sum([outputList, [value[0], value[1], mailInfo[2].replace('/','-').split(' ')[0], str(random.randint(4,7)/10.0), 35 | u'与{0}就{2}进行沟通,并发送{1}给{0}。'.format(mailInfo[0], clear_colon(mailInfo[1]), clear_colon(mailInfo[4]))] 36 | ], []) 37 | if not outputList: unfoundList.append(str(mailInfo[3]))#print('Case on {} not found'.format(mailInfo[2])) 38 | oec.storeData(outputList) 39 | if unfoundList: print 'Cases not found: ' + ', '.join(list(set(unfoundList))) 40 | print 'Output succeeded! Please check %s before run the upload.py'%config.uploadFile 41 | 42 | if __name__ == '__main__': 43 | makeuploadfile() 44 | -------------------------------------------------------------------------------- /Programs/LogUpdater/lib/producexml.py: -------------------------------------------------------------------------------- 1 | from client.ExcelClient import ExcelClient 2 | from client.OutlookAttachViewClient import xml_solve 3 | import config 4 | 5 | def get_stored_username(storageDir): 6 | ec = ExcelClient(storageDir, sourceIndex = (0,1,2)) 7 | r = {} 8 | while 1: 9 | userInfo = ec.getData() 10 | if userInfo is None: break 11 | r[userInfo[0]] = [userInfo[1], userInfo[2]] 12 | return r 13 | 14 | def producexml(): 15 | header = ['to', 'to_email', 'from', 'from_email', 'filename', 'created_on', 'subject'] 16 | ec = ExcelClient(outputDir = config.metaStorage, outputHeader = sum([header, ['case_id']], [])) 17 | print 'Please wait for about half a minute' 18 | nameList = get_stored_username(config.userNameStorage) 19 | for info in xml_solve(config.xmlInput): 20 | infoList = [info[key] for key in header] 21 | if nameList.has_key(infoList[1].split(',')[0]): 22 | infoList[0] = nameList[infoList[1].split(',')[0]][0] 23 | infoList.append(nameList[infoList[1].split(',')[0]][1]) 24 | if nameList.has_key(infoList[3]): infoList[2] = nameList[infoList[3]][0] 25 | ec.storeData(infoList) 26 | print 'Output succeeded!' 27 | print 'Please check %s before run the makeuploadfile.py'%config.metaStorage 28 | print 'You need to fill in the blank case_id' 29 | 30 | if __name__ == '__main__': 31 | producexml() 32 | -------------------------------------------------------------------------------- /Programs/LogUpdater/lib/uploadlog.py: -------------------------------------------------------------------------------- 1 | from client.ExcelClient import ExcelClient 2 | from client.LogClient_old import LogClient 3 | import config 4 | 5 | def uploadlog(): 6 | iec = ExcelClient(config.uploadFile, sourceIndex = (0,1,2,4,3)) 7 | oec = ExcelClient(outputDir = config.debugFile, outputHeader = ['case_num', 'case_id', 'date', 'time', 'description']) 8 | lc = LogClient(config.userID, config.password, config.baseUrl) 9 | lineNum = 2 10 | 11 | while raw_input('Ready to upload? [y]:') != 'y': pass 12 | 13 | while 1: 14 | mailInfo = iec.getData() 15 | if mailInfo is None: break 16 | if not lc.upload_log(*mailInfo): 17 | print 'Line %s: upload failed'%lineNum 18 | oec.storeData(mailInfo[:3] + [mailInfo[4], mailInfo[3]]) 19 | lineNum += 1 20 | 21 | print 'Upload succeeded! Please check %s if you see something failed'%config.debugFile 22 | 23 | if __name__ == '__main__': 24 | uploadlog() 25 | -------------------------------------------------------------------------------- /Programs/LogUpdater/run.py: -------------------------------------------------------------------------------- 1 | from lib.producexml import producexml 2 | from lib.makeuploadfile import makeuploadfile 3 | from lib.uploadlog import uploadlog 4 | 5 | print 'Hello Zhou, nice to see you again:)' 6 | print 'How much work log have you earned this time?' 7 | print 'Get tasks done one by one and log will be updated.' 8 | print 9 | 10 | def get_option(): 11 | print 'Tasks List:' 12 | print '[1] Produce Xml File' 13 | print '[2] Make Up Upload File' 14 | print '[3] Upload Everything Prepared' 15 | while 1: 16 | r = raw_input('Task select: ') 17 | if r in ('1','2','3'): print;return r 18 | 19 | taskDict = {'1':producexml, '2':makeuploadfile, '3':uploadlog} 20 | 21 | if __name__ == '__main__': 22 | while 1: 23 | taskDict[get_option()]() 24 | print 25 | if raw_input('Quit?[q]') == 'q': break; 26 | -------------------------------------------------------------------------------- /Programs/PCMusicViaWechat/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.swp 3 | *.jpg 4 | storage/* 5 | -------------------------------------------------------------------------------- /Programs/PCMusicViaWechat/README.md: -------------------------------------------------------------------------------- 1 | # PCMusicViaWechat 2 | 3 | 这是一个Windows上使用微信个人账号控制电脑播放音乐的小程序。 4 | 5 | 通过与文件传输助手交互,完成音乐播放。 6 | 7 | ## Configuration 8 | 9 | ```bash 10 | pip install itchat, NetEaseMuiscApi 11 | ``` 12 | 13 | ## Run 14 | 15 | ```python 16 | python run.py 17 | ``` 18 | -------------------------------------------------------------------------------- /Programs/PCMusicViaWechat/run.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import os 3 | 4 | import itchat 5 | from NetEaseMusicApi import interact_select_song 6 | 7 | HELP_MSG = u'''\ 8 | 欢迎使用微信网易云音乐 9 | 帮助: 显示帮助 10 | 关闭: 关闭歌曲 11 | 歌名: 按照引导播放音乐\ 12 | ''' 13 | 14 | with open('stop.mp3', 'w') as f: pass 15 | def close_music(): 16 | os.startfile('stop.mp3') 17 | 18 | @itchat.msg_register(itchat.content.TEXT) 19 | def music_player(msg): 20 | if msg['ToUserName'] != 'filehelper': return 21 | if msg['Text'] == u'关闭': 22 | close_music() 23 | itchat.send(u'音乐已关闭', 'filehelper') 24 | if msg['Text'] == u'帮助': 25 | itchat.send(HELP_MSG, 'filehelper') 26 | else: 27 | itchat.send(interact_select_song(msg['Text']), 'filehelper') 28 | 29 | itchat.auto_login(True, enableCmdQR=True) 30 | itchat.send(HELP_MSG, 'filehelper') 31 | itchat.run() 32 | -------------------------------------------------------------------------------- /Programs/SetBurpProxy/README.md: -------------------------------------------------------------------------------- 1 | #SetBurpProxy 160106 2 | Aimed at: 3 | Change windows environment value to let web goes to Burp ports 4 | if environment value not set properly this will get it done 5 | after everything is done runing this again will get values cleared 6 | Close shadowsocks to avoid unnecessary disturb 7 | after everything is done runing this again will start shadowsocks 8 | Save some time:) 9 | Environment: 10 | Windows 8.1 - 64 11 | Python 2.7.10 (with psutil installed) 12 | Setting: 13 | Burp ports (default:127.0.0.1:8080) 14 | Path of Shadowsocks (default:./Shadowsocks.lnk) 15 | 16 | 目标: 17 | 完成流量流向Burp所需要的系统设置 18 | 如果系统设置没有完成时调用,将会完成相关设置 19 | 在使用完成后,重新调用本程序将清理环境设置 20 | 关闭Shadowsocks以减小影响 21 | 在使用完成后,重新调用本程序将启动Shadowsocks 22 | 我才不想每次抓包都点开那么多设置呢:) 23 | 环境: 24 | Windows 8.1 - 64 25 | Python 2.7.10 (安装 psutil) 26 | 设置: 27 | Burp端口设置(默认:127.0.0.1:8080) 28 | Shadowsocks文件位置(默认:./Shadowsocks.lnk) 29 | -------------------------------------------------------------------------------- /Programs/SetBurpProxy/SetBurpProxy.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import psutil, _winreg, os 3 | 4 | SHADOWSOCKS_PATH = r'"Shadowsocks.lnk"' 5 | PROXY_PORT = '127.0.0.1:8080' 6 | 7 | def manage_shadowsocks(flag='kill'): # kill/create 8 | for proc in psutil.process_iter(): 9 | try: 10 | pinfo = proc.as_dict(attrs=['pid', 'name']) 11 | except psutil.NoSuchProcess: 12 | pass 13 | else: 14 | if pinfo['name']=='Shadowsocks.exe': 15 | if flag == 'kill': proc.terminate() 16 | return 17 | if flag == 'create': os.startfile(SHADOWSOCKS_PATH) 18 | 19 | def get_process(keyList): 20 | try: 21 | i = 0 22 | while True: 23 | name, value, type = _winreg.EnumValue(key,i) 24 | keyList[str(name)] = value 25 | i+=1 26 | except WindowsError: 27 | pass 28 | return keyList 29 | 30 | def set_proxy(keyList): 31 | if keyList.has_key('AutoConfigURL'): _winreg.DeleteValue(key, 'AutoConfigURL') 32 | if keyList['ProxyEnable'] != 1: _winreg.SetValueEx(key, 'ProxyEnable', 0, _winreg.REG_DWORD, 1) 33 | if not keyList.has_key('ProxyServer'): 34 | _winreg.CreateKey(key, 'ProxyServer') 35 | _winreg.SetValueEx(key, 'ProxyServer', 0, _winreg.REG_SZ, PROXY_PORT) 36 | elif keyList['ProxyServer'] != PROXY_PORT: 37 | _winreg.SetValueEx(key, 'ProxyServer', 0, _winreg.REG_SZ, PROXY_PORT) 38 | 39 | 40 | if __name__ == '__main__': 41 | key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Internet Settings", 0, _winreg.KEY_ALL_ACCESS) 42 | keyList = get_process({}) 43 | if not keyList.has_key('AutoConfigURL') and keyList['ProxyEnable'] == 1 and keyList.has_key('ProxyServer') and keyList['ProxyServer'] == PROXY_PORT: # determine whether proxy is well set 44 | # if it's well set, close the proxy and clear the proxy setting 45 | manage_shadowsocks('create') # shadowsocks will automatically change regs 46 | print 'Ports Closed and Shadowsocks Started' 47 | else: 48 | # if it's not well set, get it done properly 49 | manage_shadowsocks('kill') 50 | set_proxy(keyList) 51 | print 'Shadowsocks Closed and Ports Set to '+PROXY_PORT 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EasierLife 2 | 3 | Coding makes my life easier. 4 | 5 | This is a factory contains many little programs. 6 | 7 | There are plugins like automatically pack memo on Evernote: [PackMemo](https://github.com/littlecodersh/EasierLife/wiki/1.0.2-PackMemo) 8 | 9 | Make output of command line not to disturb the input: [ChatLikeCMD](https://github.com/littlecodersh/EasierLife/wiki/0.0-ChatLikeCMD) 10 | 11 | MysqlClient and Sqlite3Client to make you cooperate with dbs in a time-saving and easy way: [MysqlClient](https://github.com/littlecodersh/EasierLife/wiki/0.4-MysqlClient) 12 | 13 | A framework to make api creation easier: [ApiFramework](https://github.com/littlecodersh/EasierLife/tree/master/Plugins/ApiFramework) 14 | 15 | Turn your data into a coordinate: [CoordinateClient](https://github.com/littlecodersh/EasierLife/tree/master/Plugins/CoordinateClient) 16 | 17 | And other little toys, I hope they will help you like they did to me:) 18 | -------------------------------------------------------------------------------- /Scripts/ChangeEncode.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | for t in os.walk('.'): 4 | for _file in t[2]: 5 | if(_file[-2:] == '.h' or _file[-4:] == '.cpp'): 6 | print('%s is processing'%_file) 7 | with open(_file) as f: 8 | with open(os.path.join('encoding', _file), 'w') as output: 9 | output.write(f.read().decode('utf8').encode('cp936')) 10 | -------------------------------------------------------------------------------- /Scripts/DaYuSMS.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import json 3 | 4 | import top 5 | 6 | r = top.api.AlibabaAliqinFcTtsNumSinglecallRequest() 7 | r.set_app_info(top.appinfo('your_app_key', 'your_app_secret')) 8 | 9 | r.tts_param = json.dumps({ 10 | 'code': u'You will get this through you phone',}) 11 | r.extend = 'TG' 12 | r.called_num = 'your_phone_number' 13 | r.called_show_num = '4008823220' 14 | r.tts_code = 'TTS_10265961' 15 | 16 | try: 17 | print r.getResponse() 18 | except Exception, e: 19 | print e.submsg 20 | -------------------------------------------------------------------------------- /Scripts/ExcelClient.py: -------------------------------------------------------------------------------- 1 | #coding = utf8 2 | ''' 3 | getData() returns a LIST contains a row in order 4 | storeData() stores a LIST contains a row in order 5 | ''' 6 | import xlrd, xlwt 7 | 8 | class ExcelClient: 9 | def __init__(self, sourceDir = None, outputDir = None, sourceIndex = None, outputHeader = None): 10 | self.sourceDir = sourceDir 11 | self.outputDir = outputDir if outputDir else 'DemoExcelClientOutput.xls' 12 | self.source = self.getSource(sourceIndex) if sourceIndex else None 13 | self.output = self.setOutput() 14 | self.storeData(outputHeader) 15 | def getSource(self, dataRange): # content will be the first 16 | with xlrd.open_workbook(self.sourceDir) as workbook: 17 | table = workbook.sheets()[0] 18 | for i in range(1, table.nrows): # ignore header 19 | yield [table.row_values(i)[j] for j in dataRange] 20 | def setOutput(self): 21 | workbook = xlwt.Workbook() 22 | table = workbook.add_sheet('metaData') 23 | row = 0 24 | while True: 25 | if self.outputData: 26 | for col in range(len(self.outputData)): table.write(row, col, self.outputData[col]) 27 | row += 1 28 | workbook.save(self.outputDir) 29 | yield True 30 | else: 31 | yield False 32 | def getData(self): # returns a LIST contains a row in order 33 | try: 34 | return self.source.next() 35 | except StopIteration, AttributeError: 36 | return None 37 | def storeData(self, data): # stores a LIST contains a row in order 38 | self.outputData = data 39 | return self.output.next() 40 | 41 | if __name__ == '__main__': 42 | iec = ExcelClient(sourceDir = '1.xlsx', sourceIndex = (0,1)) 43 | oec = ExcelClient(outputDir = '1.xlsx', outputHeader = ['subject', 'time']) 44 | for i in range(3): 45 | data = iec.getData() 46 | oec.storeData(data) 47 | 48 | -------------------------------------------------------------------------------- /Scripts/IdentificationNumber/IdentificationNumber.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import sys 3 | 4 | def get_id_num(): 5 | districtDict = {} 6 | with open('district.cfg') as f: 7 | for i in f: districtDict[i[6:].strip().decode('utf8')] = i[:6] 8 | def warn(fn): 9 | def _warn(*arg, **kwargs): 10 | r = fn(*arg, **kwargs) 11 | if r is None: raise Exception('Wrong %s!'%fn.__name__) 12 | return r 13 | return _warn 14 | @warn 15 | def district(name): return districtDict.get(name) 16 | @warn 17 | def date(date): 18 | try: 19 | return date if 10000000 <= int(date) <= 99999999 else None 20 | except: 21 | return 22 | @warn 23 | def uni_num(num): 24 | try: 25 | return '%03d'%int(num) if 0 <= int(num) <= 999 else None 26 | except: 27 | return 28 | def parity(s): 29 | n = '7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2'.split(' ') 30 | r = 0 31 | for i, j in zip(n, [c for c in s]): r += int(i) * int(j) 32 | return '1 0 X 9 8 7 6 5 4 3 2'.split(' ')[r%11] 33 | def _get_id_num(s): return s + parity(s) 34 | try: 35 | return _get_id_num(district(raw_input(u'District: [] ').decode(sys.stdin.encoding)) + 36 | date(raw_input(u'Date: [19220101] ')) + 37 | uni_num(raw_input(u'Code: [000] '))) 38 | except Exception, e: 39 | print(e) 40 | 41 | if __name__ == '__main__': 42 | print(get_id_num()) 43 | -------------------------------------------------------------------------------- /Scripts/IdentificationNumber/district.cfg: -------------------------------------------------------------------------------- 1 | 110000北京 2 | 110101东城区 3 | 110102西城区 4 | 110105朝阳区 5 | 110106丰台区 6 | 110107石景山区 7 | 110108海淀区 8 | 110109门头沟区 9 | 110111房山区 10 | 110112通州区 11 | 110113顺义区 12 | 110114昌平区 13 | 110115大兴区 14 | 110116怀柔区 15 | 110117平谷区 16 | 110228密云县 17 | 110229延庆县 18 | 120000天津 19 | 120101和平区 20 | 120102河东区 21 | 120103河西区 22 | 120104南开区 23 | 120105河北区 24 | 120106红桥区 25 | 120110东丽区 26 | 120111西青区 27 | 120112津南区 28 | 120113北辰区 29 | 120114武清区 30 | 120115宝坻区 31 | 120116滨海新区 32 | 120221宁河县 33 | 120223静海县 34 | 120225蓟县 35 | 130000河北 36 | 130100石家庄 37 | 130102长安区 38 | 130103桥东区 39 | 130104桥西区 40 | 130105新华区 41 | 130107井陉矿区 42 | 130108裕华区 43 | 130121井陉县 44 | 130123正定县 45 | 130124栾城县 46 | 130125行唐县 47 | 130126灵寿县 48 | 130127高邑县 49 | 130128深泽县 50 | 130129赞皇县 51 | 130130无极县 52 | 130131平山县 53 | 130132元氏县 54 | 130133赵县 55 | 130181辛集市 56 | 130182藁城市 57 | 130183晋州市 58 | 130184新乐市 59 | 130185鹿泉市 60 | 130200唐山市 61 | 130202路南区 62 | 130203路北区 63 | 130204古冶区 64 | 130205开平区 65 | 130207丰南区 66 | 130208丰润区 67 | 130223滦县 68 | 130224滦南县 69 | 130225乐亭县 70 | 130227迁西县 71 | 130229玉田县 72 | 130230曹妃甸区 73 | 130281遵化市 74 | 130283迁安市 75 | 130300秦皇岛 76 | 130302海港区 77 | 130303山海关区 78 | 130304北戴河区 79 | 130321青龙县 80 | 130322昌黎县 81 | 130323抚宁县 82 | 130324卢龙县 83 | 130400邯郸 84 | 130402邯山区 85 | 130403丛台区 86 | 130404复兴区 87 | 130406峰峰矿区 88 | 130421邯郸县 89 | 130423临漳县 90 | 130424成安县 91 | 130425大名县 92 | 130426涉县 93 | 130427磁县 94 | 130428肥乡县 95 | 130429永年县 96 | 130430邱县 97 | 130431鸡泽县 98 | 130432广平县 99 | 130433馆陶县 100 | 130434魏县 101 | 130435曲周县 102 | 130481武安市 103 | 130500邢台 104 | 130502桥东区 105 | 130503桥西区 106 | 130521邢台县 107 | 130522临城县 108 | 130523内丘县 109 | 130524柏乡县 110 | 130525隆尧县 111 | 130526任县 112 | 130527南和县 113 | 130528宁晋县 114 | 130529巨鹿县 115 | 130530新河县 116 | 130531广宗县 117 | 130533威县 118 | 130534清河县 119 | 130535临西县 120 | 130581南宫市 121 | 130582沙河市 122 | 130600保定 123 | 130602新市区 124 | 130603北市区 125 | 130604南市区 126 | 130621满城县 127 | 130622清苑县 128 | 130623涞水县 129 | 130624阜平县 130 | 130625徐水县 131 | 130626定兴县 132 | 130627唐县 133 | 130628高阳县 134 | 130629容城县 135 | 130630涞源县 136 | 130631望都县 137 | 130632安新县 138 | 130633易县 139 | 130634曲阳县 140 | 130635蠡县 141 | 130636顺平县 142 | 130637博野县 143 | 130638雄县 144 | 130681涿州市 145 | 130682定州市 146 | 130683安国市 147 | 130684高碑店市 148 | 130700张家口 149 | 130702桥东区 150 | 130703桥西区 151 | 130705宣化区 152 | 130706下花园区 153 | 130721宣化县 154 | 130722张北县 155 | 130723康保县 156 | 130724沽源县 157 | 130725尚义县 158 | 130726蔚县 159 | 130727阳原县 160 | 130728怀安县 161 | 130729万全县 162 | 130730怀来县 163 | 130731涿鹿县 164 | 130732赤城县 165 | 130733崇礼县 166 | 130800承德 167 | 130802双桥区 168 | 130803双滦区 169 | 130804鹰手营子矿区 170 | 130821承德县 171 | 130822兴隆县 172 | 130823平泉县 173 | 130824滦平县 174 | 130825隆化县 175 | 130826丰宁满族自治县 176 | 130827宽城县 177 | 130828围场县 178 | 130900沧州 179 | 130902新华区 180 | 130903运河区 181 | 130921沧县 182 | 130922青县 183 | 130923东光县 184 | 130924海兴县 185 | 130925盐山县 186 | 130926肃宁县 187 | 130927南皮县 188 | 130928吴桥县 189 | 130929献县 190 | 130930孟村回族自治县 191 | 130981泊头市 192 | 130982任丘市 193 | 130983黄骅市 194 | 130984河间市 195 | 131000廊坊 196 | 131002安次区 197 | 131003广阳区 198 | 131022固安县 199 | 131023永清县 200 | 131024香河县 201 | 131025大城县 202 | 131026文安县 203 | 131028大厂回族自治县 204 | 131081霸州市 205 | 131082三河市 206 | 131100衡水 207 | 131102桃城区 208 | 131121枣强县 209 | 131122武邑县 210 | 131123武强县 211 | 131124饶阳县 212 | 131125安平县 213 | 131126故城县 214 | 131127景县 215 | 131128阜城县 216 | 131181冀州市 217 | 131182深州市 218 | 140000山西 219 | 140100太原 220 | 140105小店区 221 | 140106迎泽区 222 | 140107杏花岭区 223 | 140108尖草坪区 224 | 140109万柏林区 225 | 140110晋源区 226 | 140121清徐县 227 | 140122阳曲县 228 | 140123娄烦县 229 | 140181古交市 230 | 140200大同 231 | 140202城区 232 | 140203矿区 233 | 140211南郊区 234 | 140212新荣区 235 | 140221阳高县 236 | 140222天镇县 237 | 140223广灵县 238 | 140224灵丘县 239 | 140225浑源县 240 | 140226左云县 241 | 140227大同县 242 | 140300阳泉 243 | 140302城区 244 | 140303矿区 245 | 140311郊区 246 | 140321平定县 247 | 140322盂县 248 | 140400长治 249 | 140402城区 250 | 140411郊区 251 | 140421长治县 252 | 140423襄垣县 253 | 140424屯留县 254 | 140425平顺县 255 | 140426黎城县 256 | 140427壶关县 257 | 140428长子县 258 | 140430沁县 259 | 140431沁源县 260 | 140481潞城市 261 | 140500晋城 262 | 140502城区 263 | 140521沁水县 264 | 140522阳城县 265 | 140524陵川县 266 | 140525泽州县 267 | 140581高平市 268 | 140600朔州 269 | 140602朔城区 270 | 140603平鲁区 271 | 140621山阴县 272 | 140622应县 273 | 140623右玉县 274 | 140624怀仁县 275 | 140700晋中 276 | 140702榆次区 277 | 140721榆社县 278 | 140722左权县 279 | 140723和顺县 280 | 140724昔阳县 281 | 140725寿阳县 282 | 140726太谷县 283 | 140727祁县 284 | 140728平遥县 285 | 140729灵石县 286 | 140781介休市 287 | 140800运城 288 | 140802盐湖区 289 | 140821临猗县 290 | 140822万荣县 291 | 140823闻喜县 292 | 140824稷山县 293 | 140825新绛县 294 | 140826绛县 295 | 140827垣曲县 296 | 140828夏县 297 | 140829平陆县 298 | 140830芮城县 299 | 140881永济市 300 | 140882河津市 301 | 140900忻州 302 | 140902忻府区 303 | 140921定襄县 304 | 140922五台县 305 | 140923代县 306 | 140924繁峙县 307 | 140925宁武县 308 | 140926静乐县 309 | 140927神池县 310 | 140928五寨县 311 | 140929岢岚县 312 | 140930河曲县 313 | 140931保德县 314 | 140932偏关县 315 | 140981原平市 316 | 141000临汾 317 | 141002尧都区 318 | 141021曲沃县 319 | 141022翼城县 320 | 141023襄汾县 321 | 141024洪洞县 322 | 141025古县 323 | 141026安泽县 324 | 141027浮山县 325 | 141028吉县 326 | 141029乡宁县 327 | 141030大宁县 328 | 141031隰县 329 | 141032永和县 330 | 141033蒲县 331 | 141034汾西县 332 | 141081侯马市 333 | 141082霍州市 334 | 141100吕梁 335 | 141102离石区 336 | 141121文水县 337 | 141122交城县 338 | 141123兴县 339 | 141124临县 340 | 141125柳林县 341 | 141126石楼县 342 | 141127岚县 343 | 141128方山县 344 | 141129中阳县 345 | 141130交口县 346 | 141181孝义市 347 | 141182汾阳市 348 | 150000内蒙古 349 | 150100呼和浩特 350 | 150102新城区 351 | 150103回民区 352 | 150104玉泉区 353 | 150105赛罕区 354 | 150121土默特左旗 355 | 150122托克托县 356 | 150123和林格尔县 357 | 150124清水河县 358 | 150125武川县 359 | 150200包头市 360 | 150202东河区 361 | 150203昆都仑区 362 | 150204青山区 363 | 150205石拐区 364 | 150206白云鄂博矿区 365 | 150207九原区 366 | 150221土默特右旗 367 | 150222固阳县 368 | 150223达尔罕旗 369 | 150300乌海市 370 | 150302海勃湾区 371 | 150303海南区 372 | 150304乌达区 373 | 150400赤峰市 374 | 150402红山区 375 | 150403元宝山区 376 | 150404松山区 377 | 150421阿鲁旗 378 | 150422巴林左旗 379 | 150423巴林右旗 380 | 150424林西县 381 | 150425克什克腾旗 382 | 150426翁牛特旗 383 | 150428喀喇沁旗 384 | 150429宁城县 385 | 150430敖汉旗 386 | 150500通辽市 387 | 150502科尔沁区 388 | 150521科尔沁左翼中旗 389 | 150522科尔沁左翼后旗 390 | 150523开鲁县 391 | 150524库伦旗 392 | 150525奈曼旗 393 | 150526扎鲁特旗 394 | 150581霍林郭勒市 395 | 150600鄂尔多斯 396 | 150602东胜区 397 | 150621达拉特旗 398 | 150622准格尔旗 399 | 150623鄂托克前旗 400 | 150624鄂托克旗 401 | 150625杭锦旗 402 | 150626乌审旗 403 | 150627伊金霍洛旗 404 | 150700呼伦贝尔 405 | 150700扎赉诺尔区 406 | 150702海拉尔区 407 | 150721阿荣旗 408 | 150722莫力达瓦旗 409 | 150723鄂伦春自治旗 410 | 150724鄂温克族自治旗 411 | 150725陈巴尔虎旗 412 | 150726新巴尔虎左旗 413 | 150727新巴尔虎右旗 414 | 150781满洲里 415 | 150782牙克石市 416 | 150783扎兰屯市 417 | 150784额尔古纳市 418 | 150785根河市 419 | 150800巴彦淖尔 420 | 150802临河区 421 | 150821五原县 422 | 150822磴口县 423 | 150823乌拉特前旗 424 | 150824乌拉特中旗 425 | 150825乌拉特后旗 426 | 150826杭锦后旗 427 | 150900乌兰察布 428 | 150902集宁区 429 | 150921卓资县 430 | 150922化德县 431 | 150923商都县 432 | 150924兴和县 433 | 150925凉城县 434 | 150926察哈尔右翼前旗 435 | 150927察哈尔右翼中旗 436 | 150928察哈尔右翼后旗 437 | 150929四子王旗 438 | 150981丰镇市 439 | 152200兴安盟 440 | 152201乌兰浩特市 441 | 152202阿尔山市 442 | 152221科尔沁右翼前旗 443 | 152222科尔沁右翼中旗 444 | 152223扎赉特旗 445 | 152224突泉县 446 | 152500锡林郭勒盟 447 | 152501二连浩特市 448 | 152502锡林浩特市 449 | 152522阿巴嘎旗 450 | 152523苏尼特左旗 451 | 152524苏尼特右旗 452 | 152525东乌珠穆沁旗 453 | 152526西乌珠穆沁 454 | 152527太仆寺旗 455 | 152528镶黄旗 456 | 152529正镶白旗 457 | 152530正蓝旗 458 | 152531多伦县 459 | 152900阿拉善盟 460 | 152921阿拉善左旗 461 | 152922阿拉善右旗 462 | 152923额济纳旗 463 | 210000辽宁 464 | 210100沈阳 465 | 210102和平区 466 | 210103沈河区 467 | 210104大东区 468 | 210105皇姑区 469 | 210106铁西区 470 | 210111苏家屯区 471 | 210112东陵区 472 | 210113沈北新区 473 | 210114于洪区 474 | 210122辽中县 475 | 210123康平县 476 | 210124法库县 477 | 210181新民市 478 | 210200大连 479 | 210202中山区 480 | 210203西岗区 481 | 210204沙河口区 482 | 210211甘井子区 483 | 210212旅顺口区 484 | 210213金州区 485 | 210224长海县 486 | 210281瓦房店市 487 | 210282普兰店市 488 | 210283庄河市 489 | 210300鞍山 490 | 210302铁东区 491 | 210303铁西区 492 | 210304立山区 493 | 210311千山区 494 | 210321台安县 495 | 210323岫岩满族自治县 496 | 210381海城市 497 | 210400抚顺 498 | 210402新抚区 499 | 210403东洲区 500 | 210404望花区 501 | 210411顺城区 502 | 210421抚顺县 503 | 210422新宾满族自治县 504 | 210423清原满族自治县 505 | 210500本溪 506 | 210502平山区 507 | 210503溪湖区 508 | 210504明山区 509 | 210505南芬区 510 | 210521本溪满族自治县 511 | 210522桓仁满族自治县 512 | 210600丹东 513 | 210602元宝区 514 | 210603振兴区 515 | 210604振安区 516 | 210624宽甸满族自治县 517 | 210681东港市 518 | 210682凤城市 519 | 210700锦州 520 | 210702古塔区 521 | 210703凌河区 522 | 210711太和区 523 | 210726黑山县 524 | 210727义县 525 | 210781凌海市 526 | 210782北镇市 527 | 210800营口 528 | 210802站前区 529 | 210803西市区 530 | 210804鲅鱼圈区 531 | 210811老边区 532 | 210881盖州市 533 | 210882大石桥市 534 | 210900阜新 535 | 210902海州区 536 | 210903新邱区 537 | 210904太平区 538 | 210905清河门区 539 | 210911细河区 540 | 210921阜新蒙古族自治县 541 | 210922彰武县 542 | 211000辽阳 543 | 211002白塔区 544 | 211003文圣区 545 | 211004宏伟区 546 | 211005弓长岭区 547 | 211011太子河区 548 | 211021辽阳县 549 | 211081灯塔市 550 | 211100盘锦 551 | 211102双台子区 552 | 211103兴隆台区 553 | 211121大洼县 554 | 211122盘山县 555 | 211200铁岭 556 | 211202银州区 557 | 211204清河区 558 | 211221铁岭县 559 | 211223西丰县 560 | 211224昌图县 561 | 211281调兵山市 562 | 211282开原市 563 | 211300朝阳 564 | 211302双塔区 565 | 211303龙城区 566 | 211321朝阳县 567 | 211322建平县 568 | 211324喀左县 569 | 211381北票市 570 | 211382凌源市 571 | 211400葫芦岛 572 | 211402连山区 573 | 211403龙港区 574 | 211404南票区 575 | 211421绥中县 576 | 211422建昌县 577 | 211481兴城市 578 | 220000吉林 579 | 220100长春市 580 | 220102南关区 581 | 220103宽城区 582 | 220104朝阳区 583 | 220105二道区 584 | 220106绿园区 585 | 220112双阳区 586 | 220122农安县 587 | 220181九台市 588 | 220182榆树市 589 | 220183德惠市 590 | 220200吉林市 591 | 220202昌邑区 592 | 220203龙潭区 593 | 220204船营区 594 | 220211丰满区 595 | 220221永吉县 596 | 220281蛟河市 597 | 220282桦甸市 598 | 220283舒兰市 599 | 220284磐石市 600 | 220300四平市 601 | 220302铁西区 602 | 220303铁东区 603 | 220322梨树县 604 | 220323伊通满族自治县 605 | 220381公主岭市 606 | 220382双辽市 607 | 220400辽源市 608 | 220402龙山区 609 | 220403西安区 610 | 220421东丰县 611 | 220422东辽县 612 | 220500通化市 613 | 220502东昌区 614 | 220503二道江区 615 | 220521通化县 616 | 220523辉南县 617 | 220524柳河县 618 | 220581梅河口市 619 | 220582集安市 620 | 220600白山市 621 | 220602浑江区 622 | 220605江源区 623 | 220621抚松县 624 | 220622靖宇县 625 | 220623长白朝鲜族自治县 626 | 220681临江市 627 | 220700松原市 628 | 220702宁江区 629 | 220721前郭尔罗斯县 630 | 220722长岭县 631 | 220723乾安县 632 | 220724扶余市 633 | 220800白城市 634 | 220802洮北区 635 | 220821镇赉县 636 | 220822通榆县 637 | 220881洮南市 638 | 220882大安市 639 | 222400延边州 640 | 222401延吉市 641 | 222402图们市 642 | 222403敦化市 643 | 222404珲春市 644 | 222405龙井市 645 | 222406和龙市 646 | 222424汪清县 647 | 222426安图县 648 | 230000黑龙江 649 | 230100哈尔滨 650 | 230102道里区 651 | 230103南岗区 652 | 230104道外区 653 | 230108平房区 654 | 230109松北区 655 | 230110香坊区 656 | 230111呼兰区 657 | 230112阿城区 658 | 230123依兰县 659 | 230124方正县 660 | 230125宾县 661 | 230126巴彦县 662 | 230127木兰县 663 | 230128通河县 664 | 230129延寿县 665 | 230182双城市 666 | 230183尚志市 667 | 230184五常市 668 | 230200齐齐哈尔 669 | 230202龙沙区 670 | 230203建华区 671 | 230204铁锋区 672 | 230205昂昂溪区 673 | 230206富拉尔基区 674 | 230207碾子山区 675 | 230208梅里斯达斡尔族区 676 | 230221龙江县 677 | 230223依安县 678 | 230224泰来县 679 | 230225甘南县 680 | 230227富裕县 681 | 230229克山县 682 | 230230克东县 683 | 230231拜泉县 684 | 230281讷河市 685 | 230300鸡西 686 | 230302鸡冠区 687 | 230303恒山市 688 | 230304滴道区 689 | 230305梨树区 690 | 230306城子河区 691 | 230307麻山区 692 | 230321鸡东县 693 | 230381虎林市 694 | 230382密山市 695 | 230400鹤岗 696 | 230402向阳区 697 | 230403工农区 698 | 230404南山区 699 | 230405兴安区 700 | 230406东山区 701 | 230407兴山区 702 | 230421萝北县 703 | 230422绥滨县 704 | 230500双鸭山 705 | 230502尖山区 706 | 230503岭东区 707 | 230505四方台区 708 | 230506宝山区 709 | 230521集贤县 710 | 230522友谊县 711 | 230523宝清县 712 | 230524饶河县 713 | 230600大庆 714 | 230602萨尔图区 715 | 230603龙凤区 716 | 230604让胡路区 717 | 230605红岗区 718 | 230606大同区 719 | 230621肇州县 720 | 230622肇源县 721 | 230623林甸县 722 | 230624杜尔伯特蒙县 723 | 230700伊春 724 | 230702伊春区 725 | 230703南岔区 726 | 230704友好区 727 | 230705西林区 728 | 230706翠峦区 729 | 230707新青区 730 | 230708美溪区 731 | 230709金山屯 732 | 230710五营区 733 | 230711乌马河 734 | 230712汤旺河 735 | 230713带岭区 736 | 230714乌伊岭 737 | 230715红星区 738 | 230716上甘岭 739 | 230722嘉荫县 740 | 230781铁力市 741 | 230800佳木斯 742 | 230803向阳区 743 | 230804前进区 744 | 230805东风区 745 | 230811郊区 746 | 230822桦南县 747 | 230826桦川县 748 | 230828汤原县 749 | 230833抚远县 750 | 230881同江市 751 | 230882富锦市 752 | 230900七台河 753 | 230902新兴区 754 | 230903桃山市 755 | 230904茄子河区 756 | 230921勃利县 757 | 231000牡丹江 758 | 231002东安区 759 | 231003阳明区 760 | 231004爱民区 761 | 231005西安区 762 | 231024东宁县 763 | 231025林口县 764 | 231081绥芬河市 765 | 231083海林市 766 | 231084宁安市 767 | 231085穆棱市 768 | 231100黑河 769 | 231102爱辉区 770 | 231121嫩江县 771 | 231123逊克县 772 | 231124孙吴县 773 | 231181北安市 774 | 231182五大连池市 775 | 231200绥化 776 | 231202北林区 777 | 231221望奎县 778 | 231222兰西县 779 | 231223青冈县 780 | 231224庆安县 781 | 231225明水县 782 | 231226绥棱县 783 | 231281安达市 784 | 231282肇东市 785 | 231283海伦市 786 | 232700大兴安岭 787 | 232701加格达奇区 788 | 232702松岭区 789 | 232703新林区 790 | 232704呼中区 791 | 232721呼玛县 792 | 232722塔河县 793 | 232723漠河县 794 | 310000上海 795 | 310101黄浦区 796 | 310104徐汇区 797 | 310105长宁区 798 | 310106静安区 799 | 310107普陀区 800 | 310108闸北区 801 | 310109虹口区 802 | 310110杨浦区 803 | 310112闵行区 804 | 310113宝山区 805 | 310114嘉定区 806 | 310115浦东新区 807 | 310116金山区 808 | 310117松江区 809 | 310118青浦区 810 | 310120奉贤区 811 | 310230崇明县 812 | 320000江苏 813 | 320100南京 814 | 320102玄武区 815 | 320104秦淮区 816 | 320105建邺区 817 | 320106鼓楼区 818 | 320111浦口区 819 | 320113栖霞区 820 | 320114雨花台区 821 | 320115江宁区 822 | 320116六合区 823 | 320124溧水区 824 | 320125高淳区 825 | 320200无锡 826 | 320202崇安区 827 | 320203南长区 828 | 320204北塘区 829 | 320205锡山区 830 | 320206惠山区 831 | 320211滨湖区 832 | 320281江阴市 833 | 320282宜兴市 834 | 320300徐州 835 | 320302鼓楼区 836 | 320303云龙区 837 | 320305贾汪区 838 | 320311泉山区 839 | 320312铜山区 840 | 320321丰县 841 | 320322沛县 842 | 320324睢宁县 843 | 320381新沂市 844 | 320382邳州市 845 | 320400常州 846 | 320402天宁区 847 | 320404钟楼区 848 | 320405戚墅堰区 849 | 320411新北区 850 | 320412武进区 851 | 320481溧阳市 852 | 320482金坛市 853 | 320500苏州 854 | 320502姑苏区 855 | 320505虎丘区 856 | 320506吴中区 857 | 320507相城区 858 | 320581常熟市 859 | 320582张家港市 860 | 320583昆山市 861 | 320584吴江区 862 | 320585太仓市 863 | 320600南通 864 | 320602崇川区 865 | 320611港闸区 866 | 320612通州区 867 | 320621海安县 868 | 320623如东县 869 | 320681启东市 870 | 320682如皋市 871 | 320684海门市 872 | 320700连云港 873 | 320703连云区 874 | 320705新浦区 875 | 320706海州区 876 | 320721赣榆县 877 | 320722东海县 878 | 320723灌云县 879 | 320724灌南县 880 | 320800淮安 881 | 320802清河区 882 | 320803淮安区 883 | 320804淮阴区 884 | 320811清浦区 885 | 320826涟水县 886 | 320829洪泽县 887 | 320830盱眙县 888 | 320831金湖县 889 | 320900盐城 890 | 320902亭湖区 891 | 320903盐都区 892 | 320921响水县 893 | 320922滨海县 894 | 320923阜宁县 895 | 320924射阳县 896 | 320925建湖县 897 | 320981东台市 898 | 320982大丰市 899 | 321000扬州 900 | 321002广陵区 901 | 321003邗江区 902 | 321023宝应县 903 | 321081仪征市 904 | 321084高邮市 905 | 321088江都区 906 | 321100镇江 907 | 321102京口区 908 | 321111润州区 909 | 321112丹徒区 910 | 321181丹阳市 911 | 321182扬中市 912 | 321183句容市 913 | 321200泰州 914 | 321202海陵区 915 | 321203高港区 916 | 321281兴化市 917 | 321282靖江市 918 | 321283泰兴市 919 | 321284姜堰区 920 | 321302宿城区 921 | 321311宿豫区 922 | 321322沭阳县 923 | 321323泗阳县 924 | 321324泗洪县 925 | 330000浙江省 926 | 330100杭州 927 | 330102上城区 928 | 330103下城区 929 | 330104江干区 930 | 330105拱墅区 931 | 330106西湖区 932 | 330108滨江区 933 | 330109萧山区 934 | 330110余杭区 935 | 330122桐庐县 936 | 330127淳安县 937 | 330182建德市 938 | 330183富阳市 939 | 330185临安市 940 | 330200宁波 941 | 330203海曙区 942 | 330204江东区 943 | 330205江北区 944 | 330206北仑区 945 | 330211镇海区 946 | 330212鄞州区 947 | 330225象山县 948 | 330226宁海县 949 | 330281余姚市 950 | 330282慈溪市 951 | 330283奉化市 952 | 330300温州 953 | 330302鹿城区 954 | 330303龙湾区 955 | 330304瓯海区 956 | 330322洞头县 957 | 330324永嘉县 958 | 330326平阳县 959 | 330327苍南县 960 | 330328文成县 961 | 330329泰顺县 962 | 330381瑞安市 963 | 330382乐清市 964 | 330400嘉兴 965 | 330402南湖区 966 | 330411秀洲区 967 | 330421嘉善县 968 | 330424海盐县 969 | 330481海宁市 970 | 330482平湖市 971 | 330500湖州 972 | 330502吴兴区 973 | 330503南浔区 974 | 330521德清县 975 | 330522长兴县 976 | 330523安吉县 977 | 330600绍兴 978 | 330602越城区 979 | 330621绍兴县 980 | 330624新昌县 981 | 330681诸暨市 982 | 330682上虞市 983 | 330683嵊州市 984 | 330700金华 985 | 330702婺城区 986 | 330703金东区 987 | 330723武义县 988 | 330726浦江县 989 | 330727磐安县 990 | 330781兰溪市 991 | 330782义乌市 992 | 330783东阳市 993 | 330784永康市 994 | 330800衢州 995 | 330802柯城区 996 | 330803衢江区 997 | 330822常山县 998 | 330824开化县 999 | 330825龙游县 1000 | 330881江山市 1001 | 330900舟山 1002 | 330902定海区 1003 | 330903普陀区 1004 | 330921岱山县 1005 | 330922嵊泗县 1006 | 331000台州 1007 | 331002椒江区 1008 | 331003黄岩区 1009 | 331004路桥区 1010 | 331021玉环县 1011 | 331022三门县 1012 | 331023天台县 1013 | 331024仙居县 1014 | 331081温岭市 1015 | 331082临海市 1016 | 331100丽水 1017 | 331102莲都区 1018 | 331121青田县 1019 | 331122缙云县 1020 | 331123遂昌县 1021 | 331124松阳县 1022 | 331125云和县 1023 | 331126庆元县 1024 | 331127龙泉市 1025 | 331127景宁县 1026 | 340000安徽 1027 | 340100合肥市 1028 | 340102瑶海区 1029 | 340103庐阳区 1030 | 340104蜀山区 1031 | 340111包河区 1032 | 340121长丰县 1033 | 340122肥东县 1034 | 340123肥西县 1035 | 340200芜湖市 1036 | 340202镜湖区 1037 | 340203弋江区 1038 | 340207鸠江区 1039 | 340208三山区 1040 | 340221芜湖县 1041 | 340222繁昌县 1042 | 340223南陵县 1043 | 340300蚌埠市 1044 | 340302龙子湖区 1045 | 340303蚌山区 1046 | 340304禹会区 1047 | 340311淮上区 1048 | 340321怀远县 1049 | 340322五河县 1050 | 340323固镇县 1051 | 340400淮南市 1052 | 340402大通区 1053 | 340403田家庵区 1054 | 340404谢家集区 1055 | 340405八公山区 1056 | 340406潘集区 1057 | 340421凤台县 1058 | 340500马鞍山 1059 | 340502博望区 1060 | 340503花山区 1061 | 340504雨山区 1062 | 340521当涂县 1063 | 340600淮北市 1064 | 340602杜集区 1065 | 340603相山区 1066 | 340604烈山区 1067 | 340621濉溪县 1068 | 340700铜陵市 1069 | 340702铜官山区 1070 | 340703狮子山区 1071 | 340711郊区 1072 | 340721铜陵县 1073 | 340800安庆市 1074 | 340802迎江区 1075 | 340803大观区 1076 | 340811宜秀区 1077 | 340822怀宁县 1078 | 340823枞阳县 1079 | 340824潜山县 1080 | 340825太湖县 1081 | 340826宿松县 1082 | 340827望江县 1083 | 340828岳西县 1084 | 340881桐城市 1085 | 341000黄山市 1086 | 341002屯溪区 1087 | 341003黄山区 1088 | 341004徽州区 1089 | 341021歙县 1090 | 341022休宁县 1091 | 341023黟县 1092 | 341024祁门县 1093 | 341100滁州市 1094 | 341102琅琊区 1095 | 341103南谯区 1096 | 341122来安县 1097 | 341124全椒县 1098 | 341125定远县 1099 | 341126凤阳县 1100 | 341181天长市 1101 | 341182明光市 1102 | 341200阜阳市 1103 | 341202颍州区 1104 | 341203颍东区 1105 | 341204颍泉区 1106 | 341221临泉县 1107 | 341222太和县 1108 | 341225阜南县 1109 | 341226颍上县 1110 | 341282界首市 1111 | 341300宿州市 1112 | 341302埇桥区 1113 | 341321砀山县 1114 | 341322萧县 1115 | 341323灵璧县 1116 | 341324泗县 1117 | 341402巢湖市 1118 | 341421庐江县 1119 | 341422无为县 1120 | 341423含山县 1121 | 341424和县 1122 | 341500六安市 1123 | 341502金安区 1124 | 341503裕安区 1125 | 341521寿县 1126 | 341522霍邱县 1127 | 341523舒城县 1128 | 341524金寨县 1129 | 341525霍山县 1130 | 341600亳州市 1131 | 341602谯城区 1132 | 341621涡阳县 1133 | 341622蒙城县 1134 | 341623利辛县 1135 | 341700池州市 1136 | 341702贵池区 1137 | 341721东至县 1138 | 341722石台县 1139 | 341723青阳县 1140 | 341800宣城市 1141 | 341802宣州区 1142 | 341821郎溪县 1143 | 341822广德县 1144 | 341823泾县 1145 | 341824绩溪县 1146 | 341825旌德县 1147 | 341881宁国市 1148 | 350000福建 1149 | 350100福州 1150 | 350102鼓楼区 1151 | 350103台江区 1152 | 350104仓山区 1153 | 350105马尾区 1154 | 350111晋安区 1155 | 350121闽侯县 1156 | 350122连江县 1157 | 350123罗源县 1158 | 350124闽清县 1159 | 350125永泰县 1160 | 350128平潭县 1161 | 350181福清市 1162 | 350182长乐市 1163 | 350200厦门 1164 | 350203思明区 1165 | 350205海沧区 1166 | 350206湖里区 1167 | 350211集美区 1168 | 350212同安区 1169 | 350213翔安区 1170 | 350300莆田 1171 | 350302城厢区 1172 | 350303涵江区 1173 | 350304荔城区 1174 | 350305秀屿区 1175 | 350322仙游县 1176 | 350400三明 1177 | 350402梅列区 1178 | 350403三元区 1179 | 350421明溪县 1180 | 350423清流县 1181 | 350424宁化县 1182 | 350425大田县 1183 | 350426尤溪县 1184 | 350427沙县 1185 | 350428将乐县 1186 | 350429泰宁县 1187 | 350430建宁县 1188 | 350481永安市 1189 | 350500泉州 1190 | 350502鲤城区 1191 | 350503丰泽区 1192 | 350504洛江区 1193 | 350505泉港区 1194 | 350521惠安县 1195 | 350524安溪县 1196 | 350525永春县 1197 | 350526德化县 1198 | 350527金门县 1199 | 350581石狮市 1200 | 350582晋江市 1201 | 350583南安市 1202 | 350600漳州 1203 | 350602芗城区 1204 | 350603龙文区 1205 | 350622云霄县 1206 | 350623漳浦县 1207 | 350624诏安县 1208 | 350625长泰县 1209 | 350626东山县 1210 | 350627南靖县 1211 | 350628平和县 1212 | 350629华安县 1213 | 350681龙海市 1214 | 350700南平 1215 | 350702延平区 1216 | 350721顺昌县 1217 | 350722浦城县 1218 | 350723光泽县 1219 | 350724松溪县 1220 | 350725政和县 1221 | 350781邵武市 1222 | 350782武夷山市 1223 | 350783建瓯市 1224 | 350784建阳市 1225 | 350800龙岩 1226 | 350802新罗区 1227 | 350821长汀县 1228 | 350822永定县 1229 | 350823上杭县 1230 | 350824武平县 1231 | 350825连城县 1232 | 350881漳平市 1233 | 350900宁德 1234 | 350902蕉城区 1235 | 350921霞浦县 1236 | 350922古田县 1237 | 350923屏南县 1238 | 350924寿宁县 1239 | 350925周宁县 1240 | 350926柘荣县 1241 | 350981福安市 1242 | 350982福鼎市 1243 | 360000江西 1244 | 360100南昌 1245 | 360102东湖区 1246 | 360103西湖区 1247 | 360104青云谱区 1248 | 360105湾里区 1249 | 360111青山湖区 1250 | 360121南昌县 1251 | 360122新建县 1252 | 360123安义县 1253 | 360124进贤县 1254 | 360202昌江区 1255 | 360203珠山区 1256 | 360222浮梁县 1257 | 360281乐平市 1258 | 360300萍乡 1259 | 360302安源区 1260 | 360313湘东区 1261 | 360321莲花县 1262 | 360322上栗县 1263 | 360323芦溪县 1264 | 360400九江 1265 | 360402庐山区 1266 | 360403浔阳区 1267 | 360421九江县 1268 | 360423武宁县 1269 | 360424修水县 1270 | 360425永修县 1271 | 360426德安县 1272 | 360427星子县 1273 | 360428都昌县 1274 | 360429湖口县 1275 | 360430彭泽县 1276 | 360481瑞昌市 1277 | 360482共青城市 1278 | 360500新余 1279 | 360502渝水区 1280 | 360521分宜县 1281 | 360600鹰潭 1282 | 360602月湖区 1283 | 360622余江县 1284 | 360681贵溪市 1285 | 360700赣州 1286 | 360702章贡区 1287 | 360721赣县 1288 | 360722信丰县 1289 | 360723大余县 1290 | 360724上犹县 1291 | 360725崇义县 1292 | 360726安远县 1293 | 360727龙南县 1294 | 360728定南县 1295 | 360729全南县 1296 | 360730宁都县 1297 | 360731于都县 1298 | 360732兴国县 1299 | 360733会昌县 1300 | 360734寻乌县 1301 | 360735石城县 1302 | 360781瑞金市 1303 | 360782南康市 1304 | 360800吉安 1305 | 360802吉州区 1306 | 360803青原区 1307 | 360821吉安县 1308 | 360822吉水县 1309 | 360823峡江县 1310 | 360824新干县 1311 | 360825永丰县 1312 | 360826泰和县 1313 | 360827遂川县 1314 | 360828万安县 1315 | 360829安福县 1316 | 360830永新县 1317 | 360881井岗山市 1318 | 360900宜春 1319 | 360902袁州区 1320 | 360921奉新县 1321 | 360922万载县 1322 | 360923上高县 1323 | 360924宜丰县 1324 | 360925靖安县 1325 | 360926铜鼓县 1326 | 360981丰城市 1327 | 360982樟树市 1328 | 360983高安市 1329 | 361000抚州 1330 | 361002临川区 1331 | 361021南城县 1332 | 361022黎川县 1333 | 361023南丰县 1334 | 361024崇仁县 1335 | 361025乐安县 1336 | 361026宜黄县 1337 | 361027金溪县 1338 | 361028资溪县 1339 | 361029东乡县 1340 | 361030广昌县 1341 | 361100上饶 1342 | 361102信州区 1343 | 361121上饶县 1344 | 361122广丰县 1345 | 361123玉山县 1346 | 361124铅山县 1347 | 361125横峰县 1348 | 361126弋阳县 1349 | 361127余干县 1350 | 361128鄱阳县 1351 | 361129万年县 1352 | 361130婺源县 1353 | 361181德兴市 1354 | 370000山东 1355 | 370100济南 1356 | 370102历下区 1357 | 370103市中区 1358 | 370104槐荫区 1359 | 370105天桥区 1360 | 370112历城区 1361 | 370113长清区 1362 | 370124平阴县 1363 | 370125济阳县 1364 | 370126商河县 1365 | 370181章丘市 1366 | 370200青岛 1367 | 370202市南区 1368 | 370203市北区 1369 | 370211黄岛区 1370 | 370212崂山区 1371 | 370213李沧区 1372 | 370214城阳区 1373 | 370281胶州市 1374 | 370282即墨市 1375 | 370283平度市 1376 | 370285莱西市 1377 | 370300淄博 1378 | 370302淄川区 1379 | 370303张店区 1380 | 370304博山区 1381 | 370305临淄区 1382 | 370306周村区 1383 | 370321桓台县 1384 | 370322高青县 1385 | 370323沂源县 1386 | 370400枣庄 1387 | 370402市中区 1388 | 370403薛城区 1389 | 370404峄城区 1390 | 370405台儿庄区 1391 | 370406山亭区 1392 | 370481滕州市 1393 | 370500东营 1394 | 370502东营区 1395 | 370503河口区 1396 | 370521垦利县 1397 | 370522利津县 1398 | 370523广饶县 1399 | 370600烟台 1400 | 370602芝罘区 1401 | 370611福山区 1402 | 370612牟平区 1403 | 370613莱山区 1404 | 370634长岛县 1405 | 370681龙口市 1406 | 370682莱阳市 1407 | 370683莱州市 1408 | 370684蓬莱市 1409 | 370685招远市 1410 | 370686栖霞市 1411 | 370687海阳市 1412 | 370700潍坊 1413 | 370702潍城区 1414 | 370703寒亭区 1415 | 370704坊子区 1416 | 370705奎文区 1417 | 370724临朐县 1418 | 370725昌乐县 1419 | 370781青州市 1420 | 370782诸城市 1421 | 370783寿光市 1422 | 370784安丘市 1423 | 370785高密市 1424 | 370786昌邑市 1425 | 370800济宁 1426 | 370802市中区 1427 | 370811任城区 1428 | 370826微山县 1429 | 370827鱼台县 1430 | 370828金乡县 1431 | 370829嘉祥县 1432 | 370830汶上县 1433 | 370831泗水县 1434 | 370832梁山县 1435 | 370881曲阜市 1436 | 370882兖州市 1437 | 370883邹城市 1438 | 370900泰安 1439 | 370902泰山区 1440 | 370911岱岳区 1441 | 370921宁阳县 1442 | 370923东平县 1443 | 370982新泰市 1444 | 370983肥城市 1445 | 371000威海 1446 | 371002环翠区 1447 | 371081文登市 1448 | 371082荣成市 1449 | 371083乳山市 1450 | 371100日照 1451 | 371102东港区 1452 | 371103岚山区 1453 | 371121五莲县 1454 | 371122莒县 1455 | 371200莱芜 1456 | 371202莱城区 1457 | 371203钢城区 1458 | 371300临沂 1459 | 371302兰山区 1460 | 371311罗庄区 1461 | 371312河东区 1462 | 371321沂南县 1463 | 371322郯城县 1464 | 371323沂水县 1465 | 371324苍山县 1466 | 371325费县 1467 | 371326平邑县 1468 | 371327莒南县 1469 | 371328蒙阴县 1470 | 371329临沭县 1471 | 371400德州 1472 | 371402德城区 1473 | 371421陵县 1474 | 371422宁津县 1475 | 371423庆云县 1476 | 371424临邑县 1477 | 371425齐河县 1478 | 371426平原县 1479 | 371427夏津县 1480 | 371428武城县 1481 | 371481乐陵市 1482 | 371482禹城市 1483 | 371500聊城 1484 | 371502东昌府区 1485 | 371521阳谷县 1486 | 371522莘县 1487 | 371523茌平县 1488 | 371524东阿县 1489 | 371525冠县 1490 | 371526高唐县 1491 | 371581临清市 1492 | 371600滨州 1493 | 371602滨城区 1494 | 371621惠民县 1495 | 371622阳信县 1496 | 371623无棣县 1497 | 371624沾化县 1498 | 371625博兴县 1499 | 371626邹平县 1500 | 371700菏泽 1501 | 371702牡丹区 1502 | 371721曹县 1503 | 371722单县 1504 | 371723成武县 1505 | 371724巨野县 1506 | 371725郓城县 1507 | 371726鄄城县 1508 | 371727定陶县 1509 | 371728东明县 1510 | 410000河南 1511 | 410100郑州 1512 | 410102中原区 1513 | 410103二七区 1514 | 410104管城回族区 1515 | 410105金水区 1516 | 410106上街区 1517 | 410108惠济区 1518 | 410122中牟县 1519 | 410181巩义市 1520 | 410182荥阳市 1521 | 410183新密市 1522 | 410184新郑市 1523 | 410185登封市 1524 | 410200开封 1525 | 410202龙亭区 1526 | 410203顺河回族区 1527 | 410204鼓楼区 1528 | 410205禹王台区 1529 | 410211金明区 1530 | 410221杞县 1531 | 410222通许县 1532 | 410223尉氏县 1533 | 410224开封县 1534 | 410225兰考县 1535 | 410300洛阳 1536 | 410302老城区 1537 | 410303西工区 1538 | 410304瀍河区 1539 | 410305涧西区 1540 | 410306吉利区 1541 | 410311洛龙区 1542 | 410322孟津县 1543 | 410323新安县 1544 | 410324栾川县 1545 | 410325嵩县 1546 | 410326汝阳县 1547 | 410327宜阳县 1548 | 410328洛宁县 1549 | 410329伊川县 1550 | 410381偃师市 1551 | 410400平顶山 1552 | 410402新华区 1553 | 410403卫东区 1554 | 410404石龙区 1555 | 410411湛河区 1556 | 410421宝丰县 1557 | 410422叶县 1558 | 410423鲁山县 1559 | 410425郏县 1560 | 410481舞钢市 1561 | 410482汝州市 1562 | 410500安阳 1563 | 410502文峰区 1564 | 410503北关区 1565 | 410505殷都区 1566 | 410506龙安区 1567 | 410522安阳县 1568 | 410523汤阴县 1569 | 410526滑县 1570 | 410527内黄县 1571 | 410581林州市 1572 | 410600鹤壁 1573 | 410602鹤山区 1574 | 410603山城区 1575 | 410611淇滨区 1576 | 410621浚县 1577 | 410622淇县 1578 | 410700新乡 1579 | 410702红旗区 1580 | 410703卫滨区 1581 | 410704凤泉区 1582 | 410711牧野区 1583 | 410721新乡县 1584 | 410724获嘉县 1585 | 410725原阳县 1586 | 410726延津县 1587 | 410727封丘县 1588 | 410728长垣县 1589 | 410781卫辉市 1590 | 410782辉县市 1591 | 410800焦作 1592 | 410802解放区 1593 | 410803中站区 1594 | 410804马村区 1595 | 410811山阳区 1596 | 410821修武县 1597 | 410822博爱县 1598 | 410823武陟县 1599 | 410825温县 1600 | 410882沁阳市 1601 | 410883孟州市 1602 | 410900濮阳 1603 | 410902华龙区 1604 | 410922清丰县 1605 | 410923南乐县 1606 | 410926范县 1607 | 410927台前县 1608 | 410928濮阳县 1609 | 411000许昌市 1610 | 411002魏都区 1611 | 411023许昌县 1612 | 411024鄢陵县 1613 | 411025襄城县 1614 | 411081禹州市 1615 | 411082长葛市 1616 | 411100漯河 1617 | 411102源汇区 1618 | 411103郾城区 1619 | 411104召陵区 1620 | 411121舞阳县 1621 | 411122临颍县 1622 | 411200三门峡 1623 | 411202湖滨区 1624 | 411221渑池县 1625 | 411222陕县 1626 | 411224卢氏县 1627 | 411281义马市 1628 | 411282灵宝市 1629 | 411300南阳 1630 | 411302宛城区 1631 | 411303卧龙区 1632 | 411321南召县 1633 | 411322方城县 1634 | 411323西峡县 1635 | 411324镇平县 1636 | 411325内乡县 1637 | 411326淅川县 1638 | 411327社旗县 1639 | 411328唐河县 1640 | 411329新野县 1641 | 411330桐柏县 1642 | 411381邓州市 1643 | 411400商丘 1644 | 411402梁园区 1645 | 411403睢阳区 1646 | 411421民权县 1647 | 411422睢县 1648 | 411423宁陵县 1649 | 411424柘城县 1650 | 411425虞城县 1651 | 411426夏邑县 1652 | 411481永城市 1653 | 411500信阳 1654 | 411502浉河区 1655 | 411503平桥区 1656 | 411521罗山县 1657 | 411522光山县 1658 | 411523新县 1659 | 411524商城县 1660 | 411525固始县 1661 | 411526潢川县 1662 | 411527淮滨县 1663 | 411528息县 1664 | 411600周口 1665 | 411602川汇区 1666 | 411621扶沟县 1667 | 411622西华县 1668 | 411623商水县 1669 | 411624沈丘县 1670 | 411625郸城县 1671 | 411626淮阳县 1672 | 411627太康县 1673 | 411628鹿邑县 1674 | 411681项城市 1675 | 411700驻马店 1676 | 411702驿城区 1677 | 411721西平县 1678 | 411722上蔡县 1679 | 411723平舆县 1680 | 411724正阳县 1681 | 411725确山县 1682 | 411726泌阳县 1683 | 411727汝南县 1684 | 411728遂平县 1685 | 411729新蔡县 1686 | 419001济源 1687 | 420000湖北 1688 | 420100武汉市 1689 | 420102江岸区 1690 | 420103江汉区 1691 | 420104硚口区 1692 | 420105汉阳区 1693 | 420106武昌区 1694 | 420107青山区 1695 | 420111洪山区 1696 | 420112东西湖区 1697 | 420113汉南区 1698 | 420114蔡甸区 1699 | 420115江夏区 1700 | 420116黄陂区 1701 | 420117新洲区 1702 | 420200黄石市 1703 | 420202黄石港区 1704 | 420203西塞山区 1705 | 420204下陆区 1706 | 420205铁山区 1707 | 420222阳新县 1708 | 420281大冶市 1709 | 420300十堰市 1710 | 420302茅箭区 1711 | 420303张湾区 1712 | 420321郧县 1713 | 420322郧西县 1714 | 420323竹山县 1715 | 420324竹溪县 1716 | 420325房县 1717 | 420381丹江口市 1718 | 420500宜昌市 1719 | 420502西陵区 1720 | 420503伍家岗区 1721 | 420504点军区 1722 | 420505猇亭区 1723 | 420506夷陵区 1724 | 420525远安县 1725 | 420526兴山县 1726 | 420527秭归县 1727 | 420528长阳县 1728 | 420529五峰县 1729 | 420581宜都市 1730 | 420582当阳市 1731 | 420583枝江市 1732 | 420600襄阳市 1733 | 420602襄城区 1734 | 420606樊城区 1735 | 420607襄州区 1736 | 420624南漳县 1737 | 420625谷城县 1738 | 420626保康县 1739 | 420682老河口市 1740 | 420683枣阳市 1741 | 420684宜城市 1742 | 420700鄂州市 1743 | 420702梁子湖区 1744 | 420703华容区 1745 | 420704鄂城区 1746 | 420800荆门市 1747 | 420802东宝区 1748 | 420804掇刀区 1749 | 420821京山县 1750 | 420822沙洋县 1751 | 420881钟祥市 1752 | 420900孝感市 1753 | 420902孝南区 1754 | 420921孝昌县 1755 | 420922大悟县 1756 | 420923云梦县 1757 | 420981应城市 1758 | 420982安陆市 1759 | 420984汉川市 1760 | 421000荆州市 1761 | 421002沙市区 1762 | 421003荆州区 1763 | 421022公安县 1764 | 421023监利县 1765 | 421024江陵县 1766 | 421081石首市 1767 | 421083洪湖市 1768 | 421087松滋市 1769 | 421100黄冈市 1770 | 421102黄州区 1771 | 421121团风县 1772 | 421122红安县 1773 | 421123罗田县 1774 | 421124英山县 1775 | 421125浠水县 1776 | 421126蕲春县 1777 | 421127黄梅县 1778 | 421181麻城市 1779 | 421182武穴市 1780 | 421200咸宁市 1781 | 421202咸安区 1782 | 421221嘉鱼县 1783 | 421222通城县 1784 | 421223崇阳县 1785 | 421224通山县 1786 | 421281赤壁市 1787 | 421300随州市 1788 | 421302曾都区 1789 | 421321随县 1790 | 421381广水市 1791 | 422800恩施州 1792 | 422801恩施市 1793 | 422802利川市 1794 | 422822建始县 1795 | 422823巴东县 1796 | 422825宣恩县 1797 | 422826咸丰县 1798 | 422827来凤县 1799 | 422828鹤峰县 1800 | 429004仙桃市 1801 | 429005潜江市 1802 | 429006天门市 1803 | 429021神农架 1804 | 430000湖南 1805 | 430100长沙 1806 | 430102芙蓉区 1807 | 430103天心区 1808 | 430104岳麓区 1809 | 430105开福区 1810 | 430111雨花区 1811 | 430121长沙县 1812 | 430122望城县 1813 | 430124宁乡县 1814 | 430181浏阳市 1815 | 430200株洲 1816 | 430202荷塘区 1817 | 430203芦淞区 1818 | 430204石峰区 1819 | 430211天元区 1820 | 430221株洲县 1821 | 430223攸县 1822 | 430224茶陵县 1823 | 430225炎陵县 1824 | 430281醴陵市 1825 | 430300湘潭 1826 | 430302雨湖区 1827 | 430304岳塘区 1828 | 430321湘潭县 1829 | 430381湘乡市 1830 | 430382韶山市 1831 | 430400衡阳 1832 | 430405珠晖区 1833 | 430406雁峰区 1834 | 430407石鼓区 1835 | 430408蒸湘区 1836 | 430412南岳区 1837 | 430421衡阳县 1838 | 430422衡南县 1839 | 430423衡山县 1840 | 430424衡东县 1841 | 430426祁东县 1842 | 430481耒阳市 1843 | 430482常宁市 1844 | 430500邵阳 1845 | 430502双清区 1846 | 430503大祥区 1847 | 430511北塔区 1848 | 430521邵东县 1849 | 430522新邵县 1850 | 430523邵阳县 1851 | 430524隆回县 1852 | 430525洞口县 1853 | 430527绥宁县 1854 | 430528新宁县 1855 | 430529城步苗族自治县 1856 | 430581武冈市 1857 | 430600岳阳 1858 | 430602岳阳楼区 1859 | 430603云溪区 1860 | 430611君山区 1861 | 430621岳阳县 1862 | 430623华容县 1863 | 430624湘阴县 1864 | 430626平江县 1865 | 430681汨罗市 1866 | 430682临湘市 1867 | 430700常德 1868 | 430702武陵区 1869 | 430703鼎城区 1870 | 430722汉寿县 1871 | 430723澧县 1872 | 430724临澧县 1873 | 430725桃源县 1874 | 430726石门县 1875 | 430781津市市 1876 | 430800张家界 1877 | 430802永定区 1878 | 430811武陵源区 1879 | 430821慈利县 1880 | 430822桑植县 1881 | 430900益阳 1882 | 430902资阳区 1883 | 430903赫山区 1884 | 430921南县 1885 | 430922桃江县 1886 | 430923安化县 1887 | 430981沅江市 1888 | 431000郴州 1889 | 431002北湖区 1890 | 431003苏仙区 1891 | 431021桂阳县 1892 | 431022宜章县 1893 | 431023永兴县 1894 | 431024嘉禾县 1895 | 431025临武县 1896 | 431026汝城县 1897 | 431027桂东县 1898 | 431028安仁县 1899 | 431081资兴市 1900 | 431100永州 1901 | 431102零陵区 1902 | 431103冷水滩区 1903 | 431121祁阳县 1904 | 431122东安县 1905 | 431123双牌县 1906 | 431124道县 1907 | 431125江永县 1908 | 431126宁远县 1909 | 431127蓝山县 1910 | 431128新田县 1911 | 431129江华县 1912 | 431200怀化 1913 | 431202鹤城区 1914 | 431221中方县 1915 | 431222沅陵县 1916 | 431223辰溪县 1917 | 431224溆浦县 1918 | 431225会同县 1919 | 431226麻阳县 1920 | 431227新晃县 1921 | 431228芷江县 1922 | 431229靖州县 1923 | 431230通道县 1924 | 431281洪江市 1925 | 431300娄底 1926 | 431302娄星区 1927 | 431321双峰县 1928 | 431322新化县 1929 | 431381冷水江市 1930 | 431382涟源市 1931 | 433100湘西州 1932 | 433101吉首市 1933 | 433122泸溪县 1934 | 433123凤凰县 1935 | 433124花垣县 1936 | 433125保靖县 1937 | 433126古丈县 1938 | 433127永顺县 1939 | 433130龙山县 1940 | 440000广东 1941 | 440100广州市 1942 | 440103荔湾区 1943 | 440104越秀区 1944 | 440105海珠区 1945 | 440106天河区 1946 | 440111白云区 1947 | 440112黄埔区 1948 | 440113番禺区 1949 | 440114花都区 1950 | 440115南沙区 1951 | 440116萝岗区 1952 | 440183增城市 1953 | 440184从化市 1954 | 440200韶关市 1955 | 440203武江区 1956 | 440204浈江区 1957 | 440205曲江区 1958 | 440222始兴县 1959 | 440224仁化县 1960 | 440229翁源县 1961 | 440232乳源县 1962 | 440233新丰县 1963 | 440281乐昌市 1964 | 440282南雄市 1965 | 440300光明新区 1966 | 440300深圳市 1967 | 440303罗湖区 1968 | 440304福田区 1969 | 440305南山区 1970 | 440306宝安区 1971 | 440307龙岗区 1972 | 440308盐田区 1973 | 440400珠海市 1974 | 440402香洲区 1975 | 440403斗门区 1976 | 440404金湾区 1977 | 440500汕头市 1978 | 440507龙湖区 1979 | 440511金平区 1980 | 440512濠江区 1981 | 440513潮阳区 1982 | 440514潮南区 1983 | 440515澄海区 1984 | 440523南澳县 1985 | 440600佛山市 1986 | 440604禅城区 1987 | 440605南海区 1988 | 440606顺德区 1989 | 440607三水区 1990 | 440608高明区 1991 | 440700江门市 1992 | 440703蓬江区 1993 | 440704江海区 1994 | 440705新会区 1995 | 440781台山市 1996 | 440783开平市 1997 | 440784鹤山市 1998 | 440785恩平市 1999 | 440800湛江市 2000 | 440802赤坎区 2001 | 440803霞山区 2002 | 440804坡头区 2003 | 440811麻章区 2004 | 440823遂溪县 2005 | 440825徐闻县 2006 | 440881廉江市 2007 | 440882雷州市 2008 | 440883吴川市 2009 | 440900茂名市 2010 | 440902茂南区 2011 | 440903茂港区 2012 | 440923电白县 2013 | 440981高州市 2014 | 440982化州市 2015 | 440983信宜市 2016 | 441200肇庆市 2017 | 441202端州区 2018 | 441203鼎湖区 2019 | 441223广宁县 2020 | 441224怀集县 2021 | 441225封开县 2022 | 441226德庆县 2023 | 441283高要市 2024 | 441284四会市 2025 | 441300惠州市 2026 | 441302惠城区 2027 | 441303惠阳区 2028 | 441322博罗县 2029 | 441323惠东县 2030 | 441324龙门县 2031 | 441400梅州市 2032 | 441402梅江区 2033 | 441421梅县 2034 | 441422大埔县 2035 | 441423丰顺县 2036 | 441424五华县 2037 | 441426平远县 2038 | 441427蕉岭县 2039 | 441481兴宁市 2040 | 441500汕尾市 2041 | 441502城区 2042 | 441521海丰县 2043 | 441523陆河县 2044 | 441581陆丰市 2045 | 441600河源市 2046 | 441602源城区 2047 | 441621紫金县 2048 | 441622龙川县 2049 | 441623连平县 2050 | 441624和平县 2051 | 441625东源县 2052 | 441700阳江市 2053 | 441702江城区 2054 | 441721阳西县 2055 | 441723阳东县 2056 | 441781阳春市 2057 | 441800清远市 2058 | 441802清城区 2059 | 441821佛冈县 2060 | 441823阳山县 2061 | 441825连山县 2062 | 441826连南县 2063 | 441827清新区 2064 | 441881英德市 2065 | 441882连州市 2066 | 441900东莞市 2067 | 442000中山市 2068 | 445100潮州市 2069 | 445102湘桥区 2070 | 445121潮安县 2071 | 445122饶平县 2072 | 445200揭阳市 2073 | 445202榕城区 2074 | 445221揭东区 2075 | 445222揭西县 2076 | 445224惠来县 2077 | 445281普宁市 2078 | 445300云浮市 2079 | 445302云城区 2080 | 445321新兴县 2081 | 445322郁南县 2082 | 445323云安县 2083 | 445381罗定市 2084 | 450000广西 2085 | 450100南宁 2086 | 450102兴宁区 2087 | 450103青秀区 2088 | 450105江南区 2089 | 450107西乡塘区 2090 | 450108良庆区 2091 | 450109邕宁区 2092 | 450122武鸣县 2093 | 450123隆安县 2094 | 450124马山县 2095 | 450125上林县 2096 | 450126宾阳县 2097 | 450127横县 2098 | 450200柳州 2099 | 450202城中区 2100 | 450203鱼峰区 2101 | 450204柳南区 2102 | 450205柳北区 2103 | 450221柳江县 2104 | 450222柳城县 2105 | 450223鹿寨县 2106 | 450224融安县 2107 | 450225融水县 2108 | 450226三江县 2109 | 450300桂林 2110 | 450302秀峰区 2111 | 450303叠彩区 2112 | 450304象山区 2113 | 450305七星区 2114 | 450311雁山区 2115 | 450321阳朔县 2116 | 450322临桂区 2117 | 450323灵川县 2118 | 450324全州县 2119 | 450325兴安县 2120 | 450326永福县 2121 | 450327灌阳县 2122 | 450328龙胜县 2123 | 450329资源县 2124 | 450330平乐县 2125 | 450331荔浦县 2126 | 450332恭城县 2127 | 450400梧州 2128 | 450403万秀区 2129 | 450404龙圩区 2130 | 450405长洲区 2131 | 450421苍梧县 2132 | 450422藤县 2133 | 450423蒙山县 2134 | 450481岑溪市 2135 | 450500北海 2136 | 450502海城区 2137 | 450503银海区 2138 | 450512铁山港区 2139 | 450521合浦县 2140 | 450600防城港 2141 | 450602港口区 2142 | 450603防城区 2143 | 450621上思县 2144 | 450681东兴市 2145 | 450700钦州 2146 | 450702钦南区 2147 | 450703钦北区 2148 | 450721灵山县 2149 | 450722浦北区 2150 | 450800贵港 2151 | 450802港北区 2152 | 450803港南区 2153 | 450804覃塘区 2154 | 450821平南县 2155 | 450881桂平市 2156 | 450900玉林 2157 | 450902玉州区 2158 | 450921容县 2159 | 450922陆川县 2160 | 450923博白县 2161 | 450924兴业县 2162 | 450981北流市 2163 | 451000百色 2164 | 451002右江区 2165 | 451021田阳县 2166 | 451022田东县 2167 | 451023平果县 2168 | 451024德保县 2169 | 451025靖西县 2170 | 451026那坡县 2171 | 451027凌云县 2172 | 451028乐业县 2173 | 451029田林县 2174 | 451030西林县 2175 | 451031隆林县 2176 | 451100贺州 2177 | 451102八步区 2178 | 451121昭平县 2179 | 451122钟山县 2180 | 451123富川县 2181 | 451200河池 2182 | 451202金城江区 2183 | 451221南丹县 2184 | 451222天蛾县 2185 | 451223凤山县 2186 | 451224东兰县 2187 | 451225罗城县 2188 | 451226环江县 2189 | 451227巴马县 2190 | 451228都安县 2191 | 451229大化县 2192 | 451281宜州市 2193 | 451300来宾 2194 | 451302兴宾区 2195 | 451321忻城县 2196 | 451322象州县 2197 | 451323武宣县 2198 | 451324金秀县 2199 | 451381合山市 2200 | 451400崇左 2201 | 451402江州区 2202 | 451421扶绥县 2203 | 451422宁明县 2204 | 451423龙州县 2205 | 451424大新县 2206 | 451425天等县 2207 | 451481凭祥市 2208 | 460000海南 2209 | 460100海口市 2210 | 460105秀英区 2211 | 460106龙华区 2212 | 460107琼山区 2213 | 460108美兰区 2214 | 460200三亚市 2215 | 469001五指山市 2216 | 469002琼海市 2217 | 469003儋州市 2218 | 469005文昌市 2219 | 469006万宁市 2220 | 469007东方市 2221 | 469021定安县 2222 | 469022屯昌县 2223 | 469023澄迈县 2224 | 469024临高县 2225 | 469025白沙县 2226 | 469026昌江县 2227 | 469027乐东县 2228 | 469028陵水县 2229 | 469029保亭县 2230 | 469030琼中县 2231 | 469031西沙群岛 2232 | 469031三沙市 2233 | 469032南沙群岛 2234 | 469033中沙群岛 2235 | 471.55宿迁 2236 | 500000重庆 2237 | 500101万州区 2238 | 500102涪陵区 2239 | 500103渝中区 2240 | 500104大渡口区 2241 | 500105江北区 2242 | 500106沙坪坝区 2243 | 500107九龙坡区 2244 | 500108南岸区 2245 | 500109北碚区 2246 | 500110万盛区 2247 | 500111双桥区 2248 | 500112渝北区 2249 | 500113巴南区 2250 | 500114黔江区 2251 | 500115长寿区 2252 | 500116江津区 2253 | 500117合川区 2254 | 500118永川区 2255 | 500119南川区 2256 | 500222綦江县 2257 | 500223潼南县 2258 | 500224铜梁县 2259 | 500225大足县 2260 | 500226荣昌县 2261 | 500227璧山县 2262 | 500228梁平县 2263 | 500229城口县 2264 | 500230丰都县 2265 | 500231垫江县 2266 | 500232武隆县 2267 | 500233忠县 2268 | 500234开县 2269 | 500235云阳县 2270 | 500236奉节县 2271 | 500237巫山县 2272 | 500238巫溪县 2273 | 500240石柱县 2274 | 500241秀山县 2275 | 500242酉阳县 2276 | 500243彭水县 2277 | 510000四川 2278 | 510100成都 2279 | 510104锦江区 2280 | 510105青羊区 2281 | 510106金牛区 2282 | 510107武侯区 2283 | 510108成华区 2284 | 510112龙泉驿区 2285 | 510113青白江区 2286 | 510114新都区 2287 | 510115温江区 2288 | 510121金堂县 2289 | 510122双流县 2290 | 510124郫县 2291 | 510129大邑县 2292 | 510131蒲江县 2293 | 510132新津县 2294 | 510181都江堰市 2295 | 510182彭州市 2296 | 510183邛崃市 2297 | 510184崇州市 2298 | 510300自贡 2299 | 510302自流井区 2300 | 510303贡井区 2301 | 510304大安区 2302 | 510311沿滩区 2303 | 510321荣县 2304 | 510322富顺县 2305 | 510400攀枝花 2306 | 510402东区 2307 | 510403西区 2308 | 510411仁和区 2309 | 510421米易县 2310 | 510422盐边县 2311 | 510500泸州 2312 | 510502江阳区 2313 | 510503纳溪区 2314 | 510504龙马潭区 2315 | 510521泸县 2316 | 510522合江县 2317 | 510524叙永县 2318 | 510525古蔺县 2319 | 510600德阳 2320 | 510603旌阳区 2321 | 510623中江县 2322 | 510626罗江县 2323 | 510681广汉市 2324 | 510682什邡市 2325 | 510683绵竹市 2326 | 510700绵阳 2327 | 510703涪城区 2328 | 510704游仙区 2329 | 510722三台县 2330 | 510723盐亭县 2331 | 510724安县 2332 | 510725梓潼县 2333 | 510726北川县 2334 | 510727平武县 2335 | 510781江油市 2336 | 510800广元 2337 | 510802利州区 2338 | 510811昭化区 2339 | 510812朝天区 2340 | 510821旺苍县 2341 | 510822青川县 2342 | 510823剑阁县 2343 | 510824苍溪县 2344 | 510900遂宁 2345 | 510903船山区 2346 | 510904安居区 2347 | 510921蓬溪县 2348 | 510922射洪县 2349 | 510923大英县 2350 | 511000内江 2351 | 511002市中区 2352 | 511011东兴区 2353 | 511024威远县 2354 | 511025资中县 2355 | 511028隆昌县 2356 | 511100乐山 2357 | 511102市中区 2358 | 511111沙湾区 2359 | 511112五通桥区 2360 | 511113金口河区 2361 | 511123犍为县 2362 | 511124井研县 2363 | 511126夹江县 2364 | 511129沐川县 2365 | 511132峨边彝族自治县 2366 | 511133马边彝族自治县 2367 | 511181峨眉山市 2368 | 511300南充 2369 | 511302顺庆区 2370 | 511303高坪区 2371 | 511304嘉陵区 2372 | 511321南部县 2373 | 511322营山县 2374 | 511323蓬安县 2375 | 511324仪陇县 2376 | 511325西充县 2377 | 511381阆中市 2378 | 511400眉山 2379 | 511402东坡区 2380 | 511421仁寿县 2381 | 511422彭山县 2382 | 511423洪雅县 2383 | 511424丹棱县 2384 | 511425青神县 2385 | 511500宜宾 2386 | 511502翠屏区 2387 | 511521宜宾县 2388 | 511522南溪县 2389 | 511523江安县 2390 | 511524长宁县 2391 | 511525高县 2392 | 511526珙县 2393 | 511527筠连县 2394 | 511528兴文县 2395 | 511529屏山县 2396 | 511600广安 2397 | 511600前锋区 2398 | 511602广安区 2399 | 511621岳池县 2400 | 511622武胜县 2401 | 511623邻水县 2402 | 511681华蓥市 2403 | 511700达州 2404 | 511702通川区 2405 | 511721达县 2406 | 511722宣汉县 2407 | 511723开江县 2408 | 511724大竹县 2409 | 511725渠县 2410 | 511781万源市 2411 | 511800雅安 2412 | 511802雨城区 2413 | 511821名山区 2414 | 511822荥经县 2415 | 511823汉源县 2416 | 511824石棉县 2417 | 511825天全县 2418 | 511826芦山县 2419 | 511827宝兴县 2420 | 511900巴中 2421 | 511902巴州区 2422 | 511903恩阳区 2423 | 511921通江县 2424 | 511922南江县 2425 | 511923平昌县 2426 | 512000资阳 2427 | 512002雁江区 2428 | 512021安岳县 2429 | 512022乐至县 2430 | 512081简阳市 2431 | 513200阿坝 2432 | 513221汶川县 2433 | 513222理县 2434 | 513223茂县 2435 | 513224松潘县 2436 | 513225九寨沟 2437 | 513226金川县 2438 | 513227小金县 2439 | 513228黑水县 2440 | 513229马尔康县 2441 | 513230壤塘县 2442 | 513231阿坝县 2443 | 513232若尔盖县 2444 | 513233红原县 2445 | 513300甘孜 2446 | 513321康定县 2447 | 513322泸定县 2448 | 513323丹巴县 2449 | 513324九龙县 2450 | 513325雅江县 2451 | 513326道孚县 2452 | 513327炉霍县 2453 | 513328甘孜县 2454 | 513329新龙县 2455 | 513330德格县 2456 | 513331白玉县 2457 | 513332石渠县 2458 | 513333色达县 2459 | 513334理塘县 2460 | 513335巴塘县 2461 | 513336乡城县 2462 | 513337稻城县 2463 | 513338得荣县 2464 | 513400凉山州 2465 | 513401西昌市 2466 | 513422木里县 2467 | 513423盐源县 2468 | 513424德昌县 2469 | 513425会理县 2470 | 513426会东县 2471 | 513427宁南县 2472 | 513428普格县 2473 | 513429布拖县 2474 | 513430金阳县 2475 | 513431昭觉县 2476 | 513432喜德县 2477 | 513433冕宁县 2478 | 513434越西县 2479 | 513435甘洛县 2480 | 513436美姑县 2481 | 513437雷波县 2482 | 520000贵州 2483 | 520100贵阳 2484 | 520102南明区 2485 | 520103云岩区 2486 | 520111花溪区 2487 | 520112乌当区 2488 | 520113白云区 2489 | 520114观山湖区 2490 | 520121开阳县 2491 | 520122息烽县 2492 | 520123修文县 2493 | 520181清镇市 2494 | 520200六盘水 2495 | 520201钟山区 2496 | 520203六枝特区 2497 | 520221水城县 2498 | 520222盘县 2499 | 520300遵义 2500 | 520302红花岗区 2501 | 520303汇川区 2502 | 520321遵义县 2503 | 520322桐梓县 2504 | 520323绥阳县 2505 | 520324正安县 2506 | 520325道真县 2507 | 520326务川县 2508 | 520327凤冈县 2509 | 520328湄潭县 2510 | 520329余庆县 2511 | 520330习水县 2512 | 520381赤水市 2513 | 520382仁怀市 2514 | 520400安顺 2515 | 520402西秀区 2516 | 520421平坝县 2517 | 520422普定县 2518 | 520423镇宁县 2519 | 520424关岭县 2520 | 520425紫云县 2521 | 522200铜仁地区 2522 | 522201铜仁市 2523 | 522222江口县 2524 | 522223玉屏县 2525 | 522224石阡县 2526 | 522225思南县 2527 | 522226印江县 2528 | 522227德江县 2529 | 522228沿河土家族自治县 2530 | 522229松桃苗族自治县 2531 | 522230万山特区 2532 | 522300黔西南州 2533 | 522301兴义市 2534 | 522322兴仁县 2535 | 522323普安县 2536 | 522324晴隆县 2537 | 522325贞丰县 2538 | 522326望谟县 2539 | 522327册亨县 2540 | 522328安龙县 2541 | 522400毕节市 2542 | 522401七星关区 2543 | 522422大方县 2544 | 522423黔西县 2545 | 522424金沙县 2546 | 522425织金县 2547 | 522426纳雍县 2548 | 522427威宁县 2549 | 522428赫章县 2550 | 522600黔东南州 2551 | 522601凯里市 2552 | 522622黄平县 2553 | 522623施秉县 2554 | 522624三穗县 2555 | 522626岑巩县 2556 | 522627天柱县 2557 | 522628锦屏县 2558 | 522629剑河县 2559 | 522630台江县 2560 | 522631黎平县 2561 | 522632榕江县 2562 | 522633从江县 2563 | 522634雷山县 2564 | 522635麻江县 2565 | 522636丹寨县 2566 | 522700黔南州 2567 | 522701都匀市 2568 | 522702福泉市 2569 | 522722荔波县 2570 | 522723贵定县 2571 | 522725瓮安县 2572 | 522726独山县 2573 | 522727平塘县 2574 | 522728罗甸县 2575 | 522729长顺县 2576 | 522730龙里县 2577 | 522731惠水县 2578 | 522732三都水族自治县 2579 | 530000云南 2580 | 530100昆明 2581 | 530102五华区 2582 | 530103盘龙区 2583 | 530111官渡区 2584 | 530112西山区 2585 | 530113东川区 2586 | 530121呈贡区 2587 | 530122晋宁县 2588 | 530124富民县 2589 | 530125宜良县 2590 | 530126石林彝族自治县 2591 | 530127嵩明县 2592 | 530128禄劝县 2593 | 530129寻甸县 2594 | 530181安宁市 2595 | 530300曲靖 2596 | 530302麒麟区 2597 | 530321马龙县 2598 | 530322陆良县 2599 | 530323师宗县 2600 | 530324罗平县 2601 | 530325富源县 2602 | 530326会泽县 2603 | 530328沾益县 2604 | 530381宣威市 2605 | 530400玉溪 2606 | 530402红塔区 2607 | 530421江川县 2608 | 530422澄江县 2609 | 530423通海县 2610 | 530424华宁县 2611 | 530425易门县 2612 | 530426峨山县 2613 | 530427新平县 2614 | 530428元江县 2615 | 530500保山 2616 | 530502隆阳区 2617 | 530521施甸县 2618 | 530522腾冲县 2619 | 530523龙陵县 2620 | 530524昌宁县 2621 | 530600昭通 2622 | 530602昭阳区 2623 | 530621鲁甸县 2624 | 530622巧家县 2625 | 530623盐津县 2626 | 530624大关县 2627 | 530625永善县 2628 | 530626绥江县 2629 | 530628彝良县 2630 | 530629威信县 2631 | 530630水富县 2632 | 530700丽江 2633 | 530702古城区 2634 | 530721玉龙县 2635 | 530722永胜县 2636 | 530723华坪县 2637 | 530724宁蒗县 2638 | 530800普洱 2639 | 530802思茅区 2640 | 530821宁洱县 2641 | 530822墨江县 2642 | 530823景东县 2643 | 530824景谷县 2644 | 530825镇沅县 2645 | 530826江城县 2646 | 530827孟连县 2647 | 530828澜沧县 2648 | 530829西盟县 2649 | 530900临沧 2650 | 530902临翔区 2651 | 530921凤庆县 2652 | 530922云县 2653 | 530923永德县 2654 | 530924镇康县 2655 | 530925双江县 2656 | 530926耿马县 2657 | 530927沧源县 2658 | 532300楚雄州 2659 | 532301楚雄市 2660 | 532322双柏县 2661 | 532323牟定县 2662 | 532324南华县 2663 | 532325姚安县 2664 | 532326大姚县 2665 | 532327永仁县 2666 | 532328元谋县 2667 | 532329武定县 2668 | 532331禄丰县 2669 | 532500红河州 2670 | 532501个旧市 2671 | 532502开远市 2672 | 532503蒙自市 2673 | 532523屏边县 2674 | 532524建水县 2675 | 532525石屏县 2676 | 532526弥勒市 2677 | 532527泸西县 2678 | 532528元阳县 2679 | 532529红河县 2680 | 532530金平县 2681 | 532531绿春县 2682 | 532532河口县 2683 | 532600文山州 2684 | 532621文山县 2685 | 532622砚山县 2686 | 532623西畴县 2687 | 532624麻栗坡县 2688 | 532625马关县 2689 | 532626丘北县 2690 | 532627广南县 2691 | 532628富宁县 2692 | 532800西双版纳州 2693 | 532801景洪市 2694 | 532822勐海县 2695 | 532823勐腊县 2696 | 532900大理州 2697 | 532901大理市 2698 | 532922漾濞县 2699 | 532923祥云县 2700 | 532924宾川县 2701 | 532925弥渡县 2702 | 532926南涧县 2703 | 532927巍山县 2704 | 532928永平县 2705 | 532929云龙县 2706 | 532930洱源县 2707 | 532931剑川县 2708 | 532932鹤庆县 2709 | 533100德宏州 2710 | 533102瑞丽市 2711 | 533103芒市 2712 | 533122梁河县 2713 | 533123盈江县 2714 | 533124陇川县 2715 | 533300怒江州 2716 | 533321泸水县 2717 | 533323福贡县 2718 | 533324贡山县 2719 | 533325兰坪县 2720 | 533400迪庆州 2721 | 533421香格里拉县 2722 | 533422德钦县 2723 | 533423维西傈僳族自治县 2724 | 540000西藏 2725 | 540100拉萨 2726 | 540102城关区 2727 | 540121林周县 2728 | 540122当雄县 2729 | 540123尼木县 2730 | 540124曲水县 2731 | 540125堆龙德庆县 2732 | 540126达孜县 2733 | 540127墨竹工卡县 2734 | 542100昌都 2735 | 542121昌都县 2736 | 542122江达县 2737 | 542123贡觉县 2738 | 542124类乌齐县 2739 | 542125丁青县 2740 | 542126察雅县 2741 | 542127八宿县 2742 | 542128左贡县 2743 | 542129芒康县 2744 | 542132洛隆县 2745 | 542133边坝县 2746 | 542200山南 2747 | 542221乃东县 2748 | 542222扎囊县 2749 | 542223贡嘎县 2750 | 542224桑日县 2751 | 542225琼结县 2752 | 542226曲松县 2753 | 542227措美县 2754 | 542228洛扎县 2755 | 542229加查县 2756 | 542231隆子县 2757 | 542232错那县 2758 | 542233浪卡子县 2759 | 542300日喀则 2760 | 542301日喀则市 2761 | 542322南木林县 2762 | 542323江孜县 2763 | 542324定日县 2764 | 542325萨迦县 2765 | 542326拉孜县 2766 | 542327昂仁县 2767 | 542328谢通门县 2768 | 542329白朗县 2769 | 542330仁布县 2770 | 542331康马县 2771 | 542332定结县 2772 | 542333仲巴县 2773 | 542334亚东县 2774 | 542335吉隆县 2775 | 542336聂拉木县 2776 | 542337萨嘎县 2777 | 542338岗巴县 2778 | 542400那曲 2779 | 542421那曲县 2780 | 542422嘉黎县 2781 | 542423比如县 2782 | 542424聂荣县 2783 | 542425安多县 2784 | 542426申扎县 2785 | 542427索县 2786 | 542428班戈县 2787 | 542429巴青县 2788 | 542430尼玛县 2789 | 542500阿里 2790 | 542521普兰县 2791 | 542522札达县 2792 | 542523噶尔县 2793 | 542524日土县 2794 | 542525革吉县 2795 | 542526改则县 2796 | 542527措勤县 2797 | 542600林芝 2798 | 542621林芝县 2799 | 542622工布江达县 2800 | 542623米林县 2801 | 542624墨脱县 2802 | 542625波密县 2803 | 542626察隅县 2804 | 542627朗县 2805 | 610000陕西 2806 | 610100西安市 2807 | 610102新城区 2808 | 610103碑林区 2809 | 610104莲湖区 2810 | 610111灞桥区 2811 | 610112未央区 2812 | 610113雁塔区 2813 | 610114阎良区 2814 | 610115临潼区 2815 | 610116长安区 2816 | 610122蓝田县 2817 | 610124周至县 2818 | 610125户县 2819 | 610126高陵县 2820 | 610200铜川市 2821 | 610202王益区 2822 | 610203印台区 2823 | 610204耀州区 2824 | 610222宜君县 2825 | 610300宝鸡市 2826 | 610302渭滨区 2827 | 610303金台区 2828 | 610304陈仓区 2829 | 610322凤翔县 2830 | 610323岐山县 2831 | 610324扶风县 2832 | 610326眉县 2833 | 610327陇县 2834 | 610328千阳县 2835 | 610329麟游县 2836 | 610330凤县 2837 | 610331太白县 2838 | 610400咸阳市 2839 | 610402秦都区 2840 | 610403杨凌区 2841 | 610404渭城区 2842 | 610422三原县 2843 | 610423泾阳县 2844 | 610424乾县 2845 | 610425礼泉县 2846 | 610426永寿县 2847 | 610427彬县 2848 | 610428长武县 2849 | 610429旬邑县 2850 | 610430淳化县 2851 | 610431武功县 2852 | 610481兴平市 2853 | 610500渭南市 2854 | 610502临渭区 2855 | 610521华县 2856 | 610522潼关县 2857 | 610523大荔县 2858 | 610524合阳县 2859 | 610525澄城县 2860 | 610526蒲城县 2861 | 610527白水县 2862 | 610528富平县 2863 | 610581韩城市 2864 | 610582华阴市 2865 | 610600延安市 2866 | 610602宝塔区 2867 | 610621延长县 2868 | 610622延川县 2869 | 610623子长县 2870 | 610624安塞县 2871 | 610625志丹县 2872 | 610626吴起县 2873 | 610627甘泉县 2874 | 610628富县 2875 | 610629洛川县 2876 | 610630宜川县 2877 | 610631黄龙县 2878 | 610632黄陵县 2879 | 610700汉中市 2880 | 610702汉台区 2881 | 610721南郑县 2882 | 610722城固县 2883 | 610723洋县 2884 | 610724西乡县 2885 | 610725勉县 2886 | 610726宁强县 2887 | 610727略阳县 2888 | 610728镇巴县 2889 | 610729留坝县 2890 | 610730佛坪县 2891 | 610800榆林市 2892 | 610802榆阳区 2893 | 610821神木县 2894 | 610822府谷县 2895 | 610823横山县 2896 | 610824靖边县 2897 | 610825定边县 2898 | 610826绥德县 2899 | 610827米脂县 2900 | 610828佳县 2901 | 610829吴堡县 2902 | 610830清涧县 2903 | 610831子洲县 2904 | 610900安康市 2905 | 610902汉滨区 2906 | 610921汉阴县 2907 | 610922石泉县 2908 | 610923宁陕县 2909 | 610924紫阳县 2910 | 610925岚皋县 2911 | 610926平利县 2912 | 610927镇坪县 2913 | 610928旬阳县 2914 | 610929白河县 2915 | 611000商洛市 2916 | 611002商州区 2917 | 611021洛南县 2918 | 611022丹凤县 2919 | 611023商南县 2920 | 611024山阳县 2921 | 611026柞水县 2922 | 620000甘肃省 2923 | 620100兰州 2924 | 620102城关区 2925 | 620103七里河区 2926 | 620104西固区 2927 | 620105安宁区 2928 | 620111红古区 2929 | 620121永登县 2930 | 620122皋兰县 2931 | 620123榆中县 2932 | 620200嘉峪关 2933 | 620300金昌 2934 | 620302金川区 2935 | 620321永昌县 2936 | 620400白银 2937 | 620402白银区 2938 | 620403平川区 2939 | 620421靖远县 2940 | 620422会宁县 2941 | 620423景泰县 2942 | 620500天水 2943 | 620502秦州区 2944 | 620503麦积区 2945 | 620521清水县 2946 | 620522秦安县 2947 | 620523甘谷县 2948 | 620524武山县 2949 | 620525张家川回族自治县 2950 | 620600武威 2951 | 620602凉州区 2952 | 620621民勤县 2953 | 620622古浪县 2954 | 620623天祝藏族自治县 2955 | 620700张掖 2956 | 620702甘州区 2957 | 620721肃南裕固族自治县 2958 | 620722民乐县 2959 | 620723临泽县 2960 | 620724高台县 2961 | 620725山丹县 2962 | 620800平凉 2963 | 620802崆峒区 2964 | 620821泾川县 2965 | 620822灵台县 2966 | 620823崇信县 2967 | 620824华亭县 2968 | 620825庄浪县 2969 | 620826静宁县 2970 | 620900酒泉 2971 | 620902肃州区 2972 | 620921金塔县 2973 | 620922瓜州县 2974 | 620923肃北蒙古族自治县 2975 | 620924阿克塞县 2976 | 620981玉门市 2977 | 620982敦煌市 2978 | 621000庆阳 2979 | 621002西峰区 2980 | 621021庆城县 2981 | 621022环县 2982 | 621023华池县 2983 | 621024合水县 2984 | 621025正宁县 2985 | 621026宁县 2986 | 621027镇原县 2987 | 621100定西 2988 | 621102安定区 2989 | 621121通渭县 2990 | 621122陇西县 2991 | 621123渭源县 2992 | 621124临洮县 2993 | 621125漳县 2994 | 621126岷县 2995 | 621200陇南 2996 | 621202武都区 2997 | 621221成县 2998 | 621222文县 2999 | 621223宕昌县 3000 | 621224康县 3001 | 621225西和县 3002 | 621226礼县 3003 | 621227徽县 3004 | 621228两当县 3005 | 622900临夏州 3006 | 622901临夏市 3007 | 622921临夏县 3008 | 622922康乐县 3009 | 622923永靖县 3010 | 622924广河县 3011 | 622925和政县 3012 | 622926东乡族自治县 3013 | 622927积石山县 3014 | 623000甘南州 3015 | 623001合作市 3016 | 623021临潭县 3017 | 623022卓尼县 3018 | 623023舟曲县 3019 | 623024迭部县 3020 | 623025玛曲县 3021 | 623026碌曲县 3022 | 623027夏河县 3023 | 630000青海 3024 | 630100西宁 3025 | 630102城东区 3026 | 630103城中区 3027 | 630104城西区 3028 | 630105城北区 3029 | 630121大通县 3030 | 630122湟中县 3031 | 630123湟源县 3032 | 632100海东 3033 | 632121平安县 3034 | 632122民和县 3035 | 632123乐都县 3036 | 632126互助土族自治县 3037 | 632127化隆回族自治县 3038 | 632128循化撒拉族自治县 3039 | 632200海北 3040 | 632221门源回族自治县 3041 | 632222祁连县 3042 | 632223海晏县 3043 | 632224刚察县 3044 | 632300黄南 3045 | 632321同仁县 3046 | 632322尖扎县 3047 | 632323泽库县 3048 | 632324河南蒙古族自治县 3049 | 632500海南 3050 | 632521共和县 3051 | 632522同德县 3052 | 632523贵德县 3053 | 632524兴海县 3054 | 632525贵南县 3055 | 632600果洛 3056 | 632621玛沁县 3057 | 632622班玛县 3058 | 632623甘德县 3059 | 632624达日县 3060 | 632625久治县 3061 | 632626玛多县 3062 | 632700玉树 3063 | 632721玉树县 3064 | 632722杂多县 3065 | 632723称多县 3066 | 632724治多县 3067 | 632725囊谦县 3068 | 632726曲麻莱县 3069 | 632800海西州 3070 | 632801格尔木市 3071 | 632802德令哈市 3072 | 632821乌兰县 3073 | 632822都兰县 3074 | 632823天峻县 3075 | 640000宁夏 3076 | 640100银川市 3077 | 640104兴庆区 3078 | 640105西夏区 3079 | 640106金凤区 3080 | 640121永宁县 3081 | 640122贺兰县 3082 | 640181灵武市 3083 | 640200石嘴山市 3084 | 640202大武口区 3085 | 640205惠农区 3086 | 640221平罗县 3087 | 640300吴忠市 3088 | 640302利通区 3089 | 640303红寺堡区 3090 | 640323盐池县 3091 | 640324同心县 3092 | 640381青铜峡市 3093 | 640400固原市 3094 | 640402原州区 3095 | 640422西吉县 3096 | 640423隆德县 3097 | 640424泾源县 3098 | 640425彭阳县 3099 | 640500中卫市 3100 | 640502沙坡头区 3101 | 640521中宁县 3102 | 640522海原县 3103 | 650000新疆 3104 | 650100乌鲁木齐市 3105 | 650102天山区 3106 | 650103沙依巴克区 3107 | 650104新市区 3108 | 650105水磨沟区 3109 | 650106头屯河区 3110 | 650107达坂城区 3111 | 650109米东区 3112 | 650121乌鲁木齐县 3113 | 650200克拉玛依市 3114 | 650202独山子区 3115 | 650203克拉玛依区 3116 | 650204白碱滩区 3117 | 650205乌尔禾区 3118 | 652100吐鲁番地区 3119 | 652101吐鲁番市 3120 | 652122鄯善县 3121 | 652123托克逊县 3122 | 652200哈密地区 3123 | 652201哈密市 3124 | 652222巴里坤县 3125 | 652223伊吾县 3126 | 652300昌吉州 3127 | 652700博尔塔拉州 3128 | 652800巴音郭楞州 3129 | 652900阿克苏地区 3130 | 653000克孜勒苏州 3131 | 653100喀什地区 3132 | 653125莎车县 3133 | 653200和田地区 3134 | 653226于田县 3135 | 654000伊犁州 3136 | 654200塔城地区 3137 | 654202乌苏市 3138 | 654300阿勒泰地区 3139 | 659001石河子市 3140 | 659002阿拉尔市 3141 | 659003图木舒克市 3142 | 659004五家渠市 3143 | 710000新北市 3144 | 710000台湾 3145 | 710001台南县 3146 | 710001台中市 3147 | 710001高雄市 3148 | 710001南投县 3149 | 710001嘉义县 3150 | 710001台北市 3151 | 810000荃湾区 3152 | 810000屯门区 3153 | 810000元朗区 3154 | 810000北区 3155 | 810000大埔区 3156 | 810000西贡区 3157 | 810000葵青区 3158 | 810000东区 3159 | 810000离岛区 3160 | 810000沙田区 3161 | 810000观塘区 3162 | 810000黄大仙区 3163 | 810000九龙城区 3164 | 810000深水埗区 3165 | 810000南区 3166 | 810000湾仔区 3167 | 810000中西区 3168 | 810000香港 3169 | 810000油尖旺区 3170 | 820000澳门 3171 | -------------------------------------------------------------------------------- /Scripts/LogInput&Output/py2.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | class outPip(object): 4 | def __init__(self, fileDir): 5 | self.fileDir = fileDir 6 | self.console = sys.stdout 7 | def write(self, s): 8 | self.console.write(s) 9 | with open(self.fileDir, 'ab') as f: f.write(s) 10 | 11 | new_input = input 12 | def inPip(fileDir): 13 | def _input(hint): 14 | s = new_input(hint) 15 | with open(fileDir, 'ab') as f: f.write(s) 16 | return s 17 | return _input 18 | 19 | sys.stdout = outPip('out.log') 20 | input = inPip('out.log') 21 | 22 | print 'This will appear on your console and your file.' 23 | print 'So is this line.' 24 | input('yo') 25 | -------------------------------------------------------------------------------- /Scripts/LogInput&Output/py3.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | class outPip(object): 4 | def __init__(self, fileDir): 5 | self.fileDir = fileDir 6 | self.console = sys.stdout 7 | def write(self, s): 8 | self.console.write(s) 9 | with open(self.fileDir, 'a') as f: f.write(s) 10 | def flush(self): 11 | self.console.flush() 12 | 13 | new_input = input 14 | def inPip(fileDir): 15 | def _input(hint): 16 | s = new_input(hint) 17 | with open(fileDir, 'a') as f: f.write(s) 18 | return s 19 | return _input 20 | 21 | sys.stdout = outPip('out.log') 22 | input = inPip('out.log') 23 | 24 | print('This will appear on your console and your file.') 25 | print('So is this line.') 26 | input('yo') 27 | -------------------------------------------------------------------------------- /Scripts/SMSBomb.py: -------------------------------------------------------------------------------- 1 | import time, requests 2 | phone = 'Your Phone Number' 3 | count = 0 4 | 5 | while True: 6 | r = requests.get('http://estock.xyzq.com.cn/validation/mobile?mobile=%s&_=1451390067874'%phone) 7 | count += 1 8 | print count 9 | -------------------------------------------------------------------------------- /Scripts/SendToMyself.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import os, sys, platform 3 | import requests, time, re, subprocess 4 | import json, xml.dom.minidom 5 | 6 | BASE_URL = 'https://login.weixin.qq.com' 7 | OS = platform.system() 8 | INTERACT_URL = None 9 | 10 | session = requests.Session() 11 | uuid = None 12 | baseRequest = {} 13 | 14 | def get_QRuuid(): 15 | url = '%s/jslogin'%BASE_URL 16 | params = { 17 | 'appid': 'wx782c26e4c19acffb', 18 | 'fun': 'new', 19 | } 20 | r = session.get(url, params = params) 21 | 22 | regx = r'window.QRLogin.code = (\d+); window.QRLogin.uuid = "(\S+?)";' 23 | data = re.search(regx, r.text) 24 | if data and data.group(1) == '200': return data.group(2) 25 | 26 | def get_QR(): 27 | url = '%s/qrcode/%s'%(BASE_URL, uuid) 28 | r = session.get(url, stream = True) 29 | with open('QR.jpg', 'wb') as f: f.write(r.content) 30 | if OS == 'Darwin': 31 | subprocess.call(['open', 'QR.jpg']) 32 | elif OS == 'Linux': 33 | subprocess.call(['xdg-open', 'QR.jpg']) 34 | else: 35 | os.startfile('QR.jpg') 36 | 37 | def check_login(uuid): 38 | url = '%s/cgi-bin/mmwebwx-bin/login'%BASE_URL 39 | payloads = 'tip=1&uuid=%s&_=%s'%(uuid, int(time.time())) 40 | r = session.get(url, params = payloads) 41 | 42 | regx = r'window.code=(\d+)' 43 | data = re.search(regx, r.text) 44 | if not data: return False 45 | 46 | def one_line_print(msg): 47 | sys.stdout.write('%s\r'%msg) 48 | sys.stdout.flush() 49 | if data.group(1) == '200': 50 | regx = r'window.redirect_uri="(\S+)";' 51 | global INTERACT_URL 52 | INTERACT_URL = re.search(regx, r.text).group(1) 53 | r = session.get(INTERACT_URL, allow_redirects=False) 54 | INTERACT_URL = INTERACT_URL[:INTERACT_URL.rfind('/')] 55 | get_login_info(r.text) 56 | return True 57 | elif data.group(1) == '201': 58 | one_line_print('Please press confirm') 59 | elif data.group(1) == '408': 60 | one_line_print('Please reload QR Code') 61 | return False 62 | 63 | def get_login_info(s): 64 | global baseRequest 65 | for node in xml.dom.minidom.parseString(s).documentElement.childNodes: 66 | if node.nodeName == 'skey': 67 | baseRequest['Skey'] = node.childNodes[0].data.encode('utf8') 68 | elif node.nodeName == 'wxsid': 69 | baseRequest['Sid'] = node.childNodes[0].data.encode('utf8') 70 | elif node.nodeName == 'wxuin': 71 | baseRequest['Uin'] = node.childNodes[0].data.encode('utf8') 72 | elif node.nodeName == 'pass_ticket': 73 | baseRequest['DeviceID'] = node.childNodes[0].data.encode('utf8') 74 | 75 | def web_init(): 76 | url = '%s/webwxinit?r=%s' % (INTERACT_URL, int(time.time())) 77 | payloads = { 78 | 'BaseRequest': baseRequest, 79 | } 80 | headers = { 'ContentType': 'application/json; charset=UTF-8' } 81 | r = session.post(url, data = json.dumps(payloads), headers = headers) 82 | dic = json.loads(r.content.decode('utf-8', 'replace')) 83 | return dic['User']['UserName'] 84 | 85 | def send_msg(toUserName = None, msg = 'Test Message'): 86 | url = '%s/webwxsendmsg'%INTERACT_URL 87 | payloads = { 88 | 'BaseRequest': baseRequest, 89 | 'Msg': { 90 | 'Type': 1, 91 | 'Content': msg.encode('utf8') if isinstance(msg, unicode) else msg, 92 | 'FromUserName': myUserName.encode('utf8'), 93 | 'ToUserName': (toUserName if toUserName else myUserName).encode('utf8'), 94 | 'LocalID': int(time.time()), 95 | 'ClientMsgId': int(time.time()), 96 | }, 97 | } 98 | headers = { 'ContentType': 'application/json; charset=UTF-8' } 99 | session.post(url, data = json.dumps(payloads, ensure_ascii = False), headers = headers) 100 | 101 | if __name__ == '__main__': 102 | while uuid is None: uuid = get_QRuuid() 103 | get_QR() 104 | print 'QR is shown' 105 | while not check_login(uuid): pass 106 | myUserName = web_init() 107 | print 'Login successfully you can send messages now, input q to exit' 108 | msg = None 109 | while msg != 'q': 110 | if msg: send_msg(myUserName, msg) 111 | msg = raw_input('>').decode(sys.stdin.encoding) 112 | print 'Have fun:)' 113 | -------------------------------------------------------------------------------- /Scripts/TimeCalculate.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | def TimeCalculate(fn, *args, **kwargs): 4 | def wrapped(*args, **kwargs): 5 | beginTime = time.time() 6 | result = fn(*args, **kwargs) 7 | return (time.time() - beginTime, result) 8 | return wrapped 9 | 10 | if __name__ == '__main__': 11 | @TimeCalculate 12 | def fn(): 13 | for i in range(int(1e7)): 14 | pass 15 | print fn() 16 | 17 | -------------------------------------------------------------------------------- /Scripts/TranslateClient.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | proxies = { 4 | "http": "http://127.0.0.1:1080", 5 | "https": "https://127.0.0.1:1080", } 6 | headers = { 7 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0', } 8 | url = 'http://translate.google.cn/translate_a/t' 9 | 10 | class TranslateClient(object): 11 | def __init__(self): 12 | self.params = { 13 | 'client': 'p', 14 | 'ie': 'UTF-8', 15 | 'oe': 'UTF-8', 16 | 'tl': None, 17 | 'sl': None, 18 | 'text': None, } 19 | def get(self, text, tl = 'zh-CN', sl = 'auto'): 20 | self.params['text'] = text 21 | self.params['tl'] = tl 22 | self.params['sl'] = sl 23 | return requests.post(url, self.params, headers = headers, proxies = proxies).json()[0] 24 | 25 | if __name__ == '__main__': 26 | tc = TranslateClient() 27 | print(tc.get('test')) 28 | -------------------------------------------------------------------------------- /Scripts/WechatArticlePicDownloader.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import requests, re, os, thread, time 3 | from Tkinter import Tk, Button, Entry 4 | import tkMessageBox 5 | 6 | TASK_STORAGE = [] 7 | 8 | def download_pic_from_url(url, picDir): 9 | content = requests.get(url).content 10 | try: 11 | postfix = re.compile('wx_fmt=([a-z]+)').search(url).groups()[0] 12 | except: 13 | postfix = 'jpg' 14 | with open((picDir+'.'+postfix).encode('cp936'), 'wb') as f: f.write(content) 15 | 16 | def get_pic_url_from_url(url): 17 | html = requests.get(url).content 18 | return re.compile('').findall(html) 19 | 20 | def get_title_cover_from_url(url): 21 | content = requests.get(url).content 22 | regexDict = { 23 | 'title': 'var msg_title = "(.*?)";', 24 | 'pic_url': 'var msg_cdn_url = "(.*?)";', } 25 | try: 26 | for k, r in regexDict.items(): 27 | regexDict[k] = re.compile(r).search(content).groups()[0] 28 | except: 29 | return '', '' 30 | return regexDict['title'].decode('utf8'), regexDict['pic_url'] 31 | 32 | def button_clicked(): 33 | url = inputEntry.get().strip() 34 | if not 'http' in url: 35 | tkMessageBox.showinfo('Warning', u'把http或者https也加进去吧') 36 | return 37 | try: 38 | title, picUrl = get_title_cover_from_url(url) 39 | except: 40 | tkMessageBox.showinfo('Warning', u'网址读取错误,请尝试使用浏览器读取网址判断是否可以打开') 41 | return 42 | if not title: 43 | tkMessageBox.showinfo('Warning', u'检测到非微信文章页面') 44 | return 45 | thread.start_new_thread(download, (url, title, picUrl)) 46 | tkMessageBox.showinfo('Info', u'已经成功加入队列') 47 | 48 | def download(url, title, picUrl): 49 | for sk in (r'\/:*?"<>|'): title = title.replace(sk, '') 50 | title = title.replace(' ', ' ') 51 | if not os.path.exists(title.encode('cp936')): os.mkdir(title.encode('cp936')) 52 | download_pic_from_url(picUrl, os.path.join(title, u'标题图')) 53 | for i, picUrl in enumerate(get_pic_url_from_url(url), 1): 54 | download_pic_from_url(picUrl, os.path.join(title, str(i))) 55 | TASK_STORAGE.append(title) 56 | 57 | mainWindow = Tk() 58 | button = Button(mainWindow, cnf = {'command': button_clicked, 'text': 'Download', 'justify': 'right', }) 59 | inputEntry = Entry(mainWindow, width=70) 60 | inputEntry.pack() 61 | button.pack() 62 | mainWindow.title(u'微信图片下载器') 63 | while 1: 64 | mainWindow.update_idletasks() 65 | mainWindow.update() 66 | try: 67 | tkMessageBox.showinfo('Info', u'读取成功,请打开"%s"文件夹查看'%TASK_STORAGE.pop()) 68 | except: 69 | pass 70 | -------------------------------------------------------------------------------- /Scripts/ascii.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import thread, time, sys, os, platform 3 | 4 | try: 5 | import termios, tty 6 | termios.tcgetattr, termios.tcsetattr 7 | import threading 8 | OS = 'Linux' 9 | except (ImportError, AttributeError): 10 | try: 11 | import msvcrt 12 | OS = 'Windows' 13 | except ImportError: 14 | raise Exception('Mac is currently not supported') 15 | OS = 'Mac' 16 | else: 17 | getch = msvcrt.getch 18 | else: 19 | def fn(): 20 | try: 21 | fd = sys.stdin.fileno() 22 | old_settings = termios.tcgetattr(fd) 23 | tty.setraw(fd) 24 | ch = sys.stdin.read(1) 25 | except: 26 | termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) 27 | raise Exception 28 | termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) 29 | return ch 30 | getch = fn 31 | 32 | print 'Press any key and I will return ascii (^C to exit)' 33 | c = getch() 34 | while c != chr(3): 35 | print 'The ascii of you key: %s'%ord(c) 36 | c = getch() 37 | -------------------------------------------------------------------------------- /Scripts/baidusearch.py: -------------------------------------------------------------------------------- 1 | #coding=utf8 2 | import requests, json, re 3 | 4 | url = 'https://www.baidu.com/s' 5 | headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36'} 6 | r = re.compile(']*?href[^>]*?"(.*?)"[^>]*?>(.*?)') 7 | 8 | def baidu_search(keyword): 9 | params = {'wd': keyword, 'pn': 0, 'ie': 'utf-8'} 10 | try: 11 | while 1: 12 | for i in r.findall(requests.get(url, params, headers = headers).content) 13 | yield (re.compile('<.*?>').sub('', i[1]).decode('utf8'), i[0]) 14 | params['pn'] += 10 15 | except GeneratorExit: 16 | pass 17 | except: 18 | while 1: yield ('', '') 19 | 20 | for i, result in enumerate(baidu_search(u'知乎')): 21 | if 30 < i: break 22 | print('%s: %s'%result) 23 | -------------------------------------------------------------------------------- /Scripts/qtimageconvert.py: -------------------------------------------------------------------------------- 1 | import os 2 | from PyQt4.QtGui import QImage 3 | 4 | for file in os.walk('.').next()[2]: 5 | if not file.endswith('.png'): continue 6 | i = QImage() 7 | i.load(file) 8 | i.save(file) 9 | print('%s is successfully converted' % file) 10 | --------------------------------------------------------------------------------