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 / 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 / pool.py
Last active July 30, 2021 17:12
Multiprocessing example
from __future__ import print_function
import multiprocessing
import ctypes
import numpy as np
def shared_array(shape):
"""
Form a shared memory numpy array.
@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'
@nfaggian
nfaggian / .tmux.conf
Created January 4, 2017 00:53
tmux.conf newish
######################
### DESIGN CHANGES ###
######################
# panes
set -g pane-border-fg black
set -g pane-active-border-fg brightred
## Status bar design
# status line
@nfaggian
nfaggian / 00-intro_errorreporting.txt
Created August 19, 2016 05:01 — forked from pfctdayelise/00-intro_errorreporting.txt
Examples of pytest, especially funcargs
These are snippets of py.test in action, used in a talk given at
PyCon AU 2012 in Hobart, Tasmania. They are all relevant for
py.test 2.2 except where specified. Where taken from open source
projects I have listed a URL, some examples are from the py.test
documentation, some are from my workplace.
Apart from things called test_*, these functions should probably
be in your conftest.py, although they can generally start life in
your test files.
@nfaggian
nfaggian / data.json
Last active August 10, 2016 12:21
Simple remote simulator executor
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nfaggian
nfaggian / .emacs
Last active February 9, 2016 22:18
.emacs
;;; emacs.d --- emacs configuration.
;;; Commentary: current configuration (2016)
;;; Code:
(setq user-full-name "Nathan Faggian"
user-mail-address "nathan.faggian@gmail.com")
;; Packages
;; ============================================================
@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
# -*- 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 / 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):