Skip to content

Instantly share code, notes, and snippets.

View mstine's full-sized avatar

Matt Stine mstine

View GitHub Profile
@mstine
mstine / conc.go
Created February 24, 2014 22:38
Go port of NAV calculation from Ch. 2 of Programming Concurrency on the JVM
package main
import (
"bufio"
"errors"
"fmt"
"net/http"
"os"
"strconv"
"strings"
@mstine
mstine / main.go
Created April 29, 2014 18:54
Broken...but why?
package main
import (
"fmt"
"private/point/point"
)
func main() {
//tag::NewPoint[]
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUcedI6ZmwPIOcH9qfRxrKOy+OqHXxREanrMaT19ta3cdCNr+QVaq8eeENtQdNzUW1TpNeru6/JUdoNffNr2udX9S7GiFGzDq43ChA3u2b2Gh4aOs89G6ZL+3DTYQurEfAbtsFvMSwR0ooca494tYXu29lie39OBaw3isjc25wIEqKpmQtvUoKB7XgEP9sbOO4srGppVGWgKZRnEiCfvxPi7l2Ol7Je9grxLv8W6yyPZq9cWiVFMf7B6XyldPrPLbvu4DfKCXVRgMYQKt8GinKCyaU+hq/aVbUoOkupaM79Rv9+VqkuP7qraBHxZMRqYLUuDctC4hg/VgMk34DTbIv mstine@mstine-mbp.local
@mstine
mstine / gist:6c8f672c02b367b3a980
Last active August 29, 2015 14:22
Try making FortuneService in fortune-teller-ui look like this:
@HystrixCommand(fallbackMethod = "fallbackFortune", commandProperties = {
@HystrixProperty(name = "circuitBreaker.errorThresholdPercentage", value = "20")
})
public Fortune randomFortune() {
return restTemplate.getForObject("http://fortunes/random", Fortune.class);
}
@mstine
mstine / gist:ffd856b6bdbaca59540c
Last active August 29, 2015 14:23
Some ltc commands for Spring Cloud Demos
# Deploy RabbitMQ
ltc create rabbit rabbitmq:3-management -r -p 5672,15672 -M 5672 -m 512
# Deploy Spring Cloud Config Server
ltc create config-server mstine/config-server --memory-mb=512 -e SPRING_CLOUD_CONFIG_SERVER_GIT_URI=https://github.com/pieterhumphrey/config-repo -p 8888
# Deploy Netflix OSS Eureka via Spring Cloud Netflix
ltc create eureka mstine/eureka --memory-mb=512 -p 8761
# Deploy Config Server Client Demo App
@mstine
mstine / deepsouthcloud.yml
Created July 7, 2015 01:12
p-runtime configs for deepsouthcloud
---
name: deepsouthcloud
iaas_type: vsphere
vm_shepherd_configs:
- vcenter_creds:
ip: 192.168.0.11
username: root
password: *********
vsphere:
host: vcenter
@mstine
mstine / gist:b72764c0771f99f48f9a
Created July 7, 2015 15:14
Install script for OpsMan and ERT
#!/bin/bash
bundle exec rake "opsmgr:destroy[deepsouthcloud]"
bundle exec rake "opsmgr:install[deepsouthcloud,$2]"
bundle exec rake "opsmgr:add_first_user[deepsouthcloud,$1]"
bundle exec rake "opsmgr:microbosh:configure[deepsouthcloud,$1]"
bundle exec rake "opsmgr:product:upload_add[deepsouthcloud,$1,$3,cf]"
bundle exec rake "ert:configure[deepsouthcloud,1.5,1.5]"
bundle exec rake "opsmgr:trigger_install[deepsouthcloud,1.5,240]"
@mstine
mstine / gist:5385b4015b60cd3de9a4
Last active August 29, 2015 14:26
Sleuth Log Lines
015-07-31 15:54:55.614 INFO 74602 --- [spring-cloud-sleuth-trace=47ca767b-468c-401e-91f4-2a6d4fe13e25,span=a4bacde0-a9fc-4fdd-95ff-f860b59fe584] [nio-3380-exec-1] o.s.c.sleuth.slf4j.Slf4jSpanListener : Starting span: MilliSpan(begin=1438376095611, end=0, name=http/, traceId=47ca767b-468c-401e-91f4-2a6d4fe13e25, parents=[], spanId=a4bacde0-a9fc-4fdd-95ff-f860b59fe584, remote=false, kVAnnotations={}, processId=null, timelineAnnotations=[TimelineAnnotation(time=1438376095613, msg=start)])
2015-07-31 15:54:56.235 INFO 74602 --- [spring-cloud-sleuth-trace=47ca767b-468c-401e-91f4-2a6d4fe13e25,span=31279ad5-754a-4808-a8ee-491cb87792f6] [nio-3380-exec-2] o.s.c.sleuth.slf4j.Slf4jSpanListener : Starting span: MilliSpan(begin=1438376096235, end=0, name=http/hi2, traceId=47ca767b-468c-401e-91f4-2a6d4fe13e25, parents=[a4bacde0-a9fc-4fdd-95ff-f860b59fe584], spanId=31279ad5-754a-4808-a8ee-491cb87792f6, remote=false, kVAnnotations={}, processId=null, timelineAnnotations=[TimelineAnnotation(time=1438376096235, msg=s
@mstine
mstine / gist:e086fad2f1b61de4634e
Created August 5, 2015 21:52
receptor client + basic auth
@Bean
public ReceptorClient receptorClient() {
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(
new AuthScope(receptorUri, 80),
new UsernamePasswordCredentials(receptorUser, receptorPassword)
);
CloseableHttpClient httpClient = HttpClients.custom()
.setDefaultCredentialsProvider(credentialsProvider)
import org.codehaus.groovy.grails.plugins.springsecurity.Secured
@Secured(['ROLE_ADMIN'])
class ProductController {
//...
}
@Secured(['ROLE_ADMIN'])
def create = {