Skip to content

Instantly share code, notes, and snippets.

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

Corey Goldberg cgoldberg

👋
¯\_(ツ)_/¯
View GitHub Profile
@cgoldberg
cgoldberg / gource.sh
Created July 2, 2013 14:05
Gource - Mir development video
# 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 \
#!/usr/bin/env python
#
# Example using `concurrencytest`:
# https://github.com/cgoldberg/concurrencytest
import unittest
from concurrencytest import ConcurrentTestSuite, fork_for_tests
#!/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 / tox.ini
Created February 11, 2013 15:01
Tox (Python) boilerplate config/ini file.
[tox]
envlist =
py26
py27
[testenv]
deps =
nose
commands =
{envpython} setup.py install
@cgoldberg
cgoldberg / get_image_info.py
Last active August 18, 2023 02:05
validate and analyze dimensions of [PNG, JPG, GIF], image files in Python.
#!/usr/bin/env python
#
# Corey Goldberg, 2013
#
# Python 2.7
"""validate and analyze dimensions of image files. Supports: PNG, JPG, GIF."""
@cgoldberg
cgoldberg / png_info.py
Last active December 11, 2015 20:59
utilities for analyzing PNG image files.
#!/usr/bin/env python
import struct
def get_image_info(data):
if is_png(data):
w, h = struct.unpack('>LL', data[16:24])
width = int(w)
@cgoldberg
cgoldberg / selenium_browser_benchmark.py
Last active April 18, 2025 00:45
Selenium WebDriver - Browser Benchmark
#!/usr/bin/env python
"""Selenium WebDriver - Browser Benchmark
run 10 iterations of simple local test case with each driver:
Firefox (webdriver) vs. Chrome (chromedriver) vs. PhantomJS (ghostdriver).
"""
import unittest
@cgoldberg
cgoldberg / matrix_terminal_python.py
Last active April 18, 2025 00:44
Create "The Matrix" of binary numbers scrolling vertically in your terminal
""""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 / selenium_webdriver_phantomjs.py
Created January 7, 2013 18:06
Python unit test using PhantomJS and Selenium WebDriver. Headless web acceptance testing.
#!/usr/bin/env python
"""Python unit test using PhantomJS and Selenium WebDriver."""
# requires: selenium python bindings, phantomjs 1.8+
#
# if you have phantomjs installed and on your PATH,
# you can instantiate a PhantomJS WebDriver like this:
#
# from selenium import webdriver
@cgoldberg
cgoldberg / pypi_tarball.py
Created December 19, 2012 17:19
Download latest package release from PyPI.
#!/usr/bin/env python
import json
import os
import urllib
"""Download latest source release from PyPI.