Skip to content

Instantly share code, notes, and snippets.

Himanshu Lohiya himlohiya

Block or report user

Report or block himlohiya

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View install_kubernetes_dependency.sh
sudo apt-get install python3-pip
sudo pip3 install awscli
function install_kops {
if [ -z $(which kops) ]
then
curl -LO https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-linux-amd64
chmod +x kops-linux-amd64
mv kops-linux-amd64 /usr/local/bin/kops
else
View route53.tf
resource "aws_route53_zone" "newtech-academy" {
name = "newtech.academy"
}
resource "aws_route53_record" "server1-record" {
zone_id = "${aws_route53_zone.newtech-academy.zone_id}"
name = "server1.newtech.academy"
type = "A"
ttl = "300"
records = ["104.236.247.8"]
}
View vars.tf
variable "AWS_ACCESS_KEY" {}
variable "AWS_SECRET_KEY" {}
variable "AWS_REGION" {
default = "eu-west-1"
}
variable "AMIS" {
type = "map"
default = {
View instance.tf
resource "aws_instance" "example" {
ami = "${lookup(var.AMIS, var.AWS_REGION)}"
instance_type = "t2.micro"
# the VPC subnet
subnet_id = "${aws_subnet.main-public-1.id}"
# the security group
vpc_security_group_ids = ["${aws_security_group.allow-ssh.id}"]
View key.tf
resource "aws_key_pair" "mykeypair" {
key_name = "mykeypair"
public_key = "${file("${var.PATH_TO_PUBLIC_KEY}")}"
}
View provider.tf
provider "aws" {
region = "${var.AWS_REGION}"
access_key = "${var.AWS_ACCESS_KEY}"
secret_key = "${var.AWS_SECRET_KEY}"
}
View securityGroup.tf
data "aws_ip_ranges" "european_ec2" {
regions = [
"eu-west-1",
"eu-central-1"
]
services = [
"ec2"
]
}
View nat.tf
# nat gw
resource "aws_eip" "nat" {
vpc = true
}
resource "aws_nat_gateway" "nat-gw" {
allocation_id = "${aws_eip.nat.id}"
subnet_id = "${aws_subnet.main-public-1.id}"
depends_on = ["aws_internet_gateway.main-gw"]
}
View vpc.tf
# Internet VPC
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
instance_tenancy = "default"
enable_dns_support = "true"
enable_dns_hostnames = "true"
enable_classiclink = "false"
tags {
Name = "main"
}
View sentiment_analysis_textblob.py
from textblob import TextBlob
# compute sentiment scores (polarity) and labels
sentiment_scores_tb = [round(TextBlob(article).sentiment.polarity, 3) for article in news_df['clean_text']]
sentiment_category_tb = ['positive' if score > 0
else 'negative' if score < 0
else 'neutral'
for score in sentiment_scores_tb]
You can’t perform that action at this time.