Skip to content

Instantly share code, notes, and snippets.

package java8tests ;
import java.util.function.BiFunction ;
import java.util.function.Function ;
public class Currying {
public void currying() {
// Create a function that adds 2 integers
BiFunction<Integer,Integer,Integer> adder = ( a, b ) -> a + b ;
@Grapes(
@Grab(group='org.joda', module='joda-money', version='0.9')
)
import org.joda.money.*
def $(amount) {
CurrencyUnit usd = CurrencyUnit.of("USD");
Money.of(usd, amount);
}
@bodiam
bodiam / gist:8415239
Created January 14, 2014 08:55
Spring annotation configuration bean scanning
@Configuration
@ComponentScan(
value = "com.actions",
includeFilters = @ComponentScan.Filter(value = ActionBean.class)
)
public class ApplicationConfiguration {
public static void main(String[] args) {
final AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(ApplicationConfiguration.class);
final OrderAction bean = annotationConfigApplicationContext.getBean(OrderAction.class);
@bodiam
bodiam / install.sh
Created January 20, 2014 19:01
Install Django 1.6.1 using virtual env wrapper
sudo apt-get install python3-pip
sudo pip3 install virtualenvwrapper
export WORKON_HOME=~/Envs
mkdir -p $WORKON_HOME
source /usr/local/bin/virtualenvwrapper.sh
mkvirtualenv quotes
workon quotes
@bodiam
bodiam / semantic-ui.html
Created January 20, 2014 20:20
semantic-ui example
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.12.0/css/semantic.min.css">
</head>
<body>
<div class="ui buttons">
<div class="ui button">Cancel</div>
<div class="or"></div>
<div class="ui positive button">Save</div>
</div>
@bodiam
bodiam / semantic-ui-formatting.html
Created January 20, 2014 20:24
Semantic ui with formatting
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Open+Sans:300italic,400,300,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.12.0/css/semantic.min.css">
<link rel="stylesheet" type="text/css" href="http://semantic-ui.com/stylesheets/semantic.css">
</head>
<body id="example" class="button">
<div class="ui buttons">
<div class="ui button">Cancel</div>
@bodiam
bodiam / semantic-ui.com-turned-off.html
Created January 20, 2014 20:44
semantic-ui with semantic-ui.com website turned off.
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Open+Sans:300italic,400,300,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.12.0/css/semantic.min.css">
<!--
<link rel="stylesheet" type="text/css" href="http://semantic-ui.com/stylesheets/semantic.css">
-->
</head>
<body id="example" class="button">
@bodiam
bodiam / unstyledtopmenu.html
Created January 20, 2014 21:12
Unstyled top menu
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Open+Sans:300italic,400,300,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.12.0/css/semantic.min.css">
<!--
<link rel="stylesheet" type="text/css" href="http://semantic-ui.com/stylesheets/semantic.css">
-->
</head>
<body id="example" class="button">
@bodiam
bodiam / file.adoc
Last active July 5, 2016 13:58
Output of ./gradlew bestbooks-export:dependencies
testCompileOnly - Compile dependencies for source set 'test'.
+--- project :bestbooks-core
|    +--- org.springframework.boot:spring-boot-starter-freemarker: FAILED
|    +--- org.springframework.boot:spring-boot-starter-web: FAILED
|    +--- org.springframework.boot:spring-boot-devtools: FAILED
|    +--- org.springframework.boot:spring-boot-starter-actuator: FAILED
|    +--- org.springframework.boot:spring-boot-starter-undertow: FAILED
|    +--- org.springframework.boot:spring-boot-starter-security: FAILED
|    +--- org.springframework.boot:spring-boot-starter-data-jpa: FAILED

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.