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
_format_version: "2.1" | |
_transform: true | |
services: | |
- name: mock # any meaningful name to identify our API | |
url: https://mockbin.org/bin/dd5b993d-c69b-48db-9036-829fb7955f58 # a remote backend that we will proxy to - clients will not know about this | |
routes: | |
- paths: | |
- /mock # an API path that we will call | |
methods: |
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 main | |
import ( | |
"fmt" | |
"math/rand" | |
"sync" | |
"time" | |
) | |
var program_start_time time.Time |
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 main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
var program_start_time time.Time | |
var program_end_time time.Time |
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 main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
var program_start_time time.Time | |
var program_end_time time.Time |
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
provider "google" { | |
credentials = file(var.path_to_tf_executor_service_account_json_file) | |
alias = "tf_executor" | |
} | |
data "google_service_account_access_token" "impersonated" { | |
provider = google.tf_executor | |
target_service_account = var.tf_owner_service_account_email | |
scopes = [ "cloud-platform" ] | |
lifetime = "1800s" # 30 minutes - max can be set up to 60 minutes |
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
# Inspired from http://coding4streetcred.com/blog/post/Asymmetric-Encryption-Revisited-(in-PyCrypto) | |
# PyCrypto docs available at https://www.dlitz.net/software/pycrypto/api/2.6/ | |
from Crypto import Random | |
from Crypto.PublicKey import RSA | |
import base64 | |
def generate_keys(): | |
# RSA modulus length must be a multiple of 256 and >= 1024 | |
modulus_length = 256*4 # use larger value in production |
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
# Inspired from https://pythonprogramming.net/encryption-and-decryption-in-python-code-example-with-explanation/ | |
# PyCrypto docs available at https://www.dlitz.net/software/pycrypto/api/2.6/ | |
from Crypto.Cipher import AES | |
import base64, os | |
def generate_secret_key_for_AES_cipher(): | |
# AES key length must be either 16, 24, or 32 bytes long | |
AES_key_length = 16 # use larger value in production | |
# generate a random secret key with the decided key length |
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
<html> | |
<head> | |
<!--Load the AJAX API--> | |
<script type="text/javascript" src="https://www.google.com/jsapi"></script> | |
<script type="text/javascript"> | |
// Load the Visualization API and the piechart package. | |
google.load('visualization', '1.0', {packages:["corechart","geochart","table"]}); | |
// Set a callback to run when the Google Visualization API is loaded. |