Skip to content

Instantly share code, notes, and snippets.

View Rishbah-76's full-sized avatar
🎯
Working on Better Build

Rishabh Rishbah-76

🎯
Working on Better Build
View GitHub Profile
@Rishbah-76
Rishbah-76 / main.py
Created February 26, 2022 10:40
Main function for pong game using python
def main():
run= True
clock=pygame.time.Clock()
left_paddle=Paddle(10,HEIGHT//2-PADDLE_HEIGHT//2,PADDLE_WIDTH,PADDLE_HEIGHT)
right_paddle=Paddle(WIDTH-10-PADDLE_WIDTH,HEIGHT//2-PADDLE_HEIGHT//2,PADDLE_WIDTH,PADDLE_HEIGHT)
#Getting Ball
ball=Ball(WIDTH//2,HEIGHT//2,BALL_RADIUS)
#Setting score
vehicle_reg_no = UP00XX0000 #NumberPlate deteted
username = <Enter your siteID> #API_user name
url = "http://www.regcheck.org.uk/api/reg.asmx/CheckIndia?RegistrationNumber=" + vehicle_reg_no + "&username="+username
url=url.replace(" ","%20")
r = requests.get(url)
n = xmltodict.parse(r.content)
k = json.dumps(n)
df = json.loads(k)
l=df["Vehicle"]["vehicleJson"]
p=json.loads(l)
import cv2
import imutils
import numpy as np
import pytesseract
import re
import string
pytesseract.pytesseract.tesseract_cmd = r'<paste your pytesseract application loacation here>'
img = cv2.imread('photo.jpeg',cv2.IMREAD_COLOR)
img = cv2.resize(img, (500,600) )
@Rishbah-76
Rishbah-76 / index.html
Created June 30, 2021 18:15
Kubernetes webUI frontend
<!DOCTYPE html>
<html>
<title>k8s</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lobster&effect=shadow-multiple">
<style>
.w3-sofia {
font-family: "Lobster", Sans-serif;
@Rishbah-76
Rishbah-76 / dockerps.py
Created June 25, 2021 21:15
Backend Server code to run the docker webapp via Python over network
#!/usr/bin/python3
import cgi
import subprocess
import time
print("content-type: text/html")
print()
k = cgi.FieldStorage()
@Rishbah-76
Rishbah-76 / index.html
Created June 25, 2021 21:09
Frontend code of docker webapp i.e integrating docker with python using javascript
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
@import url('https://fonts.googleapis.com/css?family=Ubuntu');
@import url('https://fonts.googleapis.com/css?family=Ubuntu+Mono');
body {
@Rishbah-76
Rishbah-76 / ec2_ebs.py
Created June 23, 2021 05:00
Defining a Function using Boto3 to launch a EC2 instance with EBS and Attaching Both over AWS Cloud.
#EC2 Instance and Attaching a 5gb EBS Volume..
#################################################################################################
import boto3
import subprocess as sb
ec2 = boto3.resource('ec2')
# Connecting to AWS..We have to configure our AWS CLI first!!!
def EC2_launch():
try:
#LAunching an Ec2 Instance..
@Rishbah-76
Rishbah-76 / sending_Mail_whatsapp.py
Last active June 23, 2021 05:01
Sending Mail and Whatsapp using Above created function if Face gets Detected
# Detecting FACE Infront and Sending EMAIL + WHATSAPP Message
###################################################################################################################################
## Using Facial Recognition..For Sending Mail!!
face_classifier = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
def face_detector(img, size=0.5):
# Convert image to grayscale
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
faces = face_classifier.detectMultiScale(gray, 1.3, 5)
if faces is ():
return img, []
@Rishbah-76
Rishbah-76 / smtp_whatsapp.py
Last active June 23, 2021 05:03
Defining functions to send the Email with Attachment followed by a whatsapp Message if a User Face get's Recognized
#Creating a Function For Sending Email With Attachment!
#############################################################################################################
import email, smtplib, ssl
from getpass import getpass
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import cv2
import numpy as np
@Rishbah-76
Rishbah-76 / ModelTraining.py
Last active June 23, 2021 05:04
Creating a Face Recognization model using LBPH Algo.
# Training the Model
cap.release()
import cv2
import numpy as np
from os import listdir
from os.path import isfile, join
# Get the training data we previously made
data_path = './faces/user/'
onlyfiles = [f for f in listdir(data_path) if isfile(join(data_path, f))]