Skip to content

Commit

Permalink
Merge branch 'main' into features
Browse files Browse the repository at this point in the history
  • Loading branch information
Kritika75 authored Oct 25, 2024
2 parents f044446 + a854cd9 commit effdb8a
Show file tree
Hide file tree
Showing 239 changed files with 12,176 additions and 3,100 deletions.
16 changes: 16 additions & 0 deletions Bouncing ball simulator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Bouncing ball simulator
This script shows the simulation of few balls bouncing in a container under gravity.
They also collide with the bottom part and the walls of the container.

### Prerequisites
The script runs in python3.
pygame module is needed

pip3 install requirements.txt

### How to run the script
Navigate to the folder where the source code is written.
Open a terminal and execute the command:

python3 ball_bounce.py

Binary file added Bouncing ball simulator/background-img.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Bouncing ball simulator/ball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions Bouncing ball simulator/ball_bounce.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#This program shows the simulation of 5 balls bouncing under gravitational acceleration.
#It is also accompanied by eleastic collission with walls of the container.
#It is fun to watch.
import pygame,time,random

pygame.init()

#setting screen size of pygame window to 800 by 600 pixels
screen=pygame.display.set_mode((800,600))
background=pygame.image.load('background-img.jpg')

#Adding title
pygame.display.set_caption('Ball Bounce Simulation')

class ball:
ball_image=pygame.image.load('ball.png')
g=1
def __init__(self):
self.velocityX=4
self.velocityY=4
self.X=random.randint(0,768)
self.Y=random.randint(0,350)

def render_ball(self):
screen.blit(ball.ball_image, (self.X,self.Y))
def move_ball(self):
#changing y component of velocity due to downward acceleration
self.velocityY+=ball.g
#changing position based on velocity
self.X+=self.velocityX
self.Y+=self.velocityY
#collission with the walls lead to change in velocity
if self.X<0 or self.X>768:
self.velocityX*=-1
if self.Y<0 and self.velocityY<0:
self.velocityY*=-1
self.Y=0
if self.Y>568 and self.velocityY>0:
self.velocityY*=-1
self.Y=568
#list of balls created as objects
Ball_List=[ball(),ball(), ball(), ball(), ball()]

#The main program loop
running=True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running=False

time.sleep(0.02)
screen.blit(background, (0,0))
for ball_item in Ball_List:
ball_item.render_ball()
ball_item.move_ball()
pygame.display.update()
1 change: 1 addition & 0 deletions Bouncing ball simulator/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pygame==2.0.2
163 changes: 129 additions & 34 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,152 @@
<div align="center">
# ✨Contributor Covenant Code of Conduct✨

# Code of Conduct
---

</div>
## 🌟Our Pledge
---
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

## Our Pledge
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
---
## 🚦Our Standards

## Note
Examples of behavior that contributes to a positive environment for our
community include:

Submit only useful issue , Don't try t submit any type of issue which do not suits for this project
Also warning to all contributors to not to submit same issue which was already submitted by any other Contributors
## Our Standards
* 💖Demonstrating empathy and kindness toward other people
* 🤝Being respectful of differing opinions, viewpoints, and experiences
* 📝Giving and gracefully accepting constructive feedback
* 🌱Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* 🎯Focusing on what is best not just for us as individuals, but for the
overall community

Examples of behavior that contributes to creating a positive environment include:
Examples of unacceptable behavior include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
* 🚫The use of sexualized language or imagery, and sexual attention or
advances of any kind
* 🛑Trolling, insulting or derogatory comments, and personal or political attacks
* ⚠️Public or private harassment
* 🔒Publishing others' private information, such as a physical or email
address, without their explicit permission
* ❌Other conduct which could reasonably be considered inappropriate in a
professional setting

Examples of unacceptable behavior by participants include:
---

- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
## 👨‍⚖️Enforcement Responsibilities

## Our Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

Maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that do not align with this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project.
---
## 🌐Scope

## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
---
## 📋Pull Request Guidelines

