View gist:ecc290e2d4786507bdd84e96d3c8efab
https://docs.projectcalico.org/v2.6/getting-started/kubernetes/
https://cloud.google.com/kubernetes-engine/docs/network-policy
blog.kubernetes.io/2017/10/enforcing-network-policies-in-kubernetes.html
View pubsub.py
#!/usr/bin/python
# pip install --upgrade google-cloud-pubsub
# gcloud beta pubsub topics create my-topic
# gcloud beta pubsub subscriptions create my-sub --topic my-topic
#gcloud beta pubsub subscriptions delete mySubscription
# gcloud beta pubsub topics delete myTopic
def publish_messages(project, topic_name):
View autodeploy-kubernetes-gitlabci.yml
# This file is a template, and might need editing before it works on your project.
# Explanation on the scripts:
# https://gitlab.com/gitlab-examples/kubernetes-deploy/blob/master/README.md
image: registry.gitlab.com/gitlab-examples/kubernetes-deploy
variables:
# Application deployment domain
KUBE_DOMAIN: domain.example.com
stages:
View vpn-setup.sh
# Google Cloud Platform VPN
# Create the first network and subnetwork
gcloud compute networks create \
vpn-network-1
# Subnet
gcloud compute networks subnets create \
subnet-a \
--network vpn-network-1 \
View cloudsql.sh
google131729_student@mydb-client:~$ mysql --host=104.154.208.158 -u root -ppassword
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.14-google-log (Google)
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]> CREATE DATABASE resources;
View cp.sh
google131653_student@storecore:~$ python -c 'import base64; import os; print(base64.encodestring(os.urandom(32)))'
3EloqDXvYXLdNFLiEP3nQzlGzLpNxK0tnu8LxgteUYM=
google131653_student@storecore:~$ gsutil rewrite -k gs://bucketd00d/setup2.html
Rotating gs://bucketd00d/setup2.html: / [0 files][ 0.0 B/ 52.6 KiB] / [1 files][ 52.6 KiB/ 52.6 KiB]
Operation completed over 1 objects/52.6 KiB.
# Attempt to cp without a decryption key
google131653_student@storecore:~$ python -c 'import base64; import os; print(base64.encodestring(os.urandom(32)))'
0YQ6bOsHvPpG9g3gQwNNYsjv9ljvcXIcf6yRQweHdOE=
View rps.py
#!/usr/bin/python
# paper 1 beats rock 2 1 > 2
# paper 1 loses scissors 3 1 < 3
# rock 2 beats scissors 3 2 > 3
# rock 2 loses to paper 1 2 < 1
# scissors 3 beats paper 1 3 > 1
View compute-gpu.sh
#!/bin/bash
# Starts a compute instance with
# one GPU instances, installing
# CUDA tools onto the instance
gcloud compute instances create gpu-instance-1 \
--machine-type n1-standard-2 --zone us-east1-d \
--accelerator type=nvidia-tesla-k80,count=1 \
--image-family ubuntu-1604-lts --image-project ubuntu-os-cloud \
View kubectl.mk
# Copyright 2016 Comcast Cable Communications Management, LLC
#
# 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
# distributed under the License is distributed on an "AS IS" BASIS,
View client.py
#!/usr/bin/python
import getopt, sys, socket
HOST = socket.gethostname() # Local machine
PORT = 8081 # Local port
BUFFER_SIZE = 1024 # Buffer size for data
PAYLOAD = 'Hello, World!'
def main():
try:,