Skip to content

Instantly share code, notes, and snippets.

View cgoldberg's full-sized avatar
👋
¯\_(ツ)_/¯

Corey Goldberg cgoldberg

👋
¯\_(ツ)_/¯
View GitHub Profile
@cgoldberg
cgoldberg / chrome_extension.py
Created October 30, 2025 13:30
Python - load a Chrome extension using Selenium BiDi
# 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
@cgoldberg
cgoldberg / current_year_prs.sh
Created October 28, 2025 13:27
Show GitHub Pull Requests in owner/repo created in the current year
#!/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
@cgoldberg
cgoldberg / img_exif_date_fixer.py
Last active October 15, 2025 12:29
Python - Fix Photo Exif Metadata
#!/usr/bin/env python
#
# gexiv2 image Exif date fixer.
# Corey Goldberg, 2014
"""Recursively scan a directory tree, fixing dates
on all jpg/png image files.
Each file's Exif metadata and atime/mtime are all
@cgoldberg
cgoldberg / concurrencytest_example_1.py
Last active October 15, 2025 12:29
Example 1 using concurrencytest module
#!/usr/bin/env python
#
# Example using `concurrencytest`:
# https://github.com/cgoldberg/concurrencytest
import time
import unittest
from concurrencytest import ConcurrentTestSuite, fork_for_tests
@cgoldberg
cgoldberg / concurrencytest_example_2.py
Last active October 15, 2025 12:28
Example 2 using concurrencytest module
#!/usr/bin/env python
#
# Example using `concurrencytest`:
# https://github.com/cgoldberg/concurrencytest
import unittest
from concurrencytest import ConcurrentTestSuite, fork_for_tests
@cgoldberg
cgoldberg / pldiffs.md
Last active October 15, 2025 12:26
compare .plist changes between 2 git branches

Comparing p-lists (iOS Property List Files)

In OS X and iOS programming frameworks, property list files are used to store information about bundles and applications. Analyzing .plist files can tell you a lot about an application. It is often useful to compare content and view modifications to .plist files to understand what has changed between versions of an application.


  • list paths of .plist files modified between 2 branches
$ git diff --name-only "origin/branch1" "origin/branch2" -- 
@cgoldberg
cgoldberg / selenium-bidi-network-logging.py
Created October 13, 2025 14:26
Python - Selenium BiDi - Network Request Logging
# 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
@cgoldberg
cgoldberg / selenium-logging.py
Created September 30, 2025 21:10
Python/Selenium - launch Chrome and load a web page with all possible logging enabled
# 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
@cgoldberg
cgoldberg / install-chrome-dependencies.sh
Created September 22, 2025 20:48
Chrome for Testing - install Debian Linux system dependencies
#!/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
@cgoldberg
cgoldberg / generate_monorepo_sboms.py
Last active September 12, 2025 23:02
Python - Generate language specific SBOMs from a multi-language monorepo on GitHub
#!/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: