Skip to content

Instantly share code, notes, and snippets.

@wonderb0lt
wonderb0lt / tasty.java
Created December 18, 2014 22:11
Tasty boolean logic!
boolean validip = true;
boolean validts = true;
if (hash.equals(hashIndecoded) && validts && validip) {
return true;
}
return false;
@wonderb0lt
wonderb0lt / assertj.java
Created December 18, 2014 18:52
yay AssertJ
assertThat(authenticationResult)
.hasState(AuthenticationResult.State.SUCCESSFUL)
.hasNoErrors()
.hasAdditionalInformation(Collections.emptyMap());
@wonderb0lt
wonderb0lt / Dockerrun.aws.json
Last active August 29, 2015 14:11
cfn/docker dockerrun
{
"AWSEBDockerrunVersion": 1,
"Image": {
"Name": "some-docker-registry.elasticbeanstalk.com/property-service:latest"
},
"Authentication": {
"Bucket": "docker-artifacts",
"Key": ".dockercfg"
},
"Ports": [
@wonderb0lt
wonderb0lt / docker.sh
Created December 15, 2014 17:53
cfn/docker script
#!/bin/bash
set -e
# Main configuration for docker run. In addition to this, you need to pass "VERSION" as an environment variable.
if [ -z $VERSION ]; then
echo "*** You need to pass VERSION as an environment variable ***"
exit 1
fi
@wonderb0lt
wonderb0lt / common.sh
Created December 15, 2014 17:48
cfn/docker common
#!/bin/sh
set -e
set -x
# This file was originally written by Andreas Mohrhard and used with permission.
copy_context() {
echo "Copying context..."
for f in $CONTEXT; do
if [ ! -f $f ]; then
{"https://index.docker.io/v1/":{"auth":"your_auth","email":"your_mail"}}
{
"Namespace": "aws:elasticbeanstalk:application:environment",
"OptionName": "echoservice.greetingTemplate",
"Value": "Howdy, World!"
}
@wonderb0lt
wonderb0lt / spring-boot-docker-cfn-sample.cfn.json
Created December 15, 2014 17:35
The CFN template for the cfn/docker sample
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Infrastructure for the Spring Boot + Docker + CFN sample",
"Parameters": {
"Version": {
"Type": "String",
"Default": "1.0.0"
}
},
"Resources": {
@wonderb0lt
wonderb0lt / Application.java
Created December 15, 2014 17:33
The Java app for the cfn/docker sample
package lt.wonderb0.example;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
<%@page language="java" pageEncoding="UTF-8"%>
<%@page isErrorPage="true" %>
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Page not found</title>
</head>
<body>