Skip to content

Instantly share code, notes, and snippets.

View deleted's full-sized avatar

Ted Scharff deleted

View GitHub Profile
from amqplib import client_0_8 as amqp
from amq_config import connection_params
import logging
logger = logging.getLogger()
DEFAULT_EXCHANGE = 'ngt.direct'
# Open the connection to RabitMQ
connection = ampq.Connection(**connection_params)
class AmqpServiceWrapper(object):
'''
A wrapper class that takes care of the business of initialization:
- Creates an RpcChannel with the given parameters
- Instantiates a protobuf service of the given class
- Delegats further attribute access to the Service instance.
'''
class ParameterMissing(Exception):
pass
def CallMethod(self, method_descriptor, rpc_controller,
request, response_class, done):
"""Calls the method identified by the descriptor.
Call the given method of the remote service. The signature of this
procedure looks the same as Service.CallMethod(), but the requirements
are less strict in one important way: the request object doesn't have to
be of any specific class as long as its descriptor is method.input_type.
"""
rpc_controller.Reset()
def sizeof_human(numbytes):
''' Human-readable size strings '''
assert numbytes >= 0
for x in ['bytes','KB','MB','GB','TB','PB']:
if numbytes < 1024.0:
return "%3.2f%s" % (numbytes, x)
numbytes /= 1024.0
else:
return "Exabytes!"
def sizeof_human(numbytes):
''' Human-readable size strings '''
if numbytes < 0: # urlretrieve passes -1 for totalsize if it can't get the filesize from the server
return '???'
for x in ['bytes','KB','MB','GB','TB','PB']:
if numbytes < 1024.0:
return "%3.2f%s" % (numbytes, x)
numbytes /= 1024.0
else:
#!/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'
@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"
// __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;
import sys, os
import optparse
import glob
import json
import time
import zipfile
import kmlengine
import kmldom
from kmlengine import Bbox
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