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 / 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:
/* 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;
#!/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
@chandradeoarya
chandradeoarya / blogger-scrapper-csv.py
Created August 13, 2023 14:28
Saving scrapped blogspot blogs as CSV. Scrapper is https://github.com/sudosuwinter/blogger-scrapper/
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')
<!DOCTYPE html>
<html>
<head>
<title>Kids Tic Tac Toe</title>
<style>
body {
background-color: #FFD700;
font-family: Arial, sans-serif;
text-align: center;
}
@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)
@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
#!/bin/bash
sudo apt update -y
sudo apt install apache2 -y
sudo systemctl start apache2
#Now open the IP address of the server
#Now stop the server to update the file
sudo systemctl stop apache2
cd /var/www/html/
sudo rm index.html
import os
import json
import redis
import pymysql
class DB:
def __init__(self, **params):
params.setdefault("charset", "utf8mb4")
sudo yum update -y
sudo amazon-linux-extras install java-openjdk11 -y
java -version
sudo yum install git -y
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
sudo yum install jenkins -y
sudo systemctl start jenkins
sudo systemctl enable jenkins
sudo systemctl status jenkins