Skip to content

Instantly share code, notes, and snippets.

View nfaggian's full-sized avatar

Nathan Faggian nfaggian

  • Melbourne, Australia
View GitHub Profile
@nfaggian
nfaggian / integralVolume.py
Created January 4, 2012 06:03
Integral image extension to time domain.
# Integral Image + Time
# Ke, Y., Sukthankar, R., & Hebert, M. (2005). Efficient Visual Event Detection
# Using Volumetric Features. Tenth IEEE International Conference on Computer
# Vision ICCV05 Volume 1, 1, 166-173.
def integral(cube, closest, farthest):
"""
Compute the sum of pixels in a cube.
@nfaggian
nfaggian / slidingWindowSum.py
Created March 1, 2012 23:04
Demonstrates how fourier transforms can be used to speed up a sliding window sum operation.
import numpy as np
import scipy.signal as signal
import scipy.ndimage as nd
import time
def slidingWindow(field, window):
"""
Gold standard sliding window operator. This slides along the field
and sums gridcells in a window.
@nfaggian
nfaggian / gist:3161261
Created July 22, 2012 22:39 — forked from axelav/gist:1839777
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@nfaggian
nfaggian / bottle-matplotlib.py
Created July 26, 2012 09:44
Demonstration of a dynamically generated figure served using the Bottle microframework.
"""
A simple example that generates a random figure and serves it using Bottle
"""
import numpy as np
import StringIO
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
@nfaggian
nfaggian / .gitignore
Created November 12, 2012 21:50 — forked from dansimau/.gitignore
Bootstrap a Flask project on Ubuntu Precise, with Puppet, Vagrant and Fabric. (For latest version, see https://github.com/dansimau/flask-bootstrap)
*~
*.pyc
.vagrant
venv
@nfaggian
nfaggian / demo
Created July 6, 2013 04:44
NB demo
from IPython.core.display import Image
Image("http://www.python.org/images/python-logo.gif")
@nfaggian
nfaggian / XML crawl
Created July 6, 2013 09:32
Pydap XML crawler
from xml.etree import cElementTree
from urlparse import urljoin
import requests
# namespaces for XML parsing
thredds = "http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0"
xlink = "http://www.w3.org/1999/xlink"
def crawl(catalog):
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 17 10:50:56 2013
@author: cmarshall
"""
import sip
sip.setapi('QString', 1)
sip.setapi('QVariant', 1)
@nfaggian
nfaggian / python_three.md
Last active January 4, 2016 13:19
Notes on getting packages working in Python 3

Fabric

Need to install paramiko port and context2lib then fabric python 3.3 port:

pip install git+https://github.com/scottkmaxwell/paramiko.git@py3-support-without-py25
pip install contextlib2
pip install git+https://github.com/pashinin/fabric.git@p33
@nfaggian
nfaggian / fabfile.py
Last active November 15, 2017 09:25
Fabric script to setup a Python 3.3 environment, with some patched libraries.
"""
Fabric configuration for a Python 3.3 environment using Anaconda.
"""
from fabric.api import run, cd
from fabric.context_managers import prefix
CONDA_REPO = 'http://repo.continuum.io/miniconda/'
CONDA_VERS = 'Miniconda3-3.0.0-Linux-x86_64.sh'