## Enforcement
Contributions, including pull requests, must align with this Code of Conduct.
All contributors are expected to submit work that fosters a positive and inclusive community.
Inappropriate behavior, language, or content in pull requests may result in the rejection of
the contribution and further enforcement actions as outlined in the guidelines.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project owner. All complaints will be reviewed and investigated promptly and fairly. All project team members are obligated to respect the privacy and security of the reporter of any incident.
---
## 🛡️Enforcement

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
.
All complaints will be reviewed and investigated promptly and fairly.

You can also tag the admin, if you find anything voilating the Code of Conduct.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Attribution
---
## 📖Enforcement Guidelines

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/), version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

Community Impact Guidelines were inspired by Mozilla's code of conduct enforcement ladder.
### 1. ✏️Correction

For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. ⚠️Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. ⏳Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. 🚫Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

---
## 📜Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.


---




# 🌟Conclusion
By adhering to this Code of Conduct, we create a respectful, inclusive, and empowering environment for everyone involved in our community. Together, we can build a space where all members feel safe, supported, and encouraged to contribute their best. We invite every member to take responsibility for upholding these standards, ensuring that our community remains open and welcoming to all.
29 changes: 29 additions & 0 deletions Chat-App/client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import socket
import threading

def receive_messages(client_socket):
"""Receive messages from the server."""
while True:
try:
message = client_socket.recv(1024).decode('utf-8')
if message:
print(f"\n{message}")
else:
break
except:
break

# Set up the client
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('127.0.0.1', 12345)) # Connect to the server

# Start a thread to listen for messages
threading.Thread(target=receive_messages, args=(client,)).start()

while True:
message = input("You: ")
if message.lower() == 'exit':
break
client.send(message.encode('utf-8'))

client.close()
39 changes: 39 additions & 0 deletions Chat-App/server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import socket
import threading

def handle_client(client_socket):
"""Handle communication with the connected client."""
while True:
try:
message = client_socket.recv(1024).decode('utf-8')
if not message:
break
print(f"Received: {message}")
broadcast(message, client_socket)
except:
break
client_socket.close()

def broadcast(message, client_socket):
"""Send the message to all connected clients."""
for client in clients:
if client != client_socket:
try:
client.send(message.encode('utf-8'))
except:
client.close()
clients.remove(client)

# Set up the server
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(('0.0.0.0', 12345)) # Listen on all interfaces, port 12345
server.listen(5)
print("Server started, waiting for connections...")

clients = []

while True:
client_socket, addr = server.accept()
print(f"Accepted connection from {addr}")
clients.append(client_socket)
threading.Thread(target=handle_client, args=(client_socket,)).start()
52 changes: 52 additions & 0 deletions Code_help/Code_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import speech_recognition as sr
import pyttsx3
import openai

# Initialize recognizer and text-to-speech engine
recognizer = sr.Recognizer()
engine = pyttsx3.init()
openai.api_key = 'YOUR_API_KEY'

def listen():
with sr.Microphone() as source:
print("Listening...")
audio = recognizer.listen(source)
try:
command = recognizer.recognize_google(audio)
print(f"You said: {command}")
return command
except sr.UnknownValueError:
print("Sorry, I did not understand that. Could you please repeat?")
return None
except sr.RequestError:
print("Could not request results from the speech recognition service.")
return None

def speak(text):
engine.say(text)
engine.runAndWait()

def generate_code(prompt):
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": f"Generate code for: {prompt}"}]
)
return response['choices'][0]['message']['content']

def main():
speak("Welcome to the voice-activated coding system. What code do you need? You can say 'exit' to end the program.")

while True:
prompt = listen()
if prompt:
if prompt.lower() == 'exit':
speak("Exiting the program. Goodbye!")
break

code = generate_code(prompt)
print("Generated Code:")
print(code)
speak("Here is the code I generated for you. You can ask for more code or say 'exit' to leave.")

if __name__ == "__main__":
main()
Loading

0 comments on commit effdb8a

Please sign in to comment.