- run a loop a half million times:
- split a delimited string into 5 fields
- strip invalid characters from each field with a regex
- calculate a SHA3-512 hash and get the digest for each field (2.5 million hashes)
Environment:
| import sys | |
| import time | |
| from collections import defaultdict | |
| import atexit | |
| from pathlib import Path | |
| import importlib | |
| import pkgutil | |
| import selenium | |
| #!/usr/bin/env python3 | |
| """Benchmark Selenium script execution: WebDriver Classic vs. BiDi""" | |
| import timeit | |
| from selenium import webdriver | |
| NUM = 500 |
| #!/usr/bin/env bash | |
| # | |
| # Selenium - yearly Git activity | |
| # | |
| # author: Corey Goldberg (https://github.com/cgoldberg) | |
| # requires: | |
| # - git (https://git-scm.com) | |
| # - git-who (https://github.com/sinclairtarget/git-who) | |
| # - selenium repo (git clone https://github.com/SeleniumHQ/selenium.git) |
| #!/usr/bin/env python3 | |
| # | |
| # transferring files with SFTP | |
| # https://www.paramiko.org | |
| import paramiko | |
| class SFTP: | |
| def __init__(self, host, user, password, port=22): |
| # load a Chrome extension using Selenium BiDi | |
| import os | |
| from selenium import webdriver | |
| # using unzipped extension in ./extensions/my-extension/ | |
| path = os.path.join(os.getcwd(), "extensions", "my-extension") | |
| options = webdriver.ChromeOptions() | |
| options.enable_bidi = True |
| #!/usr/bin/env bash | |
| # | |
| # Show GitHub Pull Requests in owner/repo created in the current year | |
| # | |
| # usage: current_year_prs.sh <owner> <repo> | |
| # | |
| # requires: jq | |
| set -o pipefail |
| # Selenium BiDi - Network Request Logging | |
| # - launch Chrome | |
| # - add a request handler that logs all HTTP headers from reqests made during page load | |
| # - navigate to a web page | |
| # - remove request handler | |
| # - quit Chrome | |
| import pprint | |
| from selenium import webdriver |
| # launch Chrome and navigate to a web page with all console logging enabled | |
| # - chrome/chromedriver logs go to STDOUT | |
| # - captured driver/performance logs go to STDOUT | |
| # - selenium debug logs go to STDERR | |
| import logging | |
| from subprocess import STDOUT | |
| from selenium import webdriver |
| #!/usr/bin/env bash | |
| # | |
| # Chrome for Testing - install Debian Linux system dependencies | |
| # - visit the CfT Dashboard: https://googlechromelabs.github.io/chrome-for-testing | |
| # - download 'chrome-linux64.zip' for the version you need | |
| # - unzip it and run this script | |
| deps_file="chrome-linux64/deb.deps" | |
| if [ "${EUID}" -ne 0 ]; then |