From b2580d98b8a1235d7de6c04070c9a4fd33b3631c Mon Sep 17 00:00:00 2001 From: ShuttleDDD <33392616+ShuttleDDD@users.noreply.github.com> Date: Wed, 3 Oct 2018 00:58:40 +0800 Subject: [PATCH 1/6] Create Shuttle_c++.cpp --- Shuttle_c++.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Shuttle_c++.cpp diff --git a/Shuttle_c++.cpp b/Shuttle_c++.cpp new file mode 100644 index 0000000..2a12015 --- /dev/null +++ b/Shuttle_c++.cpp @@ -0,0 +1,42 @@ +#随手交了个作业 +#include +using namespace std; +int getPower(int x,int y){ + int ans=1; + if (y<0) return 0; + else if (y==0) return 1; + + for(int i=0;i>a>>b>>m; + ansi=getPower(a,m); + ansd=getPower(b,m); + cout< Date: Wed, 3 Oct 2018 00:59:05 +0800 Subject: [PATCH 2/6] Delete Shuttle_c++.cpp --- Shuttle_c++.cpp | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 Shuttle_c++.cpp diff --git a/Shuttle_c++.cpp b/Shuttle_c++.cpp deleted file mode 100644 index 2a12015..0000000 --- a/Shuttle_c++.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#随手交了个作业 -#include -using namespace std; -int getPower(int x,int y){ - int ans=1; - if (y<0) return 0; - else if (y==0) return 1; - - for(int i=0;i>a>>b>>m; - ansi=getPower(a,m); - ansd=getPower(b,m); - cout< Date: Wed, 3 Oct 2018 01:01:51 +0800 Subject: [PATCH 3/6] Create ShuttleDDD_c++.cpp --- ShuttleDDD_c++.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 ShuttleDDD_c++.cpp diff --git a/ShuttleDDD_c++.cpp b/ShuttleDDD_c++.cpp new file mode 100644 index 0000000..37d40cd --- /dev/null +++ b/ShuttleDDD_c++.cpp @@ -0,0 +1,41 @@ +#include +using namespace std; +int getPower(int x,int y){ + int ans=1; + if (y<0) return 0; + else if (y==0) return 1; + + for(int i=0;i>a>>b>>m; + ansi=getPower(a,m); + ansd=getPower(b,m); + cout< Date: Wed, 3 Oct 2018 01:03:12 +0800 Subject: [PATCH 4/6] Add files via upload --- time_analysing_robot.py | 215 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 time_analysing_robot.py diff --git a/time_analysing_robot.py b/time_analysing_robot.py new file mode 100644 index 0000000..9dc26ce --- /dev/null +++ b/time_analysing_robot.py @@ -0,0 +1,215 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Aug 22 11:30:12 2018 + +@author: benak +""" + +# -*- coding: utf-8 -*- +""" +Created on Mon Aug 20 10:51:38 2018 + +@author: benak +""" + + +#from bs4 import BeautifulSoup +#import bs4 +#import os +#import csv +import requests +from urllib import request +#import urllib.parse +import json +from http import cookiejar +import ssl +#import csv +import openpyxl +#import gc +import time +lgurl = r'https://svr.jikecloud.net/user/login' +jurl = r'https://svr.jikecloud.net/gpu/type/list' +ssl._create_default_https_context = ssl._create_unverified_context +header = { + +"Accept": "application/json, text/javascript, */*; q=0.01", +"Accept-Encoding": "gzip, deflate, br", +"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", +"Connection": "close", +"Content-Length": "67", +"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", +#"Cookie": "Hm_lvt_dbfa468b149fbfa4272efada10bdc22e=1532433770,1533054225,1534132408,1534146039; JSESSIONID=D6989EC1760D28C8B0DBD8972C370410; Hm_lpvt_dbfa468b149fbfa4272efada10bdc22e=1534178042", +"Host": "svr.jikecloud.net", +"Origin": "https://www.jikecloud.net", +"Referer": "https://www.jikecloud.net/login.html", +"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36", +"Cookie": "Hm_lvt_dbfa468b149fbfa4272efada10bdc22e=1534321014,1534408594,1534418889,1534518497; JSESSIONID=74DFAFF31F1418AADB83368C51879E46; Hm_lpvt_dbfa468b149fbfa4272efada10bdc22e=1534518570" +} +#header_code = { +# "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36", +# "Referer": "https://www.jikecloud.net/login.html", +# "Host": "svr.jikecloud.net", + +#} +S = requests.session() +URL = r'https://svr.jikecloud.net/user/login' + +def main(): + print("1:GTX 1080 Ti 12核24G + 250GB SSD + 2TB硬盘 (独占5元每小时)") + print("2:GTX 1080 Ti 12核32G 250GB SSD + 3TB硬盘 (独占5元每小时)") + print("3:Titan XP 12核32G 双卡(限时特价独占6元每小时)") + print("4:gtx1070") + select = int(input("请选择你要观察的GPU型号")) + G1="GTX 1080 Ti 12核24G + 250GB SSD + 2TB硬盘 (独占5元每小时)" + G2="GTX 1080 Ti 12核32G 250GB SSD + 3TB硬盘 (独占5元每小时)" + G3="Titan XP 12核32G 双卡(限时特价独占6元每小时)" + G4="GTX 1070 12核32G 120GB SSD + 2TB硬盘 (独占3元每小时)" + if select==1: + chk=G1 + elif select==2: + chk=G2 + elif select==3: + chk=G3 + elif select==4: + chk=G4 + #print (chk) + #脚本总运行时间 + obT=0 + + while True: + + obT=int(input("输入观测时间,请(秒)")) + if obT>60: + break + else: + print("输入单位是秒啊kora!!!") + continue + + #观察的实例运行的时间 + occT=0 + login_info = {"id":1,"params":{'username':'18938769727','passwd':'D27403daczq'}} + + occT = login2next(login_info,occT,chk,obT) + ans=occT/obT + print (ans) + + + +def login2next(data,occT,chk,obT): + start=time.clock() + while True: + + + try: + req = requests.post(url=lgurl,data=json.dumps(data),headers=header,verify=False) + #response1 = opener.open(req) + print(req) + + filename = 'D:\log of GPU\cookie2.txt' + #声明一个CookieJar对象实例来保存cookie + cookie = cookiejar.MozillaCookieJar(filename) + #从文件中读取cookie内容到变量 + cookie.load(filename, ignore_discard=True, ignore_expires=True) + #利用urllib.request库的HTTPCookieProcessor对象来创建cookie处理器,也就CookieHandler + handler=request.HTTPCookieProcessor(cookie) + #通过CookieHandler创建opener + opener = request.build_opener(handler) + #此处的open方法打开网页 + response = opener.open('https://www.jikecloud.net/') + #打印cookie信息 + for item in cookie: + print('Name = %s' % item.name) + print('Value = %s' % item.value) + cookie.save(ignore_discard=True, ignore_expires=True) + formdata={"id":1,"params":{"all":"true","exclude_geek":"false","only_available":"false","region_id":"null"}} + #formdata = urllib.parse.urlencode(formdata).encode('utf-8') + wbdata = requests.post(url=jurl,data=json.dumps(formdata),headers=header,verify=False).text + #response2 = opener.open(wbdata) + dataa = json.loads(wbdata) + #print(dataa) + rawdata = dataa["result"] + #print(rawdata) + for n in rawdata: + if n['desc']==chk: + gotcha=n + break + print(gotcha) + if (gotcha['isAvailable']==False): + occT=timelog(gotcha['desc'],data,occT) + stop=time.clock() + times=stop-start + if times >=obT: + break + continue + else: + stop=time.clock() + times=stop-start + if times >=obT: + break + time.sleep(600) + continue + + except requests.exceptions.ConnectionError: + time.sleep(5) + continue + return occT + + +def loginnchk(data,chk): + while True: + try: + req = requests.post(url=lgurl,data=json.dumps(data),headers=header,verify=False) + #response1 = opener.open(req) + print(req) + + filename = 'D:\log of GPU\cookie2.txt' + #声明一个CookieJar对象实例来保存cookie + cookie = cookiejar.MozillaCookieJar(filename) + #从文件中读取cookie内容到变量 + cookie.load(filename, ignore_discard=True, ignore_expires=True) + #利用urllib.request库的HTTPCookieProcessor对象来创建cookie处理器,也就CookieHandler + handler=request.HTTPCookieProcessor(cookie) + #通过CookieHandler创建opener + opener = request.build_opener(handler) + #此处的open方法打开网页 + response = opener.open('https://www.jikecloud.net/') + #打印cookie信息 + for item in cookie: + print('Name = %s' % item.name) + print('Value = %s' % item.value) + cookie.save(ignore_discard=True, ignore_expires=True) + formdata={"id":1,"params":{"all":"true","exclude_geek":"false","only_available":"false","region_id":"null"}} + #formdata = urllib.parse.urlencode(formdata).encode('utf-8') + wbdata = requests.post(url=jurl,data=json.dumps(formdata),headers=header,verify=False).text + #response2 = opener.open(wbdata) + dataa = json.loads(wbdata) + #print(dataa) + rawdata = dataa["result"] + #print(rawdata) + for n in rawdata: + if n['desc']==chk: + gotcha=n + break + #print(gotcha) + if (gotcha['isAvailable']==False): + time.sleep(600) + continue + else: + return + + except requests.exceptions.ConnectionError: + time.sleep(5) + continue + +def timelog(gotcha,data,occT): + start=time.clock() + loginnchk(data,gotcha) + stop=time.clock() + occT=occT+(stop-start) + return occT + + + +main() + + \ No newline at end of file From a6cb50fa710d1a1bd10e04aa266f7455ad51bb2c Mon Sep 17 00:00:00 2001 From: ShuttleDDD <33392616+ShuttleDDD@users.noreply.github.com> Date: Wed, 3 Oct 2018 01:04:38 +0800 Subject: [PATCH 5/6] Update time_analysing_robot.py --- time_analysing_robot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/time_analysing_robot.py b/time_analysing_robot.py index 9dc26ce..d05fd7f 100644 --- a/time_analysing_robot.py +++ b/time_analysing_robot.py @@ -11,7 +11,8 @@ @author: benak """ - +#菜鸡写的时间分析爬虫,因为是Python所以分析出来的数据误差较大 +#目前只有最简单的功能,,,还没有加入微信推送 #from bs4 import BeautifulSoup #import bs4 @@ -87,7 +88,7 @@ def main(): #观察的实例运行的时间 occT=0 - login_info = {"id":1,"params":{'username':'18938769727','passwd':'D27403daczq'}} + login_info = {"id":1,"params":{'username':'','passwd':''}} occT = login2next(login_info,occT,chk,obT) ans=occT/obT @@ -212,4 +213,4 @@ def timelog(gotcha,data,occT): main() - \ No newline at end of file + From 7357de27fbe5089b2e405347eccc08167627e5af Mon Sep 17 00:00:00 2001 From: ShuttleDDD <33392616+ShuttleDDD@users.noreply.github.com> Date: Wed, 3 Oct 2018 01:06:01 +0800 Subject: [PATCH 6/6] Update time_analysing_robot.py --- time_analysing_robot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/time_analysing_robot.py b/time_analysing_robot.py index d05fd7f..1352430 100644 --- a/time_analysing_robot.py +++ b/time_analysing_robot.py @@ -210,7 +210,7 @@ def timelog(gotcha,data,occT): return occT - -main() +if __name__ == "__name__": + main()