Skip to content

Instantly share code, notes, and snippets.

@raghumb
raghumb / first.tf
Last active November 14, 2018 04:23
first.tf
variable "name" {
type = "string",
default ="Raghu"
}
output "developer"{
value="${var.name}"
}
provider "aws" {
region = "us-east-1"
}
resource "aws_instance" "my-vm-automated" {
ami = "ami-a4c7edb2"
instance_type = "t2.micro"
tags {
Name = "my-vm-automated"
}
resource "aws_instance" "my-vm-automated" {
ami = "ami-a4c7edb2"
instance_type = "t2.micro"
key_name="myec2keypair"
tags {
Name = "my-vm-automated"
}
}
provider "aws" {
region = "us-east-1"
}
variable "vpc_cidr_range"{
type = "string"
default= "10.0.0.0/16"
}
variable "subnet_cidr_range"{
type = "string"
default= "10.0.0.0/24"
data "aws_vpc" "myvpc" {
tags = {
Name = "demovpc"
}
}
resource "aws_subnet" "demosubnet" {
resource "aws_vpc" "myvpc" {
cidr_block = "${var.vpc_cidr_range}"
tags = {
Name = "demovpc"
}
}
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}"
@raghumb
raghumb / .py
Last active August 4, 2019 14:21
Array Operations
# 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]
@raghumb
raghumb / .py
Created August 4, 2019 14:33
Array Comparison
# 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: