Skip to content

Instantly share code, notes, and snippets.

View tomellis's full-sized avatar

Tom Ellis tomellis

View GitHub Profile
@tomellis
tomellis / 2048-ingress-https-example.yaml
Created June 27, 2020 15:23
Example Kubernetes ingress for 2048 with https, acm certs, multiple alb-ingress-controller listener ports, redirect from port 80->443 and external-dns domain creation
# https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/alb-ingress.md
# If external-dns is configured for ingresses it will create the route53 hosted record for the domain in the host section below
# ACM certificate needs to be created outside of k8s
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: "2048-ingress"
namespace: "2048-game"
annotations:
kubernetes.io/ingress.class: alb
@tomellis
tomellis / cluster.yaml
Created June 24, 2020 11:57
EKSCTL Win & Linux with existing VPC example
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: eks1
region: eu-west-1
version: '1.16'
vpc:
sh-4.2# base64 --decode userdata
<powershell>
[string]$EKSBootstrapScriptFile = "$env:ProgramFiles\Amazon\EKS\Start-EKSBootstrap.ps1"
& $EKSBootstrapScriptFile -EKSClusterName "windows-test" -KubeletExtraArgs "--register-with-taints= --node-labels=alpha.eksctl.io/nodegroup-name=ng-ec53ef23,alpha.eksctl.io/cluster-name=windows-test" 3>&1 4>&1 5>&1 6>&1
@tomellis
tomellis / aeroplanes.py
Last active November 22, 2018 09:38
Add a step to inspect the data of AerocraftML notebook
!wget https://s3-us-west-2.amazonaws.com/awsgeek-devweek-austin/mlclassify_train.rec --quiet
!mkdir -p training_data
%matplotlib inline
from mxnet import recordio
import mxnet as mx
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
@tomellis
tomellis / extract-img-recordio.py
Created November 19, 2018 15:51
Extract images from recordio format
from mxnet import recordio
import mxnet as mx
import cv2
import matplotlib.pyplot as plt
from PIL import Image
record = mx.recordio.MXRecordIO('mlclassify_train.rec', 'r')
i = 0
while True:
@tomellis
tomellis / match-az.sh
Created April 4, 2018 08:55
Matching EC2 Availability Zones Across AWS Accounts in 2018
#!/bin/bash
for region in `aws ec2 describe-regions --output text --query 'Regions[*].[RegionName]'`; do
aws ec2 describe-reserved-instances-offerings --region $region --output text --query 'ReservedInstancesOfferings[*].[AvailabilityZone,ReservedInstancesOfferingId]' --offering-type 'No Upfront' --instance-tenancy default --no-include-marketplace --instance-type m4.large --max-duration 31536000 --offering-class standard --product-description Linux/UNIX | grep -v 'None' | sort -n
done
@tomellis
tomellis / gist:6103852
Created July 29, 2013 11:59
RPC Environment Configuration
{
"name": "grizzly",
"description": "",
"cookbook_versions": {
},
"json_class": "Chef::Environment",
"chef_type": "environment",
"default_attributes": {
},
"override_attributes": {
<html>
<form action="https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_XXXXXXX/test" method="POST" enctype="multipart/form-data">
<input type="hidden" name="redirect" value="done.html" />
<input type="hidden" name="max_file_size" value="104857600" />
<input type="hidden" name="max_file_count" value="10" />
<input type="hidden" name="expires" value="1590835786" />
<input type="hidden" name="signature" value="XXXXX" />
<input type="file" name="file1" /><br />
<input type="submit" />
</html>
<html>
<form action="https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_XXXXXXX/test" method="POST" enctype="multipart/form-data">
<input type="hidden" name="redirect" value="done.htmlm" />
<input type="hidden" name="max_file_size" value="104857600" />
<input type="hidden" name="max_file_count" value="10" />
<input type="hidden" name="expires" value="1590835786" />
<input type="hidden" name="signature" value="XXXXX" />
<input type="file" name="file1" /><br />
<input type="submit" />
</html>
import hmac
from hashlib import sha1
from time import time
path = '/v1/MossoCloudFS_XXXXXXXX/test'
redirect = 'done.html'
max_file_size = 104857600
max_file_count = 10
#expires = int(time() + 600)
expires = 1590835786