This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.io.OutputStream; | |
import java.net.InetSocketAddress; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Set; | |
import java.net.URI; | |
import java.util.concurrent.Executors; | |
import com.sun.net.httpserver.Headers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright (c) 2017, Sky UK Ltd All rights reserved. | |
Redistribution and use in source and binary forms, with or without modification, are permitted provided | |
that the following conditions are met: | |
Redistributions of source code must retain the above copyright notice, this list of conditions and the | |
following disclaimer. | |
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export CLUSTER_DNS=[...] | |
export CLUSTER_IP=[...] | |
ssh -i workshop.pem docker@$CLUSTER_IP | |
docker container run -d --name jenkins -p 8080:8080 jenkins:alpine | |
docker container ls # Wait until it is up and running |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# expects the lambda function .py file to be in the same directory as this script. | |
# based off of Amazon's official documentation: | |
# http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-deployment-pkg.html#with-s3-example-deployment-pkg-python | |
# get the lambda function | |
lambda_func_file=$1 | |
lambda_func="${lambda_func_file%.*}" | |
# exit if no file specified | |
[[ -z "$1" ]] && { echo "Lambda function is empty" ; exit 1; } | |
# generate a deployment timestamp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import boto.vpc | |
import time | |
REGION_NAME = 'us-west-2' | |
AMI_ID = 'ami-8e27adbe' # Amazon Linux AMI | |
conn = boto.vpc.connect_to_region(REGION_NAME) | |
# Create a VPC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import logging | |
try: | |
from urllib import splittype | |
except ImportError: | |
from urllib.parse import splittype | |
import boto3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package equilib | |
// Indices returns any of the equilibrium indices, -1 if there is not one | |
func Indices(nums []int) int { | |
if len(nums) > 10 { | |
return -2 | |
} | |
for i := 0; i < len(nums); i++ { | |
left := sum(nums[0:i]) | |
right := sum(nums[i+1:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func genStruct() gopter.Gen { | |
return genStrucType().FlatMap( | |
func(arg interface{}) gopter.Gen { | |
// typ := arg.(reflect.Type) | |
// Q: How to construct a generator? | |
return nil | |
}, | |
reflect.TypeOf((interface{})(nil)), | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2016 Alex Smolen (https://alexsmolen.com) | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ clj | |
Clojure 1.4.0 | |
user=> ;; atoms - synchronous sharing state changes | |
user=> (def w (atom 0)) | |
#'user/w | |
user=> (swap! w inc) | |
1 | |
user=> @w | |
1 | |
user=> (swap! w #(* % 100)) |