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
| # 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 |
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
| #!/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 |
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 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 |
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
| # 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 | |
| import subprocess | |
| from selenium import webdriver |
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
| #!/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 |
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
| #!/usr/bin/env python3 | |
| # | |
| # Copyright (c) 2025 Corey Goldberg (https://github.com/cgoldberg) | |
| # License: MIT | |
| # | |
| # Generate language specific SBOMs from a multi-language monorepo on GitHub | |
| # - fetches repo-wide SBOM from GitHub | |
| # - generates individual SBOMs for each language specified | |
| # | |
| # requires: |
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
| # Generate a SHA3-512 hash with optional salt | |
| import re | |
| # requires pycryptodome | |
| # - https://pycryptodome.readthedocs.io/en/latest/src/hash/sha3_512.html | |
| from Crypto.Hash import SHA3_512 | |
| def generate_hash(s, salt=None): |
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
| #!/usr/bin/env python | |
| # | |
| # monkeypatch a method on a class and call the original method from the new one | |
| from functools import partialmethod | |
| class MyClass: | |
| # this is the original method |
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
| #!/usr/bin/env python | |
| # | |
| # Selenium WebDriver function to wait for an element and click it | |
| import time | |
| from selenium import webdriver | |
| from selenium.common.exceptions import ( | |
| ElementClickInterceptedException, |
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
| #!/usr/bin/env python | |
| # | |
| # Functions for generating Unicode data | |
| import random | |
| import unicodedata | |
| def get_all_chars(): |
NewerOlder