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
gist test |
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
1. Create a Namespace | |
# Create a namespace named 'devops' | |
kubectl create ns devops | |
2. Create a Private Key for the User | |
# Generate a 2048-bit RSA private key for the user | |
openssl genrsa -out prashant.key 2048 | |
3. Create a Certificate Signing Request (CSR) for the User |
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
#Installation in mac or in different version https://github.com/k8sgpt-ai/k8sgpt | |
brew tap k8sgpt-ai/k8sgpt | |
brew install k8sgpt | |
# Verify the version | |
k8sgpt version | |
#Checking Help | |
k8sgpt --help |
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
import boto3 | |
s3 = boto3.client('s3') | |
paginator = s3.get_paginator('list_objects_v2') | |
page_size = 100 | |
bucket_name = 'your-bucket-name' | |
prefix = 'your-prefix' | |
response_iterator = paginator.paginate( |
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
#!/usr/bin/env python3 | |
# Python script to convert EC2 instance from one type to another and read input from csv file with a format instance_id,instance_type | |
import argparse | |
import boto3 | |
import sys | |
import csv | |
def convert_instance(instance_id, new_instance_type, csv_file=None): | |
# Create an EC2 client |
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
sn0 | fname | lname | age | |
---|---|---|---|---|
1 | john | cena | 40 | |
2 | micheal | white | 35 |
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
import csv | |
filename="test.csv" | |
with open(filename) as f: | |
read_csv = csv.reader(f) | |
for data in read_csv: | |
print(data) |
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
def sum(num): | |
sum_val = 0 | |
while num: | |
sum_val += num % 10 | |
num //= 10 | |
return sum_val | |
def solution(A): | |
sum_map = {} |
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
class Stack(object): | |
def __init__(self): | |
self.items = [] | |
def push(self,item): | |
self.items.append(item) | |
def pop(self): | |
return self.items.pop() |
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
locals { | |
max_subnet_length = max( | |
length(var.private_subnets), | |
length(var.elasticache_subnets), | |
length(var.database_subnets), | |
length(var.redshift_subnets), | |
) | |
nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length | |
# Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free! |
NewerOlder