This file contains hidden or 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
$script = <<SCRIPT | |
# Install docker | |
curl -fsSL get.docker.com | sh | |
# Install kubectl | |
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl | |
chmod +x ./kubectl | |
sudo mv ./kubectl /usr/local/bin/kubectl | |
# Install kubeadm | |
cat <<EOF > /etc/yum.repos.d/kubernetes.repo | |
[kubernetes] |
This file contains hidden or 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 | |
function list_include_item { local list="$1"; local item="$2"; if [[ $list =~ (^|[[:space:]])"$item"($|[[:space:]]) ]] ; then result=0; else result=1; fi; return $result;}; | |
bases="alpine:latest nginx:1.11.3-alpine" | |
delete= | |
# append latest tag to each image | |
for item in $(docker images --format "{{.Repository}}:{{.Tag}}@{{.ID}}") | |
do | |
export IFS=' ' | |
IFS='@'; arr=($item); unset IFS; |
This file contains hidden or 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 | |
# set variable with base image names | |
# get base image ids and set in other list | |
all_images=`mktemp` | |
base_images=`mktemp` | |
#base_image_names="alpine linux" | |
#ids=`docker images --no-trunc -q $(base_image_names)` | |
bases="sha256:7328f6f8b41890597575cbaadc884e7386ae0acc53b747401ebce5cf0d624560 sha256:33aa78cbda15ae84375c46dfc3fc07560c9af8e7b8f37745d2c6542e2affec9f" | |
docker images -q --no-trunc > $all_images |
This file contains hidden or 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
{ | |
"/apis/{fqdn}/v1/{resource}": { | |
"get": { | |
"security": [ | |
{ | |
"Bearer": [ | |
] | |
} | |
], |
This file contains hidden or 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
FROM debian:jessie | |
MAINTAINER a.mulholland | |
RUN apt-get update && apt-get upgrade -y &&\ | |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - &&\ | |
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list &&\ | |
curl -sL https://deb.nodesource.com/setup_6.x | bash - | |
apt-get install -y nodejs yarn nginx php5-fpm php5-mysqlnd php5-curl php5-mcrypt php5-gd git curl mysql-client openssh-client | |
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer |
This file contains hidden or 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
# Scheduling the above script hourly. Ensure you're properly authenticated via aws configure. | |
#!/bin/bash | |
zip ebs-backup-worker.zip .schedule-ebs-snapshot-backups.py | |
aws lambda create-function --function-name ebs-backup-worker \ | |
--runtime python2.7 \ | |
--role "arn for your lambda user's role" \ | |
--handler lambda_handler \ | |
--zip-file fileb:///ebs-backup-worker.zip |
This file contains hidden or 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
""" Make sure to create the "backup" tag on the volumes you want to backup. | |
For authentication, setup the aws policy and user as specified in the snapshot-trust.json and snapshot-policy.json | |
Inspired by: https://serverlesscode.com/post/lambda-schedule-ebs-snapshot-backups/ | |
""" | |
from time import gmtime, strftime | |
import boto3 | |
region = "us-west-2" | |
backup_tag = "backup" |
This file contains hidden or 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
def max_in_nested_number_list(numbers): | |
largest = 0 | |
for item in numbers: | |
if isinstance(item, list): | |
numbers.append(max_in_nested_number_list(item)) | |
else: | |
largest = item if item>largest else largest | |
return largest |
This file contains hidden or 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
# From this askubuntu question http://askubuntu.com/a/604691/280044 | |
ip route get 8.8.8.8 | awk '{print $NF; exit}' |
This file contains hidden or 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/sh | |
# Setup Calico for Docker on Ubuntu 16.04 | |
# Change to the internal ip of your node | |
NODE_IP=ip route get 8.8.8.8 | awk '{print $NF; exit}' | |
# Install docker | |
sudo apt-get install -y --no-install-recommends \ | |
apt-transport-https \ | |
ca-certificates \ |