Skip to content

Instantly share code, notes, and snippets.

Avatar
☠️
¯\_(ツ)_/¯

Corey Goldberg cgoldberg

☠️
¯\_(ツ)_/¯
View GitHub Profile
@cgoldberg
cgoldberg / webdriver-packed-extension.py
Last active Jul 8, 2021
Python - Selenium WebDriver - Installing a packed Chrome Extension
View webdriver-packed-extension.py
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
packed_extension_path = '/path/to/packed/extension.crx'
options = Options()
options.add_extension(packed_extension_path)
driver = webdriver.Chrome(options=options)
@cgoldberg
cgoldberg / timer.py
Created Jun 16, 2012
Python Timer Class - Context Manager for Timing Code Blocks
View timer.py
#!/usr/bin/env python
#
# Python Timer Class - Context Manager for Timing Code Blocks
# Corey Goldberg - 2012
#
from timeit import default_timer
@cgoldberg
cgoldberg / img_exif_date_fixer.py
Last active Jun 7, 2021
Python - Fix Photo Exif Metadata
View img_exif_date_fixer.py
#!/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 / geckodriver-install.sh
Last active Apr 24, 2021
download and install latest geckodriver for linux or mac (selenium webdriver)
View geckodriver-install.sh
#!/bin/bash
# download and install latest geckodriver for linux or mac.
# required for selenium to drive a firefox browser.
install_dir="/usr/local/bin"
json=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest)
if [[ $(uname) == "Darwin" ]]; then
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("macos"))')
elif [[ $(uname) == "Linux" ]]; then
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("linux64"))')
View matrix_terminal_python.py
""""Create "The Matrix" of binary numbers scrolling vertically in your terminal.
original code adapted from juancarlospaco:
- http://ubuntuforums.org/showpost.php?p=10306676
Inspired by the movie: The Matrix
- Corey Goldberg (2013)
Requires:
@cgoldberg
cgoldberg / merge_junit_results.py
Last active Mar 10, 2021
Merge multiple JUnit XML results files into a single results file.
View merge_junit_results.py
#!/usr/bin/env python
"""Merge multiple JUnit XML results files into a single results file."""
# MIT License
#
# Copyright (c) 2012 Corey Goldberg
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@cgoldberg
cgoldberg / gource-multiple-repositories.sh
Last active Jan 20, 2021 — forked from derEremit/gource-multiple-repositories.sh
Generates gource video of multiple source code repositories.
View gource-multiple-repositories.sh
#!/usr/bin/env bash
# Generates gource video out of multiple repositories.
# First, get a local branch/clone of each repository.
# Then, pass the repositories as command line arguments.
#
# Example:
# $ gource-multiple-repositories.sh /path/to/repo1 /path/to/repo2
@cgoldberg
cgoldberg / camel.pl
Created Dec 18, 2012
Perl Camel code - render 4 ascii camels from camel-styled source code.
View camel.pl
#!/usr/bin/perl -w # camel code
use strict;
$_='ev
al("seek\040D
ATA,0, 0;");foreach(1..3)
{<DATA>;}my @camel1hump;my$camel;
my$Camel ;while( <DATA>){$_=sprintf("%-6
9s",$_);my@dromedary 1=split(//);if(defined($
_=<DATA>)){@camel1hum p=split(//);}while(@dromeda
@cgoldberg
cgoldberg / gource.sh
Created Jul 2, 2013
Gource - Mir development video
View gource.sh
# install bzr and gource
# get a branch of Mir's trunk code
# create gource video
$ sudo apt-get install bzr gource
$ bzr branch lp:mir
$ cd mir
$ gource \
-s .06 \
@cgoldberg
cgoldberg / webdriver-unpacked-extension.py
Last active Nov 3, 2020
Python - Selenium WebDriver - Installing an unpacked Chrome Extension
View webdriver-unpacked-extension.py
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
unpacked_extension_path = '/path/to/unpacked/extension/'
options = Options()
options.add_argument('--load-extension={}'.format(unpacked_extension_path))
driver = webdriver.Chrome(options=options)