Skip to content

Instantly share code, notes, and snippets.

☠️
¯\_(ツ)_/¯

Corey Goldberg cgoldberg

☠️
¯\_(ツ)_/¯
Block or report user

Report or block cgoldberg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cgoldberg
cgoldberg / geckodriver-install.sh
Last active Dec 10, 2019
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 / mailbox.py
Created Nov 26, 2012
MailBox class for processing IMAP email (Gmail from Python example)
View mailbox.py
#!/usr/bin/env python
"""MailBox class for processing IMAP email.
(To use with Gmail: enable IMAP access in your Google account settings)
usage with GMail:
import mailbox
@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 / merge_junit_results.py
Last active Oct 17, 2019
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 / 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_metadata_strip_fix.py
Last active Jul 18, 2019
Python - image metadata remover and date fixer.
View img_metadata_strip_fix.py
#!/usr/bin/env python
#
# image metadata remover and date fixer.
# Corey Goldberg, 2014
"""Recursively scan a directory tree for image files, and fix metadata.
* removes all metadata (Exif, IPTC, XMP, GPS Info, comment, thumbnail)
* sets metadata and file timestamps to oldest datetime found.
@cgoldberg
cgoldberg / get_image_info.py
Last active Jun 7, 2019
validate and analyze dimensions of [PNG, JPG, GIF], image files in Python.
View get_image_info.py
#!/usr/bin/env python
#
# Corey Goldberg, 2013
#
# Python 2.7
"""validate and analyze dimensions of image files. Supports: PNG, JPG, GIF."""
@cgoldberg
cgoldberg / playlists.sh
Last active May 27, 2019
scan music library and create M3U playlists
View playlists.sh
## scan music library and create M3U playlists
# example shell commands:
# 500 random MP3's
find /path/to/music -type f -iname "*.mp3" | shuf | head -n 500 > 500_playlist.m3u
# All MP3's and FLAC's, sorted
find /path/to/music -type f \( -iname '*.mp3' -o -iname '*.flac' \) | sort > full_playlist.m3u
@cgoldberg
cgoldberg / install-webdrivers.sh
Last active May 11, 2019
Selenium - download and install WebDriver binaries for Firefox (geckodriver) and Chrome (chromedriver)
View install-webdrivers.sh
#!/usr/bin/env bash
#
# Installer for WebDrivers
# ------------------------
# - Binary webdrivers are required to drive Firefox and Chrome browsers from Selenium.
# - This script will fetch the 64-bit binaries (geckodriver/chromedriver) for MacOS or Linux.
set -e
You can’t perform that action at this time.