Skip to content

Instantly share code, notes, and snippets.

View massie's full-sized avatar

Matt Massie massie

  • UC Davis Medical Center
  • Sacramento, CA
  • 23:32 (UTC -07:00)
View GitHub Profile
@massie
massie / gist:378eb305ab68602c6ac3907f38f02418
Created April 26, 2020 14:49
Code for pulling in CA Data from CHHS Open Data
url = 'https://data.chhs.ca.gov/dataset/6882c390-b2d7-4b9a-aefa-2068cee63e47/resource/6cd8d424-dfaa-4bdd-9410-a3d656e1176e/download/covid19data.csv'
states = pd.read_csv(url,
header=0,
names=["state", "date","positive"],
usecols=['date', 'state', 'positive'],
parse_dates=['date'],
index_col=['state', 'date'],
squeeze=True).sort_index()
# You'll also need to set cutoff = 1 for calls to prepare_cases and catch empty sequences
@massie
massie / gist:6b01965dc35e31321164
Created March 23, 2016 20:55
Hormone DOT file
// Hormone graph
digraph G {
//rankdir=LR;
node[color="green"];
GH; FSH; LH; TSH;Melatonin;ACTH;OX;ADH;ENDOR;PRO;CALCI;PTH;ANP;THYM;INS;SOM;GLU;
node[shape="plaintext"];
H;AP;PP;G;T;KIDNEY;AC;BM;PG;AM;BMa;PT;B;HEART;URINE;Thymus;TCELL;PAN;UTERUS;MAMMARY;IMMUNE;
node[shape="oval",color="black"];
BMa[label="Bone Marrow"];
H [label="Hypothalamus"];
@massie
massie / commiters.txt
Created February 24, 2016 00:28
Committers to ADAM over the last year
$ git log --since=2015-01-01 --pretty=format:"%an" | sort | uniq
Allen Day
Andrew Chen
Anton Stamov
Arun Ahuja
Audrey Musselman-Brown
Beau Norgeot
Bryan Jacobs
Eric
Eric Tu
Verifying I am +massie on my passcard. https://onename.com/massie
@massie
massie / gist:72209a3c15166eb4511f
Created September 12, 2014 23:00
Scala SHA-1 Example
package example
import java.io.FileInputStream
import java.security.MessageDigest
object Sha1Example {
def main(args: Array[String]): Unit = {
val start = System.currentTimeMillis()
val sha1 = MessageDigest.getInstance("SHA1")
val bytes = new Array[Byte](1024 * 1024)
@massie
massie / KryoRegistrator.scala
Created October 29, 2013 23:59
Here's an example of how to embed Avro objects into a Kryo stream. You only need to register each Avro Specific class in the KryoRegistrator using the AvroSerializer class below and you're ready to go.
/*
* Copyright (c) 2013. Regents of the University of California
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@massie
massie / AvroSerializable.scala
Last active May 23, 2016 19:10
A simple Scala class that wraps Avro Generic and Specific objects to make them "Serializable".
package com.zenfractal
import org.apache.avro.generic.{GenericDatumWriter, GenericDatumReader, IndexedRecord}
import java.io.{ObjectOutputStream, IOException, ObjectInputStream}
import org.apache.avro.specific.{SpecificDatumWriter, SpecificRecordBase, SpecificDatumReader}
import org.apache.avro.Schema
import org.apache.avro.io._
/**
* Makes Avro objects 'Serializable', e.g.
@massie
massie / gist:6302534
Created August 22, 2013 02:26
Spark, Parquet and Avro dependencies
<dependency>
<groupId>org.spark-project</groupId>
<artifactId>spark-core_${scala.version}</artifactId>
<version>0.7.3</version>
</dependency>
<dependency>
<groupId>com.twitter</groupId>
<artifactId>parquet-avro</artifactId>
<version>1.0.0</version>
</dependency>
@massie
massie / CalculateCosts.scala
Created December 13, 2012 00:55
Calculating DynamoDB costs
package edu.berkeley.cs.amplab.carat.dynamodb
import com.amazonaws.services.dynamodb.model.{TableDescription, DescribeTableRequest}
import collection.JavaConversions._
class DynamoDBCostStructure(cp10wu: Double, cp50ru: Double, cpgb: Double) {
private val costPer10WriteUnits: Double = cp10wu
private val costPer50ReadUnits: Double = cp50ru
private val costPerGB: Double = cpgb
private val hoursPerMonth = 24 * 31
@massie
massie / gist:3207745
Created July 30, 2012 15:21
CXF Test Case
import org.apache.cxf.feature.AbstractFeature;
import org.apache.cxf.feature.LoggingFeature;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
import org.junit.Test;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;