This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "http://www.youmaker.com/video/svb5-85bb633c694b402ca21ef7e2cdf49966055.html.%E8%95%AD%E7%85%8C%E5%A5%87-45-%E6%80%9D%E5%BF%B5%E6%9C%83%E9%A9%9A.html" | |
| {'1033': '0.21464726', '3': '0.36757067', '1021': '0.20658995', '979': '1.0', '35': '0.21119212'} | |
| {'1033': '0.22178929', '3': '0.34067592', '1021': '0.21893217', '979': '1.0', '35': '0.21860263'} | |
| "http://www.gj1904.com/a.asp" | |
| {'24': '0.2983656', '8': '0.403966', '447': '1.0', '239': '0.29766843', '105': '0.75'} | |
| {'3': '1.0', '447': '1.0', '926': '0.5', '105': '0.75'} | |
| "http://recipe.ytower.com.tw/Channel/MultiSearchRecipes" | |
| {'909': '0.1554877', '122': '1.0', '912': '0.18566176', '1512': '0.24693201'} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding=utf-8 | |
| # This is a CJK language supported Searchable Model based on Google's implementation. | |
| # Hen-Hsen Huang, 2011 | |
| # Tagtoo | |
| import re | |
| import string | |
| import sys | |
| from google.appengine.api import datastore | |
| from google.appengine.api import datastore_errors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| patterns = { | |
| 0 :[ | |
| # Common Pattern | |
| # click ad behavior | |
| (r'utm_source', r'ad'), | |
| (r'utm_source=([\w]+)', r'ad:\1'), | |
| ], | |
| 28: [ | |
| # Mayuki Pattern | |
| (r'mayuki', r'visit'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- encoding=utf8 -*- | |
| import urllib | |
| import urllib2 | |
| import re | |
| html = """ | |
| ... <option value="台北市">台北市</option> | |
| ... <option value="新北市">新北市</option> | |
| ... <option value="基隆市">基隆市</option> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BigDataApi = RestEndpoint('BigDataApi', (_BigDataApi,), [Reducer]) | |
| BigDataApi = type( | |
| 'BigDataApi', | |
| (BigDataApi, ), | |
| { | |
| 'ReducerList': Reducer.method( | |
| request_fields=('id',), | |
| path='reducer/{id}', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # api_exceptions.py | |
| class BadRequestException(ServiceException): | |
| """Bad request exception that is mapped to a 400 response.""" | |
| http_status = httplib.BAD_REQUEST | |
| class ForbiddenException(ServiceException): | |
| """Forbidden exception that is mapped to a 403 response.""" | |
| http_status = httplib.FORBIDDEN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| This field is indeed a little nasty, for parsing it check the documentation from the protobuf: | |
| // The first 3 bytes of the IP address in network byte order for IPv4, or the | |
| // first 6 bytes for IPv6. Note that the number and position of the bytes | |
| // included from IPv6 addresses may change later. | |
| This means you must first check if the size is 3 or 6 bytes, then depending on the size you can get the raw bytes and create the partial IP of the correct type. The last octet is not provided because Ad Exchange removes this information for privacy reasons. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // old table | |
| CREATE TABLE `user_account_old` ( | |
| `user` varchar(255) DEFAULT NULL, | |
| `account` varchar(255) DEFAULT NULL, | |
| `created` timestamp NULL DEFAULT NULL, | |
| `is_add` tinyint(1) DEFAULT NULL, | |
| UNIQUE KEY `user_2` (`user`,`account`), | |
| KEY `user` (`user`), | |
| KEY `account` (`account`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import StringIO | |
| import fileinput | |
| import sys | |
| input = sys.stdin | |
| def main(input): | |
| T = int(input.readline()) | |
| for i in range(T): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| def test(C, F, X, i): | |
| secs = X / (2.0+F*i) | |
| for j in range(i): | |
| secs += C / (2.0 + F*j) | |
| return secs |