Skip to content

Instantly share code, notes, and snippets.

Cory Zue czue

Block or report user

Report or block czue

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@czue
czue / hq-todos.txt
Created Nov 14, 2017
HQ TODOs (with blame)
View hq-todos.txt
corehq/apps/accounting/bootstrap/utils.py ::
corehq/apps/accounting/forms.py ::
corehq/apps/accounting/models.py ::
corehq/apps/accounting/payment_handlers.py ::
corehq/apps/accounting/static/accounting/js/invoices.js ::
15a3bebbd8c (Daniel Roberts 2016-06-29 17:51:44 -0400 12) // todo: use a more specific identifier to make less brittle
corehq/apps/accounting/subscription_changes.py ::
corehq/apps/accounting/tests/test_invoicing.py ::
corehq/apps/analytics/ab_tests.py ::
f35a49c480f (Biyeun Buczyk 2016-07-06 18:12:26 -0400 29) version = random.sample(self.options, 1)[0] # todo weighted options
@czue
czue / git_grep_blame.sh
Created Nov 14, 2017
A little bash script for git blaming things matching git grep
View git_grep_blame.sh
#!/bin/bash
# usage: ./git_grep_blame.sh todo
# HT: https://stackoverflow.com/a/43664756/8207
if [ "$1" = "" ] ; then
echo "usage: $0 <term>" 1>&2
exit 1
fi
@czue
czue / json_tags.py
Last active Nov 14, 2019
A simple django template tag that lets you automatically render json from a python object
View json_tags.py
"""
Usage:
{% load json_tags %}
var = myJsObject = {{ template_var|to_json }};
Features:
- Built in support for dates, datetimes, lazy translations.
View kafka-migration.md

Kafka Migration

Problem statement

We need to migrate Kafka from one machine to the other, ideally with 0 downtime.

Planned solution

  1. Spin up the new kafka environment
  2. Publish changes from production to both environment in parallel
  3. Confirm new environment is working
  4. Flip a pointer for the feeds that run off kafka
View touchforms.log
INFO 2015-07-21 10:33:33,855 xformserver 31567 159 Received action answer
INFO 2015-07-21 10:33:34,095 xformserver 31567 161 Received action submit-all
INFO 2015-07-21 10:33:34,250 xformserver 31567 162 Received action answer
INFO 2015-07-21 10:33:34,313 xformserver 31567 163 Received action answer
INFO 2015-07-21 10:33:35,819 xformserver 31567 164 Received action answer
INFO 2015-07-21 10:33:37,506 xformserver 31567 165 Received action answer
INFO 2015-07-21 10:33:40,344 xformserver 31567 166 Received action answer
INFO 2015-07-21 10:33:46,963 xformserver 31567 167 Received action answer
INFO 2015-07-21 10:33:46,996 xformserver 31567 168 Received action answer
INFO 2015-07-21 10:33:47,713 xformserver 31567 169 Received action answer
@czue
czue / gist:6082293
Created Jul 25, 2013
hq log config
View gist:6082293
# MIN_LOG_LEVEL = 'DEBUG'
MIN_LOG_LEVEL = 'INFO'
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'simple': {
@czue
czue / gist:5823792
Created Jun 20, 2013
Test Failures
View gist:5823792
======================================================================
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)
@czue
czue / prof.py
Created Feb 13, 2013
profile analysis utilitiy
View prof.py
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 Dec 12, 2015
Script to remove potentially duplicate counts from wisepill data.
View aremind_wisepill_calc.py
"""
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 Nov 21, 2012
simple profiling script
View prof.py
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
You can’t perform that action at this time.