Skip to content

Instantly share code, notes, and snippets.

View czue's full-sized avatar

Cory Zue czue

View GitHub Profile
/*
The below work is licensed under Creative Commons GNU LGPL License.
Original work:
License: http://creativecommons.org/licenses/LGPL/2.1/
Author: Stefan Goessner/2006
Web: http://goessner.net/
Modifications made:
/*
The below work is licensed under Creative Commons GNU LGPL License.
Original work:
License: http://creativecommons.org/licenses/LGPL/2.1/
Author: Stefan Goessner/2006
Web: http://goessner.net/
Modifications made:
from django.test.simple import DjangoTestSuiteRunner
from django.conf import settings
from couchdbkit.ext.django import loading as loading
from couchdbkit.resource import ResourceNotFound
class CouchDbKitTestSuiteRunner(DjangoTestSuiteRunner):
"""
A test suite runner for couchdbkit. This offers the exact same functionality
as the default django test suite runner, except that it connects all the couchdbkit
django-extended models to a test database. The test database is deleted at the
from django import template, get_version
register = template.Library()
if get_version() < '1.2':
@register.simple_tag
def csrf_token():
return ""
@czue
czue / gist:1220420
Created September 15, 2011 20:42
Fabfile calling 7zip on windows
from datetime import datetime
from subprocess import Popen, PIPE, call
from fabric.api import *
from fabric.contrib.console import confirm
# use this instead of os.path.join since remote OS might differ from local
PATH_SEP = "/"
env.user = 'czue'
env.hosts = ['czue.org']
@czue
czue / prof.py
Created September 27, 2011 13:17
Simple Profiling Stats Outputter
import hotshot.stats
import sys
DEFAULT_LIMIT = 200
def profile(filename, limit=DEFAULT_LIMIT):
print "loading profile stats for %s" % filename
stats = hotshot.stats.load(filename)
# normal stats
@czue
czue / prof.py
Created November 21, 2012 20:37
simple profiling script
import hotshot.stats
import sys
DEFAULT_LIMIT = 200
def profile(filename, limit=DEFAULT_LIMIT):
print "loading profile stats for %s" % filename
stats = hotshot.stats.load(filename)
# normal stats
@czue
czue / aremind_wisepill_calc.py
Last active December 12, 2015 00:38
Script to remove potentially duplicate counts from wisepill data.
"""
Script usage:
The script currently assumes the existence of two files and of specific formats.
dataforwisepillcalculation.csv - a list of patient ids and visit times
wisepill.csv - the full log of wisepill openings
It outputs a single file:
adherence.csv - the patients' adherence scores over each of the visit periods
@czue
czue / prof.py
Created February 13, 2013 19:14
profile analysis utilitiy
import hotshot.stats
import sys
DEFAULT_LIMIT = 200
def profile(filename, limit=DEFAULT_LIMIT):
print "loading profile stats for %s" % filename
stats = hotshot.stats.load(filename)
# normal stats
@czue
czue / gist:5823792
Created June 20, 2013 15:32
Test Failures
======================================================================
ERROR: testOTARestoreMultiple (casexml.apps.case.tests.test_multimedia.CaseMultimediaTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "./submodules/casexml-src/casexml/apps/case/tests/test_multimedia.py", line 186, in testOTARestoreMultiple
self._validateOTARestore(TEST_CASE_ID, restore_attachments)
File "./submodules/casexml-src/casexml/apps/case/tests/test_multimedia.py", line 190, in _validateOTARestore
case_xml = case.to_xml(V2)
File "./submodules/casexml-src/casexml/apps/case/models.py", line 797, in to_xml
elem = get_case_element(self, ('create', 'update'), version)