Skip to content

Instantly share code, notes, and snippets.

Luke Hoban lukehoban

View GitHub Profile
@lukehoban
lukehoban / lambda_test.go
Created Feb 25, 2020
Untyped Lambda Calculus, Chruch Numerals, Y Combinator in Golang
View lambda_test.go
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
type V func(v V) V
@lukehoban
lukehoban / waitForJob.ts
Last active Mar 24, 2020
Pulumi program which waits on Jobs during a Kubernetes deployment
View waitForJob.ts
import * as pulumi from "@pulumi/pulumi";
import * as k8s from "@pulumi/kubernetes";
import * as k8sOutput from "@pulumi/kubernetes/types/output";
import * as k8sapi from 'kubernetes-client';
const job = new k8s.batch.v1.Job("job", {
spec: {
template: {
spec: {
containers: [{
@lukehoban
lukehoban / index.ts
Created Jun 20, 2019
Passing credentials to a Pulumi dynamic provider
View index.ts
import * as splunk from "./splunk"
async function getSecretValue(): Promise<string> {
return "abcd"
}
getSecretValue().then(secret => {
splunk.setAuth(secret);
new splunk.SavedSearch("foo", {});
});
@lukehoban
lukehoban / index.ts
Last active May 31, 2020
Simple Aurora Serverless + Lambda VPC example with Pulumi
View index.ts
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";
import * as random from "@pulumi/random";
// Construct a VPC
const vpc = new awsx.ec2.Vpc("vpc");
// Create an Aurora Serverless MySQL database
const dbsubnet = new aws.rds.SubnetGroup("dbsubnet", {
View managedkubernetes.ts
import * as awsx from "@pulumi/awsx";
import * as eks from "@pulumi/eks";
import * as k8s from "@pulumi/kubernetes";
// Create an AWS VPC and EKS cluster
const vpc = new awsx.Vpc("vpc", { usePrivateSubnets: false });
const cluster = new eks.Cluster("cluster", {
vpcId: vpc.vpcId,
subnetIds: vpc.subnetIds,
});
@lukehoban
lukehoban / apigatewaydomain.ts
Last active Jan 27, 2019
API Gateway Domain Mapping in Pulumi
View apigatewaydomain.ts
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// The services we want to host on our domain...
const api1 = new aws.apigateway.x.API("api1", {
routes: [
{method: "GET", path: "/", eventHandler: async(ev) => {
return {
statusCode: 200,
body: JSON.stringify({hello: "world"}),
@lukehoban
lukehoban / thumbnailer.js
Created Jun 18, 2018
Serverless + Containers with Pulumi
View thumbnailer.js
const cloud = require("@pulumi/cloud-aws");
const aws = require("@pulumi/aws");
// A bucket to store videos and thumbnails.
const bucket = new cloud.Bucket("bucket");
const bucketName = bucket.bucket.id;
// A task which runs a containerized FFMPEG job to extract a thumbnail image.
const ffmpegThumbnailTask = new cloud.Task("ffmpegThumbTask", {
build: "./docker-ffmpeg-thumb",
@lukehoban
lukehoban / helloworld.js
Created Jun 18, 2018
A simple Pulumi program
View helloworld.js
const cloud = require("@pulumi/cloud-aws");
const endpoint = new cloud.API("hello");
endpoint.static("/", "www");
endpoint.get("/source", (req, res) => res.json({name: "AWS"}));
exports.url = endpoint.publish().url;
View expression.str
interface IHashtable
{
double lookup(string i);
void set(string i, double d);
}
class Hashtable()
{
var o = {};
View ClosureCompiler.svc.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Activation;
using System.Net;
using System.IO;
using System.Web;
You can’t perform that action at this time.