Skip to content

Instantly share code, notes, and snippets.

View tommct's full-sized avatar

Tom McTavish tommct

View GitHub Profile
@tommct
tommct / README.md
Last active April 13, 2016 19:22
D3 Bounded Zoom

This D3 example demonstrates using the zoom event and limits the bounds of the zooming to a specified domain. It is largely based on http://bl.ocks.org/jasondavies/3689931, but with bounds. Most of this bounding is done in the refresh function. You need to zoom in before you can pan or zoom out.

@tommct
tommct / README.md
Last active August 29, 2018 19:01
Two axes focus+context via brushing
@tommct
tommct / README.md
Last active December 18, 2015 07:49
Scientific python configuration on Mac OS X 10.9

This is my own mods to http://www.lowindata.com/2013/installing-scientific-python-on-mac-os-x/, which describes a scientific python environment install on Mac OS X. See also https://github.com/fonnesbeck/ScipySuperpack.

Install XCode and Commandline tools for XCode from Apple. Also install http://mxcl.github.io/homebrew/ and run brew update and brew doctor to make sure homebrew is installed correctly.

Then, you can run the following commands (I recommend one at a time so that you can deal with any errors or important warnings):

brew install python
brew install gfortran

pip install --upgrade pip

@tommct
tommct / README.md
Last active November 9, 2023 20:00
FreeTDS and pyodbc on Mac OS X 10.8 via Homebrew

After spending many hours trying to get FreeTDS and unixodbc to run on a Mac OS X 10.8 system with the python module, pyodbc, I eventually came to this recipe, which is remarkably simple thanks to homebrew. I also found unixodbc was unnecessary and I couldn't get it to play well with FreeTDS, so this install does not include unixodbc. See also http://www.acloudtree.com/how-to-install-freetds-and-unixodbc-on-osx-using-homebrew-for-use-with-ruby-php-and-perl/ and http://www.cerebralmastication.com/2013/01/installing-debugging-odbc-on-mac-os-x/.

Prerequisites: Be sure you have XCode and the Commandline Tools for XCode installed from Apple. Also install homebrew followed with brew update and brew doctor.

Install FreeTDS:

brew install freetds

Test your install:

@tommct
tommct / README.md
Last active June 11, 2018 07:24
D3 Constrained Zoom Canvas Image

Implements constrained zooming of an image put onto an HTML5 Canvas.

@tommct
tommct / README.md
Last active December 31, 2015 21:49
D3 Zoomable ImageData
@tommct
tommct / README.md
Last active January 1, 2016 08:09
D3 Canvas ImageData w/ Constrained Zooming and Marginal Distributions
@tommct
tommct / README.md
Last active January 1, 2016 19:38
D3 Hierarchical Ordinal Ticks

This D3 example demonstrates constrained zooming, much like http://bl.ocks.org/tommct/5671250, but also illustrates the use of hierarchical ordinal tick marks. It does this by using the normalized values that one gets when using a hierarchical partition layout.

@tommct
tommct / README.md
Last active August 29, 2015 14:11
D3 Stacked Brush Plots

Implements multiple, stacked plots with brushing. This extends the example at http://bl.ocks.org/mbostock/1667367 and allows for multiple panels where each subsequent panel zooms from the previous. Data points are also smoothed, permitting data with over 100,000 points to have an overview with subsequent telescoping while maintaining context.

@tommct
tommct / README.md
Created November 6, 2015 00:17
Change Modification Date via Python

This is Python code for updating the file modification date of a file on MacOSX or Linux. In this example, I had copied .dv files from my camcorder, which encoded the date in the filename, but had as the modification date, the time I transferred the file from the camcorder.

import os
import time
fpath = '/path/to/dv/files'
for root, dirs, files in os.walk(fpath):
    for name in files:

if name[-3:]=='.dv':