Skip to content

Instantly share code, notes, and snippets.

View tomaslin's full-sized avatar

Tomás Lin tomaslin

  • Netflix
  • San Jose, CA
View GitHub Profile
@tomaslin
tomaslin / ValidateSchemaSpec.groovy
Created January 10, 2020 22:21
A spock test that validates schemas
package com.netflix.mce.schemavalidator
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
import com.networknt.schema.JsonSchemaFactory
import com.networknt.schema.SpecVersion
import spock.lang.Shared
import spock.lang.Specification
import spock.lang.Unroll
@tomaslin
tomaslin / ProtoDiff.groovy
Last active March 20, 2019 23:41
Simple diff for shaded proto messages in Java/Grpc
// Usage: diff(Message, OtherMessage).empty
def diff(x, y) {
deepEquals(x.newBuilder().build().getDescriptorForType().fields,
y.newBuilder().build().getDescriptorForType().fields)
}
def deepEquals(List<FieldDescriptor> fields1, List<FieldDescriptor> fields2) {
if (fields1.size() != fields2.size()) {
return ["Missing field between ${fields1*.name} and ${fields2*.name}"]
@tomaslin
tomaslin / versions.md
Last active March 19, 2016 08:16
Latest Netflix Spinnaker Versions

Generated Sat Mar 19 08:16:09 UTC 2016

package version
clouddriver 1.99.0
deck 2.544.0
echo 1.94.0
front50 1.8.0
gate 2.43.0
igor 1.17.0
@tomaslin
tomaslin / gist:96bd8108688ea9308daa
Created November 8, 2014 00:22
Docker calls via Spotify Docker client
@Grapes(
@Grab(group='com.spotify', module='docker-client', version='2.7.0')
)
import com.spotify.docker.client.messages.*
import com.spotify.docker.client.DefaultDockerClient
import com.spotify.docker.client.DockerClient
DockerClient docker = new DefaultDockerClient('myinstace')
@tomaslin
tomaslin / gist:e877b98b353f47167dbe
Created November 7, 2014 22:41
Docker calls with Docker Java client
@Grapes(
@Grab(group='com.github.docker-java', module='docker-java', version='0.10.3')
)
import com.github.dockerjava.api.DockerClient
import com.github.dockerjava.core.DockerClientConfig
import com.github.dockerjava.core.DockerClientBuilder
import com.github.dockerjava.api.command.CreateContainerResponse
DockerClientConfig config = DockerClientConfig.createDefaultConfigBuilder()
@tomaslin
tomaslin / boogerfarts
Created August 1, 2014 16:28
Why u no work
@GrabResolver(name='clojars.org', root='http://clojars.org/repo')
@Grab('redis.embedded:embedded-redis:0.2')
@Grab('redis.clients:jedis:2.2.1')
@Grab('org.apache.ivy:ivy:2.3.0')
import redis.clients.jedis.Jedis
import redis.clients.jedis.JedisCommands
import redis.clients.jedis.JedisPool
import redis.clients.jedis.JedisPoolConfig
import redis.clients.jedis.Protocol
@tomaslin
tomaslin / gist:0f9b07654c51b19b6089
Created June 20, 2014 07:24
force a dependency version
def rxJavaVersion = '0.16.1'
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.netflix.rxjava') {
details.useVersion rxJavaVersion
}
}
}
curl -s get.gvmtool.net | bash
cd ~/.gvm/grails
curl -O -k https://dist.springframework.org.s3.amazonaws.com/milestone/GRAILS/grails-2.4.0.M1.zip
unzip grails-2.4.0.M1.zip
rm grails-2.4.0.M1.zip
gvm install grails 2.4.0.M1 grails-2.4.0.M1
gvm use grails 2.4.0.M1
@tomaslin
tomaslin / Cyclomatic complexity exceeds 20
Last active December 26, 2015 03:59
Cyclomatic complexity weirdness
package com.netflix.asgard
import spock.lang.Specification
import spock.lang.Unroll
@Unroll
class StylerSpec extends Specification {
void 'availability zone to style class'() {
expect:
@tomaslin
tomaslin / gist:6469591
Created September 6, 2013 20:33
Deploy grails on cloudfoundry v2
gvm install grails 2.3.0.RC2
grails create-app testApp
cd testApp
cf login [email protected] --password somethingsomethingsomething
cf push --buildpack=https://github.com/heroku/heroku-buildpack-grails.git