Skip to content

Instantly share code, notes, and snippets.

View deleted's full-sized avatar

Ted Scharff deleted

View GitHub Profile
@deleted
deleted / input.coffee
Last active December 14, 2015 22:28
I'm starting to think that maybe coffescript is actually okay... I would not have been able to wrap my primitive brain around this regular expression without it's block regex feature.
# An implementation of http://docs.python.org/2/library/string.html#format-specification-mini-language
# WARNING: Not complete.
applyFormat = (value, formatSpec) ->
pattern = ///
([^{}](?=[<>=^]))?([<>]^)? # fill & align
([\+\-\x20])? # sign
(\#)? # integer base specifier
(0)? # zero-padding
(\d+)? # width
# Create a deep copy of an object. - Based on https://github.com/documentcloud/underscore/pull/595
deepClone = (obj) ->
if !_.isObject obj or _.isFunction obj then return obj
if _.isDate obj then return new Date do obj.getTime
if _.isRegExp obj then return new RegExp obj.source, obj.toString().replace(/.*\//, "")
isArr = _.isArray obj or _.isArguments obj
func = (memo, value, key) ->
if isArr then memo.push deepClone value
@deleted
deleted / moon.py
Last active December 10, 2015 00:29
from datetime import date
def phase(m, d, y):
ref_date = date(2012, 1, 23)
our_date = date( y, m, d )
date_delta = our_date - ref_date
days = date_delta.days
phase_length = 29.53
return days % phase_length / phase_length
@deleted
deleted / mapproxy.yaml
Created December 11, 2012 21:43
Semi-working mapproxy config file
services:
demo:
#kml:
tms:
# needs no arguments
wms:
# srs: ['EPSG:4326', 'EPSG:900913']
image_formats: ['image/jpeg', 'image/png']
md:
# metadata used in capabilities documents
@deleted
deleted / .gitignore
Created July 8, 2011 19:43
quick and dirty azilink client script
*swp
moon/apollo/audio/a11/plaque.mp3
moon/apollo/audio/a15/a15a1065723.mp3
moon/apollo/image_archive/Apollo/a11/A11_MP.SampleDoc2FS.gif
moon/apollo/image_archive/Apollo/a11/A11_MP.SampleDoc2FS.jpg
moon/apollo/image_archive/Apollo/a11/AS11-40-5850HR.jpg
moon/apollo/image_archive/Apollo/a11/AS11-40-5875HR.jpg
moon/apollo/image_archive/Apollo/a11/AS11-40-5877HR.jpg
moon/apollo/image_archive/Apollo/a11/AS11-40-5899HR.jpg
moon/apollo/image_archive/Apollo/a11/AS11-40-5907HR.jpg
moon/apollo/image_archive/Apollo/a11/AS11-40-5916HR.jpg
import sys, os
import optparse
import glob
import json
import time
import zipfile
import kmlengine
import kmldom
from kmlengine import Bbox
// __BEGIN_LICENSE__
// Copyright (C) 2006-2010 United States Government as represented by
// the Administrator of the National Aeronautics and Space Administration.
// All Rights Reserved.
// __END_LICENSE__
#include <vw/Plate/PlateFile.h>
#include <vw/Plate/TileManipulation.h>
using namespace vw;
@deleted
deleted / isis.sh
Created February 16, 2011 02:14
Sets up the requisite environment variables to run an ISIS command
#!/bin/bash
###
# Execute an isis command in a shell with the necessary
# environment variables set.
###
NEBULA_ISIS_ROOT="/big/packages/isis3/isis"
LOCAL_ISIS_ROOT="${HOME}/apps/isis3"
#!/usr/bin/env python
import sys, os, os.path
import subprocess
from subprocess import Popen, PIPE
import shlex
import traceback
import urlparse
import urllib
DEFAULT_TMP_DIR = '/scratch/tmp'