Skip to content

Instantly share code, notes, and snippets.

View fieldju's full-sized avatar

Justin Field fieldju

View GitHub Profile
@fieldju
fieldju / SignalFlowConverter.java
Last active September 21, 2018 18:48
SignalFx SignalFlow Retrofit Converter
/*
* Copyright (c) 2018 Nike, inc.
*
* 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
@fieldju
fieldju / goovy-script-template.groovy
Created June 27, 2018 16:16
A groovy script template with grapes
#!/usr/bin/env groovy
import com.caseyscarborough.colorizer.Colorizer
/**
* The dependencies
*/
@Grapes([
@Grab(group='com.caseyscarborough.colorizer', module='groovy-colorizer', version='1.0.0')
])
#!/bin/bash
########################################################################################################
# Script for re-releasing tagged measured releases under the new name measured-core
# and deprecating the measured release.
########################################################################################################
function publish {
tag=$1
npm publish --tag measured-legacy || echo "Failed to publish measured-core v${tag}"
#!/usr/bin/env python3
import boto3
import base64
import json
import argparse
import requests
def get_token(url, account_id, name, region):
@fieldju
fieldju / ServiceToServiceAuthenicationPOC.groovy
Created January 14, 2016 03:49
POC for public private service to service auth mechinism
import groovy.json.JsonBuilder
import org.joda.time.DateTime
import org.joda.time.DateTimeZone
import org.joda.time.format.DateTimeFormatter
import org.joda.time.format.ISODateTimeFormat
import java.security.KeyPair
import java.security.KeyPairGenerator
import java.security.PrivateKey
import java.security.PublicKey
import com.amazonaws.auth.BasicAWSCredentials
import com.amazonaws.internal.StaticCredentialsProvider
import com.amazonaws.services.kms.AWSKMSClient
import com.amazonaws.services.kms.model.EncryptRequest
import groovy.json.JsonBuilder
import groovy.transform.Field
import groovyx.net.http.HTTPBuilder
import org.joda.time.DateTime
import org.joda.time.DateTimeZone
import org.joda.time.format.DateTimeFormatter
@fieldju
fieldju / iamPoc.groovy
Last active December 4, 2015 17:10
A poc groovy script showing possible flow for AWS IAM role based auth backend
import com.amazonaws.Request
import com.amazonaws.auth.AWS4Signer
import com.amazonaws.auth.BasicSessionCredentials
import com.amazonaws.http.HttpMethodName
import com.amazonaws.internal.EC2MetadataClient
import com.amazonaws.services.securitytoken.model.AssumeRoleRequest
import com.amazonaws.services.securitytoken.model.transform.AssumeRoleRequestMarshaller
import com.amazonaws.util.json.Jackson
import groovyx.net.http.*
@fieldju
fieldju / gist:4506747
Created January 10, 2013 23:39
vagrant while connected to vpn
jfield@fieldju-~/Development/GIT Projects/abops-15:30:45> vagrant up
rm -rf cfengine
cp -r policies/cf-sketch-runfile.cf policies/controls policies/core policies/def.cf policies/failsafe policies/failsafe.cf policies/highlander policies/libraries policies/policy_server policies/services cfengine/masterfiles
Reading dev_projects.conf
Found project download mapped to port 9090.
Found project fly-download-mobile mapped to port 9091.
[default] VM already created. Booting if it's not already running...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
@fieldju
fieldju / tace.txt
Created November 21, 2012 17:07
stack trace
[12-11-21 09:06:23.785] {http://*:8080-6} SessionImpl[aaajIarWqykyq-pKw5JSt,/rb-foreman]: can't serialize session
java.io.NotSerializableException: cnwk.foreman.service.ForemanDaoImpl$$EnhancerByCGLIB$$be119208
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at
@fieldju
fieldju / search.java
Created November 13, 2012 19:37
abstract scoped entity search for reviews that need to be published
public List<EditorialReview> getReviewsToBePublished() {
final AbstractScopedEntitySearch<EditorialReview> search =
new AbstractScopedEntitySearch<EditorialReview>() {
@Override
protected Class<EditorialReview> getType() {
return EditorialReview.class;
}
@Override
public String getQueryString() {