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
| # method to get the downloaded file name | |
| def getDownLoadedFileName(waitTime): | |
| driver.execute_script("window.open()") | |
| # switch to new tab | |
| driver.switch_to.window(driver.window_handles[-1]) | |
| # navigate to chrome downloads | |
| driver.get('chrome://downloads') | |
| # define the endTime | |
| endTime = time.time()+waitTime | |
| while True: |
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
| def waitForElementPresent(driver, selector): | |
| return WebDriverWait(driver, 60).until(EC.presence_of_element_located(selector)) | |
| element = waitForElementPresent(driver, (By.ID, "myid")) |
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
| bot.sendMessage(msg.chat.id, 'Share:', { | |
| reply_markup: { | |
| inline_keyboard: [[{ | |
| text: 'Share with your friends', | |
| switch_inline_query: 'share' | |
| }]] | |
| } | |
| }) |
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
| const sleep = require('util').promisify(setTimeout) | |
| let doSometing = async () => { | |
| console.log("start") | |
| await sleep(3000) | |
| console.log("end") | |
| } | |
| doSometing() |
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 urllib.request | |
| from urllib.request import urlopen | |
| import pandas as pd | |
| from datetime import date | |
| start = str('2019-01-01') | |
| end = str('2020-01-22') | |
| dates = pd.date_range(start, end, freq="D") |
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 traceback | |
| try: | |
| print(555) | |
| except Exception as e: | |
| print("type error: " + str(e)) | |
| print(traceback.format_exc()) |
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
| from datetime import datetime | |
| import pandas as pd | |
| from sys import argv | |
| def split_date_range(stdate, fndate, periods): | |
| def date_object(string): | |
| return datetime.strptime(string, '%Y-%m-%d') | |
| stdate = date_object(stdate) |
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
| from datetime import datetime | |
| import pandas as pd | |
| def date_object(string): | |
| return datetime.strptime(string, '%Y-%m-%d') | |
| start = date_object('2019-01-01') | |
| end = date_object('2020-01-12') |
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 pandas as pd | |
| begin = '20100101' | |
| end = '20101231' | |
| start = dt.datetime.strptime(begin, '%Y%m%d') | |
| finish = dt.datetime.strptime(end, '%Y%m%d') | |
| dates = pd.DatetimeIndex(start=start, end=finish, freq='D').tolist() | |
| quarters = [d.to_period('Q') for d in dates] |
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
| sudo apt install virtualenv | |
| sudo apt install python3-virtualenv | |
| sudo apt install python3-venv | |
| python3 -m venv myvirtualenv | |
| source myvirtualenv/bin/activate |