Skip to content

Instantly share code, notes, and snippets.

View throughnothing's full-sized avatar

William Wolf throughnothing

View GitHub Profile

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.
@throughnothing
throughnothing / Java_8_Coding_Guide.md
Last active February 28, 2018 23:23
Java 8 Coding Guide / Principles

Java 8 Coding Guide

This coding guide was written for a Java 8 project, but contains principles that are valid in many languages. It is aimed at producing code that is easy to reason about, easy to validate and test, easy to maintain, and easy to avoid common bugs and pitfalls.

Remember that code is read many more times than it is written! We want to optimize for readability, comprehension, and reduced complexity!

@throughnothing
throughnothing / Card.purs
Last active February 3, 2018 04:39
Deck of things...
module CardDeck
( Card
, CardDeck
, mkCardDeck
, Suit
, Rank
) where
import Prelude (class Eq, class Ord, class Show, ($), bind, pure)
import Data.Generic.Rep.Show (genericShow)
@throughnothing
throughnothing / Line.idr
Created September 19, 2017 06:55
Points which prove they exist on a given line in Idris
module Line
record Line where
constructor MkLine
a, b : Integer
data Point : Type where
MkPoint : (l: Line) -> (x: Integer) -> (y: Integer) -> { auto pr: y = (a l) * x + (b l) } -> Point
pointX : Point -> Integer
@throughnothing
throughnothing / EllipticCurve.idr
Last active August 22, 2018 06:12
Naive attempt at a simple implementation of secp256k1 in Idris
module EllipticCurve
%default total
-- Resources:
-- Bitcoin secp256k1 https://en.bitcoin.it/wiki/Secp256k1
-- SafeCurves: https://safecurves.cr.yp.to/base.html
-- https://github.com/iCHAIT/Elliptical-Curve-Cryptography
-- https://github.com/mfourne/eccrypto/
-- secp256k1 can't ladder? https://safecurves.cr.yp.to/ladder.html
module BlockChain
%default total
data Money = MkMoney Int
record Tx sig addr where
constructor MkTx
txSrc, txDst : addr
txAmount, txFee : Money
txSig : sig
@throughnothing
throughnothing / ParserCombinator.purs
Created April 4, 2017 03:40
Parser Combinator Test
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (log, CONSOLE)
import Control.Plus ((<|>))
import Data.Maybe (Maybe(..))
import Text.Parsing.StringParser (Parser, runParser)
import Text.Parsing.StringParser.Combinators (optionMaybe)
import Text.Parsing.StringParser.String (string)
@throughnothing
throughnothing / scala-type-weirdness.scala
Last active March 15, 2017 22:47
Scala Type Weirdness
object HelloWorld {
def main(args: Array[String]) {
hi('a')
}
def hi(num: Int): Int = {
println("test: " + num)
return num
}
}
@throughnothing
throughnothing / scrape-yelp.js
Last active May 24, 2016 16:57
Yelp Scraper
#!/usr/bin/env node
var Yelp = require('yelp');
var request = require('superagent');
var superagentPromisePlugin = require('superagent-promise-plugin');
var Immutable = require('immutable');
var range = require('node-range');
var yelp = new Yelp({
consumer_key: '',
consumer_secret: '',
@throughnothing
throughnothing / Either.pm
Last active May 6, 2019 15:45
Perl Either
package Either;
use strict; use warnings;
use Exporter qw/import/;
use Function::Parameters;
use syntax qw(try);
use vars qw{$AUTOLOAD};
our @EXPORT = qw/left right either either_try/;
use overload '""' => '_stringify';