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
| # Find index of max value excluding Nan values | |
| arr = np.array([[5, 2, 3, 2], [5, 1, 3, 6],[5, 1, 3, 2]]) | |
| print arr | |
| max = np.nanargmax(arr) | |
| print max | |
| max = np.amax(arr) | |
| print 'Maximum value in array' | |
| print max |
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
| arr = np.array([[5, 2, 3, 2], [5, 1, 3, 6],[5, 1, 3, 2]]) | |
| print arr | |
| # Get all rows of 4th column | |
| print '4th column' | |
| print arr[:, 3] | |
| # Get all columns of 2nd row | |
| print '2nd row' | |
| print arr[1,:] |
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
| # Create Array with three rows | |
| arr = np.array([[5, 2, 3, 2], [5, 1, 3, 6],[5, 1, 3, 2]]) | |
| print arr | |
| # Compare all rows with first row: (returns an array with boolean for each row) | |
| condition = (arr == arr[0]) | |
| print condition | |
| # Compare if all elements in array are True (We will do this for first row of condition array) | |
| if condition[0].all() == True: |
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
| # Create an Array | |
| arr = np.array([[5, 7, -1, 0]]) | |
| print arr | |
| # Get number of rows | |
| row = arr.shape[0] | |
| print row | |
| # Get number of columns | |
| col = arr.shape[1] |
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
| data "aws_iam_policy_document" "my-sqs-policy" { | |
| statement { | |
| actions = ["sqs:ReceiveMessage"] | |
| resources = ["arn:aws:sqs:us-east-2:...."] | |
| } | |
| } | |
| resource "aws_iam_policy" "my-sqs-policy" { | |
| policy = "${data.aws_iam_policy_document.my-sqs-policy.json}" |
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
| resource "aws_vpc" "myvpc" { | |
| cidr_block = "${var.vpc_cidr_range}" | |
| tags = { | |
| Name = "demovpc" | |
| } | |
| } |
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
| data "aws_vpc" "myvpc" { | |
| tags = { | |
| Name = "demovpc" | |
| } | |
| } | |
| resource "aws_subnet" "demosubnet" { |
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
| variable "vpc_cidr_range"{ | |
| type = "string" | |
| default= "10.0.0.0/16" | |
| } | |
| variable "subnet_cidr_range"{ | |
| type = "string" | |
| default= "10.0.0.0/24" |
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
| provider "aws" { | |
| region = "us-east-1" | |
| } |
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
| resource "aws_instance" "my-vm-automated" { | |
| ami = "ami-a4c7edb2" | |
| instance_type = "t2.micro" | |
| key_name="myec2keypair" | |
| tags { | |
| Name = "my-vm-automated" | |
| } | |
| } |