Skip to content

Instantly share code, notes, and snippets.

@emersonf
emersonf / s3etag.sh
Last active March 27, 2024 10:11
A Bash script to compute ETag values for S3 multipart uploads on OS X.
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: $0 file partSizeInMb";
exit 0;
fi
file=$1
if [ ! -f "$file" ]; then
@emersonf
emersonf / learn-more-about-mental-health.html
Created March 14, 2017 08:21
Aware app content example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Learn More About Mental Health</title>
</head>
<body>
<h1>Mental Health</h1>
<h2>What Is Mental Health?</h2>
@emersonf
emersonf / PAM.json
Created February 23, 2017 08:25
PAM score mapping
{
"PAM":{
"identifier":"PAMIdentifier",
"prompt":"Select the photo that best captures how you feel right now:",
"summary":{
"identifier":"PAM Summary Identifier",
"title":"Thanks",
"text":"Thank you for participating in PAM"
},
"affects":[
@emersonf
emersonf / gist:4989430
Last active December 13, 2015 23:09
session access in Gatling
import com.excilys.ebi.gatling.core.Predef._
class Foo(val a:Int, val b:Int)
class TestSimulation extends Simulation {
val scn = scenario("testScenario")
.exec(session => session.setAttribute("foo", new Foo(1, 2)))
.exec(session => {
println(session.getAttribute("foo.a"))
@emersonf
emersonf / output.json
Created July 28, 2015 20:23
minute-resolution intraday step data output by Fitbit shim
{
"effective_time_frame": {
"time_interval": {
"start_date_time": "2014-09-10T00:47:00.000Z",
"duration": {
"value": 1,
"unit": "min"
}
}
},
"header": {
"id": "123e4567-e89b-12d3-a456-426655440000",
"creation_time": "2013-02-05T07:25:00Z",
"schema": {
"namespace": "omh",
"name": "calories_burned",
"version": "1.1.RC1"
"code-url": //new suggestion -- to pull out all data indexed with a SNOMED code?
},
"acquisition_provenance": {
@emersonf
emersonf / Application.java
Last active August 29, 2015 14:03
Jackson Joda DateTime serialisation from Spring Boot breaks with DelegatingWebMvcConfiguration
@Configuration
@EnableAutoConfiguration
@ComponentScan("internal.sandbox")
public class Application {
public static void main(String[] args) {
new SpringApplicationBuilder(Application.class).run(args);
}
}
@emersonf
emersonf / Application.java
Created June 17, 2014 06:39
A controller showing unexpected behaviour when URI template variables have regex restrictions.
package internal.sandbox.configuration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
@emersonf
emersonf / build.script.groovy
Last active August 29, 2015 14:02
A Gradle build script for a Spring Boot application.
apply plugin: 'java'
apply plugin: 'maven' // used for deploying artifacts to Maven repositories
apply plugin: 'spring-boot'
group = 'internal'
version = '1.0-SNAPSHOT'
description = ""
sourceCompatibility = 1.7
targetCompatibility = 1.7
@emersonf
emersonf / MultiModeTestController.java
Created May 2, 2014 15:20
A controller that mixes synchronous and asynchronous requests from a single endpoint.
package tv.nativ.mio.publish.common.controller;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;