π
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 time | |
| print('Press ENTER to begin, Press Ctrl + C to stop') | |
| while True: | |
| try: | |
| input() | |
| start_time = time.time() | |
| print('Started') | |
| while True: | |
| print( |
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==3.12.0 | |
| schedule~=0.6.0 |
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 http.client | |
| def send_request(host, path, headers): | |
| conn = http.client.HTTPSConnection(host) | |
| try: | |
| conn.request("GET", path, headers=headers) | |
| with conn.getresponse() as response: | |
| return response.read() | |
| finally: | |
| conn.close() |
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 sys | |
| from collections import Counter | |
| from pathlib import Path | |
| def count_lines(file: Path): | |
| with file.open('r') as f: | |
| i = 0 | |
| for i, l in enumerate(f): | |
| pass | |
| return i |
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 hug | |
| @hug.get() | |
| def hello(): | |
| return 'Hello!' |
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 PyPDF2 | |
| # Get all the PDF filenames. | |
| def combine(pdfs): | |
| pdfFiles = pdfs | |
| pdfWriter = PyPDF2.PdfFileWriter() | |
| # Loop through all the PDF files. |
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 time | |
| def timeit(method): | |
| def timed(*args, **kw): | |
| ts = time.time() | |
| result = method(*args, **kw) | |
| te = time.time() | |
| if 'log_time' in kw: | |
| name = kw.get('log_name', method.__name__.upper()) | |
| kw['log_time'][name] = int((te - ts) * 1000) |
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
| aiohttp | |
| requests |
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 dateparser | |
| if __name__ == '__main__': | |
| import sys | |
| human_readable_date = sys.argv[-1] | |
| fmt = '%d, %b %Y, %I:%M %p' | |
| print(dateparser.parse(human_readable_date).strftime(fmt)) |
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 smtplib | |
| import ssl | |
| print( | |
| "In case if you do not have app password" | |
| "Follow this guide to get the app password from gmail..." | |
| "https://www.lifewire.com/" | |
| "get-a-password-to-access-gmail-by-pop-imap-2-1171882\n" | |
| ) |