Skip to content

Instantly share code, notes, and snippets.

View adam704a's full-sized avatar

Adam Preston adam704a

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version last-->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Treatment Report" language="groovy" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="752" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" >
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Local NTD Envision"/>
<template><![CDATA[$P{isLocal} ? "styles/ntd_style.jrtx" : "repo:/reports/styles/ntd_style"]]></template>
<style name="Treatment Row" mode="Opaque" backcolor="#FFFFFF" >
<conditionalStyle>
<conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
<style backcolor="#DBFBFB"/>
</conditionalStyle>
@adam704a
adam704a / gist:4731454
Created February 7, 2013 15:02
Using Sendgrid.
/*
Uses sendgrid to send out system generated emails. Check out Sendgrid.com
*/
function sendgrid_email($subject, $to_emails, $content, $category){
if (isDebugEnabled(1)) {
logMessage("applicationlib.sendgrid_email: sending email with subject $subject with a size " . count($to_emails) );
}
@adam704a
adam704a / gist:5172952
Created March 15, 2013 20:40
Transforming data from a jqxDataAdapter
var dataAdapter = new jQuery.jqx.dataAdapter(source, {
autoBind: true,
loadComplete: function (records) {
//show the export
jQuery("#export_dropdown_list").jqxDropDownList({ width: '200px', height: '18px', theme: cp_theme });
jQuery("#export_dropdown_list").jqxDropDownList('loadFromSelect', 'exporter_source');
jQuery("#export_dropdown_list").jqxDropDownList({selectedIndex: 0});
jQuery("#exportButton").show();
},
@adam704a
adam704a / mobilefs.yaml
Last active August 29, 2015 14:21
MobileFS Yaml
id: START
type: TEXT
text: "[THE HOUSEHOLD SCREENING RESPONDENT MUST BE 18 YEARS OF AGE OR OLDER AND YOU MUST BE CONFIDENT THAT THIS PERSON CAN PROVIDE ACCURATE INFORMATION ABOUT ALL MEMBERS OF THE HOUSEHOLD. <p> IF NEEDED, VERIFY THE AGE OF THE HOUSEHOLD SCREENING RESPONDENT TO MAKE SURE HE/SHE IS 18 YEARS OF AGE OR OLDER.]"
next: INTRO
---
id: INTRO
type: NUM
text: How old are you? <P>[ENTER NUMBER]<P>[ENTER 98 FOR DON'T KNOW][ENTER 99 FOR REFUSED]
range: 0-97
next: INTRO1
@adam704a
adam704a / export-bar.py
Last active August 29, 2015 14:22
save tweet text to file
from pymongo import MongoClient
import datetime, time, string
import codecs
import itertools
#c = MongoClient()
c = MongoClient("mongodb://[put your user name here]:[put your password here]@sif.rtp.rti.org")
db = c.mj_tweets
collection = db.mj_sample
# year,month, day, hour
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Use the API to create some test data\n"
]
},
{
@adam704a
adam704a / The Great Tweet Migration.ipynb
Last active June 5, 2018 12:34
The Great Tweet Migration
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adam704a
adam704a / firstio.md
Last active March 30, 2017 22:59
JIRA at RCD

A First Level Header

A Second Level Header

Now is the time for all good men to come to the aid of their country. This is just a regular paragraph.

@adam704a
adam704a / export.sh
Last active October 8, 2018 21:13
export postgres query to s3 as CSV
#!/bin/sh
psql -h localhost hhis -U hhis -c "\copy (SELECT * FROM _view_events) to './dhis2-export.tsv' WITH NULL AS ''"
aws s3 cp dhis2-export.tsv s3://spla-dhis2/dhis2-export.tsv
@adam704a
adam704a / export-overwrite.sh
Last active October 6, 2017 21:06
export a sql view to s3
DATE_WITH_TIME=`date "+%Y%m%d"`
psql -h localhost dhis2 -c "\copy (SELECT * FROM _view_analytics) to './dhis2-export.tsv' WITH NULL AS ''"
aws s3 cp dhis2-export.csv s3://stoppalu-dhis2