This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!usr/bin/python | |
# -*- coding: utf-8 -*- | |
from bs4 import BeautifulSoup | |
import requests | |
import json | |
def get_html(url , data = None): | |
r = requests.get(url, timeout=10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!usr/bin/python | |
# -*- coding: utf-8 -*- | |
from bs4 import BeautifulSoup | |
import requests | |
def get_html(url , data = None): | |
r = requests.get(url, timeout=10) |
This file contains 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
#!/bin/env python | |
# -*- coding: utf-8 -*- | |
from selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.common.action_chains import ActionChains | |
from PIL import Image | |
import numpy as np | |
import time | |
import cv2 |
This file contains 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
#!/bin/env python | |
# -*- coding:utf-8 -*- | |
import time | |
from selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from bs4 import BeautifulSoup | |
driver = webdriver.Chrome() | |
WAIT_TIME = 30 |
This file contains 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
#!/bin/env python | |
# -*- coding:utf-8 -*- | |
from selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.chrome.options import Options | |
from bs4 import BeautifulSoup | |
import time | |
presets = [ | |
{"key":"1080 x 1920","name":"Nexus 5 Portrait","width":1080,"height":1920}, |
This file contains 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
#modify ~/.profile | |
alias sudo='sudo env PATH=$PATH:$NVM_BIN' |
This file contains 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
a:link,a:visited{ | |
font-weight: bold; | |
color: darkgray; | |
text-align: center; | |
padding: 6px; | |
text-decoration: none; | |
} | |
a:hover,a:active{ | |
color: dimgray; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def duplicate_count(s): | |
return len([c for c in set(s.lower()) if s.lower().count(c)>1]) | |
#test.assert_equals(duplicate_count("abcde"), 0) | |
#test.assert_equals(duplicate_count(""), 0) | |
#test.assert_equals(duplicate_count("abcdea"), 1) | |
#test.assert_equals(duplicate_count("indivisibility"), 1) | |
#test.assert_equals(duplicate_count("aabbcde"), 2) | |
#test.assert_equals(duplicate_count("aabbcdeB"), 2) | |
#test.assert_equals(duplicate_count("Indivisibilities"), 2) |
This file contains 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 re | |
def validPhoneNumber(phoneNumber): | |
return bool(re.match(r"^(\([0-9]+\))? [0-9]+-[0-9]+$", phoneNumber)) | |
# 使用正则表达式判断电话号码格式正确与否 | |
#validPhoneNumber("(123) 456-7890") => returns true | |
#validPhoneNumber("(1111)555 2345") => returns false | |
#validPhoneNumber("(098) 123 4567") => returns false |
This file contains 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 math | |
def isPrime(n): | |
if n <= 1: | |
return False | |
for i in range(2, int(math.sqrt(n)) + 1): | |
if n % i == 0: | |
return False | |
return True |