Skip to content

Instantly share code, notes, and snippets.

@cpelley
cpelley / f2py_example_usage.ipynb
Created November 13, 2015 11:53
f2py example usage
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cpelley
cpelley / calendar_bug.py
Last active December 10, 2015 14:42
iris.unit.Unit vs cf_units calendar bug
import iris
import iris.unit
import cf_units
tunit = iris.unit.Unit('hours since 1970-01-01 00:00:00', calendar='360_day')
tcoord = iris.coords.DimCoord(1, standard_name='time', units=tunit)
print 'iris.unit.Unit: {}'.format(repr(tcoord))
tunit = cf_units.Unit('hours since 1970-01-01 00:00:00', calendar='360_day')
@cpelley
cpelley / iris_dev_build.sh
Last active September 26, 2016 13:07
Conda Iris development build script
# THE FOLLOWING SCRIPT IS TO BE PLACED AND RUN IN THE CLONE OF
# THE IRIS REPOSITORY - https://github.com/SciTools/iris
#
# The script is for installing iris to make developments in iris.
# To install iris as simply a user of iris see:
# https://gist.github.com/cpelley/5a89f44cf9288308be3f
#
# Assumes user is working with conda, if not please change
# 'ENVIRONMENT_PATH' to point to the directory of your choosen
# python interpreter.
@cpelley
cpelley / iris_user_build.sh
Last active September 26, 2016 13:07
Conda Iris user build script
# THE FOLLOWING SCRIPT IS TO BE PLACED AND RUN IN THE DOWNLOADED
# IRIS SOURCE DIRECTORY - https://github.com/SciTools/iris
#
# The script is for simply installing iris. For iris development
# see: https://gist.github.com/cpelley/35020289a28253116a82
#
# Assumes user is working with conda, if not please change
# 'ENVIRONMENT_PATH' to point to the directory of your choosen
# python interpreter.
set -e
@cpelley
cpelley / masked_transpose_bug.ipynb
Created March 29, 2016 17:17
numpy masked array transpose bug
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cpelley
cpelley / svn_merge_vimdiff.sh
Last active October 13, 2016 07:18
svn diff (vimdiff)
#!/bin/sh
# Add the following to the [helpers] section of ~/.subversion/config
# merge-tool-cmd = /path/to/svn_merge_vimdiff.sh
BASE=${1}
THEIRS=${2}
MINE=${3}
MERGED=${4}
WCPATH=${5}
@cpelley
cpelley / svn_vimdiff.sh
Last active April 21, 2017 15:13
svn conflcit resolution (vimdiff + graphical diff)
#!/bin/sh
# Configure your favorite diff program here.
DIFF="/usr/bin/vimdiff"
# Subversion provides the paths we need as the sixth and seventh
# parameters.
LEFT=${6}
RIGHT=${7}
# Call "svn diff --force" to end up here with binary files.
{
"metadata": {
"name": "",
"signature": "sha256:05f4a43c46ca589337d846930f349fcde8b87fa125b344c972943419fd6f2999"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cpelley
cpelley / confirm
Last active November 4, 2016 08:44
Commandline utility to request confirmation before running a command.
#!/bin/sh
# Function to verify user want to run the commant.
#
# Add this file to your PATH to make available and ensure that it has
# executable privileges.
#
# Example usage:
# confirm && <command>
# http://stackoverflow.com/questions/3231804/in-bash-how-to-add-are-you-sure-y-n-to-any-command-or-alias