Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<!--
**********************************************************************
To save this html/data code, do the following steps:
1. Select all the text in this window (CTRL-A).
2. Copy the selected html/data code (CTRL-C).
3. Open a text editor such as Notepad.
var AWS = require('aws-sdk');
AWS.config.region = 'us-east-1';
function validInstance(instance) {
return instance.SecurityGroups[0] &&
instance.SecurityGroups[0].GroupName === 'ctf_instance' &&
instance.State.Code == 16 &&
instance.Tags[0]
}
FROM openjdk:8-jre-alpine
ENV SBT_VERSION 0.13.8
RUN apk add --no-cache bash curl openrc && \
curl -sL "http://dl.bintray.com/sbt/native-packages/sbt/$SBT_VERSION/sbt-$SBT_VERSION.tgz" | gunzip | tar -x -C /usr/local && \
ln -s /usr/local/sbt/bin/sbt /usr/local/bin/sbt && \
chmod 0755 /usr/local/bin/sbt && \
apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main --repository http://dl-cdn.alpinelinux.org/alpine/edge/community docker
@gambtho
gambtho / Makefile
Created January 29, 2018 17:31
lambda gateway fun
.DEFAULT_GOAL := help
name="something here"
region=us-east-1
profile="something here"
path="something here"
help:
cat ./Makefile
@gambtho
gambtho / commit-hook.sh
Created January 31, 2018 15:20
commit with co-authors
#!/bin/sh
set -euf -o pipefail
exec < /dev/tty
stty icrnl
lastcard_filename=".git/hooks/tmp/lastcard"
lastpair_filename=".git/hooks/tmp/lastpair"
mkdir -p .git/hooks/tmp
if [ $# -le 1 ]; then
if [ -e $lastcard_filename ]; then
@gambtho
gambtho / aws_creds.sh
Created March 9, 2018 17:59
EC2 access to AWS creds and EIP
apt-get install python-pip jq -y
pip install --upgrade awscli
aws_access_key_id=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/$${instance_profile} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'`
aws_secret_access_key=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/$${instance_profile} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'`
INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
aws ec2 associate-address --instance-id $${INSTANCE_ID} --allocation-id ${ALLOCATION_ID} --allow-reassociation --region us-east-1
@gambtho
gambtho / nginx.conf
Created May 25, 2018 13:12
Nginx conf for SPA
user nginx;
worker_processes 1;
pid /var/run/nginx.pid;
daemon off;
events {
worker_connections 512;
# multi_accept on;
}
@gambtho
gambtho / nginx.default
Created May 25, 2018 13:13
nginx default for spa (ssl terminated at lb)
server {
listen 8080 default_server;
listen [::]:8080 default_server ipv6only=on;
# listen 443 default ssl;
# ssl_certificate /etc/nginx/certs/server.crt;
# ssl_certificate_key /etc/nginx/certs/server.key;
root /app/dist;
index index.html index.htm;
@gambtho
gambtho / Dockerfile
Created May 25, 2018 13:15
Dockerfile for Vuejs/Nginx
FROM node as development
WORKDIR /app
ADD package.json /app/
ADD package-lock.json /app/
ADD yarn.lock /app/
RUN yarn
@gambtho
gambtho / Dockerfile
Created May 25, 2018 13:15
Dockerfile for Vuejs/Nginx
FROM node as development
WORKDIR /app
ADD package.json /app/
ADD package-lock.json /app/
ADD yarn.lock /app/
RUN yarn