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 | |
| import httplib | |
| import urlparse | |
| def get_http_header(survey_url): | |
| p = urlparse.urlsplit(survey_url) | |
| hostname = p.netloc | |
| headers = {"User-Agent" : "Mozilla/5.0 (Windows NT 6.1; WOW64) " \ | |
| + "AppleWebKit/537.22 (KHTML, like Gecko) " \ |
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
| # selenium.webdriver.remote.webelement.WebElement | |
| web_element_property = [ | |
| __class__, | |
| __delattr__, | |
| __dict__, | |
| __doc__, | |
| __eq__, | |
| __format__, | |
| __getattribute__, |
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 | |
| import os | |
| import httplib2 | |
| from apiclient.discovery import build | |
| from oauth2client.client import OAuth2WebServerFlow | |
| from oauth2client.client import Credentials | |
| def get_credentials_oath2(file_path): | |
| CLIENT_ID = '' # your client 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
| # coding:utf-8 | |
| import datetime | |
| def print_days(birth_year, birth_month, birth_day, target_year): | |
| birth_day = datetime.date(birth_year, birth_month, birth_day) | |
| today = datetime.date.today() | |
| last_day = datetime.date(birth_day.year + target_year, birth_day.month, birth_day.day) | |
| print last_day |
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
| var tab_0 = document.getElementById("tab_0"); | |
| var tab_1 = document.getElementById("tab_1"); | |
| var tab_2 = document.getElementById("tab_2"); | |
| var tab_3 = document.getElementById("tab_3"); | |
| tab_0.style.display = ""; | |
| tab_1.style.display = ""; | |
| tab_2.style.display = ""; | |
| tab_3.style.display = ""; |
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 | |
| from BeautifulSoup import BeautifulSoup | |
| import urllib2 | |
| import json | |
| def crawl(tmp_url): | |
| page = urllib2.urlopen(tmp_url) | |
| soup = BeautifulSoup(page.read()) |
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
| var titles = document.getElementsByTagName("title"); | |
| var title = (titles.length > 0) ? titles[0].innerHTML: ""; | |
| var metas = document.getElementsByTagName("meta"); | |
| var description = ""; | |
| var keywords = ""; | |
| for (i=0; i<metas.length; i++){ | |
| var meta_name = metas[i].getAttribute("name"); | |
| if (meta_name=="description"){ | |
| description = metas[i].getAttribute("content"); | |
| } else if (meta_name=="keywords"){ |
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 | |
| import os | |
| import hashlib | |
| import sqlite3 | |
| target_path = './20140620/' | |
| db_path = './logs.db' | |
| file_output = './output.txt' |
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 | |
| import os | |
| target_path = './target/' | |
| def main(): | |
| for dpath,dnames,fnames in os.walk(target_path): | |
| for fname in fnames: |
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
| #include <Process.h> | |
| void c_print(Process p){ | |
| while(p.available()>0){ | |
| char c = p.read(); | |
| Serial.print(c); | |
| } | |
| Serial.flush(); | |
| } |
OlderNewer