Skip to content

Instantly share code, notes, and snippets.

View chandradeoarya's full-sized avatar
🏠
Working from home

Chandradeo Arya chandradeoarya

🏠
Working from home
View GitHub Profile
@chandradeoarya
chandradeoarya / delete-aws-vpc.sh
Created November 24, 2022 10:50
Bash script to delete all components of VPC completely
vpc="vpc-01c4ba22f251d0831"
aws ec2 describe-internet-gateways --filters 'Name=attachment.vpc-id,Values='$vpc | grep InternetGatewayId
aws ec2 describe-subnets --filters 'Name=vpc-id,Values='$vpc | grep SubnetId
aws ec2 describe-route-tables --filters 'Name=vpc-id,Values='$vpc | grep RouteTableId
aws ec2 describe-network-acls --filters 'Name=vpc-id,Values='$vpc | grep NetworkAclId
aws ec2 describe-vpc-peering-connections --filters 'Name=requester-vpc-info.vpc-id,Values='$vpc | grep VpcPeeringConnectionId
aws ec2 describe-vpc-endpoints --filters 'Name=vpc-id,Values='$vpc | grep VpcEndpointId
aws ec2 describe-nat-gateways --filter 'Name=vpc-id,Values='$vpc | grep NatGatewayId
aws ec2 describe-security-groups --filters 'Name=vpc-id,Values='$vpc | grep GroupId
aws ec2 describe-instances --filters 'Name=vpc-id,Values='$vpc | grep InstanceId
@chandradeoarya
chandradeoarya / chatgpt-api.py
Created March 6, 2023 18:57
python client for chatgpt
import openai
openai.api_key = "TOKEN"
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": "Reply as a Vedic Scholar."}]
)
print(completion)
<!DOCTYPE html>
<html>
<head>
<title>Kids Tic Tac Toe</title>
<style>
body {
background-color: #FFD700;
font-family: Arial, sans-serif;
text-align: center;
}
import csv
from bs4 import BeautifulSoup
def extract_first_image_url(html_string):
soup = BeautifulSoup(html_string, 'html.parser')
img_tag = soup.find('img')
if img_tag:
img_url = img_tag.get('src')
#!/bin/bash
# Create some directories and files
mkdir -p /var/www/html
mkdir -p /var/backups
mkdir -p /etc/company
# Create users and groups
groupadd webadmin
useradd -m -G webadmin alice
/* CSS for overriding styles with high specificity */
h3#problem-description,
h3#problem-constraints,
h3#input-format,
h3#output-format,
h3#example-input,
h3#example-output {
font-family: Arial, sans-serif !important;
color: #2b2b2b !important;
font-size: 1.5rem !important;
@chandradeoarya
chandradeoarya / nginx-dep-svc.yml
Last active September 28, 2024 11:37
Kubernetes manifest file to create nginx resources like deployments and service.
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment-dojo
labels:
app: ng-dep-dojo
spec:
replicas: 1
selector:
matchLabels: