def main(): setting.init() host = input("Your IP or hostname: ") port = int(input("Your port: ")) receiver = Receiver(host, port) partner_host = input("Partner's IP or hostname: ") partner_port = int(input("Partner's port: ")) sender = Sender(partner_host, partner_port) threads = [receiver.start(), sender.start()]
def main(): setting.init() # grab the indexes of the facial landmarks print("[INFO] Starting video stream thread...") setting.vs = VideoStream(src=setting.Camera).start() facedetection = threading.Thread(target=facedetection_background, name='Face') facedetection.start() MainUI.main_ui() setting.vs.stop() print("[INFO] Stop video thread...") print("[INFO] Exit") sys.exit(1)
# arg[1] g # arg[2] TCP_port_num # arg[3] UDP_port_num if len(arg) == 4 and 'g' in arg: # GateWay node Initialization gateNode = GatewayNode(gate_ip, arg[2], arg[3]) # GateWay Node start running gateNode.startGateNode() # Enter program Normal server # arg[0] ServerStart.py # arg[1] TCP_port_num # arg[2] UDP_port_num else: # Get server local ip address local_ip = get_local_ip().decode() # Normal node Initialization memberNode = MemberNode(gate_ip, local_ip, arg[1], arg[2]) # Normal Node start running memberNode.startNormalNode() # Program access point if __name__ == '__main__': # Initialize the network structure setting.init() # Server initialization by using user input argument s = ServerStart() argv = sys.argv s.getCommand(argv)
inner=np.dot(vector_a,vector_b); a_norm=np.dot(vector_a,vector_a); b_norm=np.dot(vector_b,vector_b); angle=math.acos(inner/math.sqrt(a_norm)/math.sqrt(b_norm)); return angle/math.pi*180; def maxangle(traject): le=len(traject); angleall=[]; for i in range(le): for j in range(i): ag=angle(traject[i],traject[j]); print ag angleall.append(ag); return max(angleall) if __name__=="__main__": setting.init(); f=open(traject_file,"r"); cell=period; raw_data=f.readlines(); lines=len(raw_data); step=lines/(5*cell*cell*cell+9); calist=[int(sys.argv[2])]; traject=[]; posit=[]; for atomnum in calist: neilist=neighbor_o_forA(atomnum,cell); for i in range(step): atomposit=getposition(atomnum,cell,i,raw_data); posit.append(atomposit); sum=np.zeros(3); for j in range(12):
# The actual sending of the e-mail server = smtplib.SMTP('smtp.gmail.com:587') # Credentials (if needed) for sending the mail server.starttls() server.login(FROM,password) server.sendmail(FROM, [TO], MESSAGE.as_string()) server.quit() print("====== finished sending to "+TO+" =======") if __name__ == "__main__": """Create variable from setting.py """ account = setting.init()['account'] pwd=setting.init()['pwd'] playConsoleAccount=setting.init()['playConsoleAccount'] StatisticsPlace=setting.init()['StatisticsPlace'] googleAppId=setting.init()['googleAppId'] iOSAppID=setting.init()['iOSAppID'] country=setting.init()['appannie_parameter']['country'] andro_category=setting.init()['appannie_parameter']['andro_category'] iOS_category=setting.init()['appannie_parameter']['iOS_category'] firebaseProjectName=setting.init()['firebaseProjectName'] gmailAccount=setting.init()['sendFrom']['gmailAccount'] gmailPwd=setting.init()['sendFrom']['gmailPwd'] sendTo_list=setting.init()['sendTo_list'] email_title=setting.init()['email_title'] """check the login cookies file exists or not """
# -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities import time, sys import setting import sqlite3 setting.init() cursor = setting.DB_CONN.cursor() # # 函数名:getDriver # 获取Driver的相关信息 # def getDriver(): # driver = webdriver.Firefox() # driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe") driver = webdriver.Remote( 'http://9.115.28.185:4444x/wd/hub', #Change to your own port DesiredCapabilities.FIREFOX) return driver ###Start scroll page### # # 函数名:scrolltobtm # 滚动浏览器到底部 # def scrolltobtm(driver): # scroll_js = '''document.body.scrollTop = 2000'''#Chrome driver scroll_js = '''document.documentElement.scrollTop = 2000'''#Firefox driver driver.execute_script(scroll_js)