Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mamasitta/Python-project-Scripts
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: larymak/Python-project-Scripts
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Jan 10, 2025

  1. Create Cycle_Sort.py

    KavinduDr authored Jan 10, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    50bbd38 View commit details
  2. Update Cycle_Sort.py

    KavinduDr authored Jan 10, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f2fc2d2 View commit details

Commits on Jan 14, 2025

  1. Create README.md

    KavinduDr authored Jan 14, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0afa310 View commit details

Commits on Jan 16, 2025

  1. Merge pull request larymak#404 from KavinduDr/main

    Create Cycle sort algorithm
    larymak authored Jan 16, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    5033d88 View commit details

Commits on Jan 29, 2025

  1. Create Pigeonhole_Sort.py

    KavinduDr authored Jan 29, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    5fd8183 View commit details
  2. Update README.md

    KavinduDr authored Jan 29, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    c6add60 View commit details

Commits on Feb 10, 2025

  1. Copy the full SHA
    73445bc View commit details

Commits on Mar 4, 2025

  1. Merge pull request larymak#405 from KavinduDr/main

    Added Pigeonhole Sort algorithm and update README to explain algorithm
    larymak authored Mar 4, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    11e5d22 View commit details
  2. Merge pull request larymak#406 from himaja-56/dsbranch

    Added queues.py with content
    larymak authored Mar 4, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    9d3c59a View commit details

Commits on Jun 24, 2025

  1. Copy the full SHA
    674c7a5 View commit details
  2. Copy the full SHA
    f6f1a7a View commit details

Commits on Jul 2, 2025

  1. Merge pull request larymak#406 from himaja-56/dsbranch

    Added queues.py with content
    
    Python Project Scripts
    larymak authored and “gyyzzz” committed Jul 2, 2025
    Copy the full SHA
    1786e5f View commit details
  2. Python Project Scripts

    “gyyzzz” committed Jul 2, 2025
    Copy the full SHA
    76abbe4 View commit details
  3. Update README.md

    “gyyzzz” committed Jul 2, 2025
    Copy the full SHA
    83539c0 View commit details

Commits on Jul 11, 2025

  1. EncrytpionFolder

    adewale-devflow committed Jul 11, 2025
    Copy the full SHA
    ebbc531 View commit details
  2. EncrytpionFolder

    adewale-devflow committed Jul 11, 2025
    Copy the full SHA
    f2c6b5d View commit details

Commits on Jul 23, 2025

  1. Copy the full SHA
    72f1094 View commit details

Commits on Jul 24, 2025

  1. Merge pull request larymak#411 from CodeWithPratik-777/main

    Added Gemini Chatbot CLI version with Google Generative AI integration
    larymak authored Jul 24, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    3e11294 View commit details
  2. Merge pull request larymak#410 from adewale-devflow/Adewale-Afolabi

    Simple Encrytion Algorithim in python
    larymak authored Jul 24, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6302536 View commit details
  3. Merge pull request larymak#409 from gyyzzz/gyyzzz-branch

    Gyyzzz branch
    larymak authored Jul 24, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0047406 View commit details
  4. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    edfd094 View commit details
  5. Merge pull request larymak#408 from KnightBlue14/main

    Adding new app
    larymak authored Jul 24, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    b0e44c6 View commit details
50 changes: 50 additions & 0 deletions Data Structures and Algorithms/Sorting Algorithms/Cycle_Sort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from typing import List

def cycle_sort(nums: List[int]) -> int:

writes = 0

for cycle_start in range(len(nums) - 1):
current = nums[cycle_start]

# Find the target position for the current item.
target_position = cycle_start
for i in range(cycle_start + 1, len(nums)):
if nums[i] < current:
target_position += 1

# Skip if the item is already in the correct position.
if target_position == cycle_start:
continue

# Handle duplicates by finding the next available position.
while current == nums[target_position]:
target_position += 1

nums[target_position], current = current, nums[target_position]
writes += 1

# Rotate the rest of the cycle.
while target_position != cycle_start:
target_position = cycle_start
for i in range(cycle_start + 1, len(nums)):
if nums[i] < current:
target_position += 1

while current == nums[target_position]:
target_position += 1

nums[target_position], current = current, nums[target_position]
writes += 1

return writes


if __name__ == "__main__":
arr = [1, 8, 3, 9, 10, 10, 2, 4]
print("Before sort:", arr)

writes = cycle_sort(arr)

print("After sort:", arr)
print(f"Number of writes: {writes}")
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Python program to implement Pigeonhole Sort

def pigeonhole_sort(a):
# size of range of values in the list
# (ie, number of pigeonholes we need)
my_min = min(a)
my_max = max(a)
size = my_max - my_min + 1

# our list of pigeonholes
holes = [0] * size

# Populate the pigeonholes.
for x in a:
assert type(x) is int, "integers only"
holes[x - my_min] += 1

# Put the elements back into the array in order.
i = 0
for count in range(size):
while holes[count] > 0:
holes[count] -= 1
a[i] = count + my_min
i += 1


a = [8, 1, 2, 7, 4, 5, 8]
print("Sorted order is : ", end = ' ')

pigeonhole_sort(a)

for i in range(0, len(a)):
print(a[i], end = ' ')
49 changes: 49 additions & 0 deletions Data Structures and Algorithms/Sorting Algorithms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Cycle Sort Algorithm

## Overview
Cycle Sort is a comparison-based sorting algorithm that is efficient when minimizing memory writes is important. It is an in-place sorting algorithm that rearranges the elements by identifying cycles in the permutation of elements.

## Algorithm Explanation
The algorithm works by:
1. Identifying the correct position of each element in the array.
2. Placing the element in its correct position and replacing the element already there in the cycle.
3. Repeating the process for the remaining unsorted elements.

## Complexity
- **Time Complexity**:
- Best, Worst, and Average Case: O(n²) (due to nested cycles).
- **Space Complexity**: O(1) (in-place sorting).

## Usage Example
```python
from Cycle_Sort import cycle_sort

arr = [4, 5, 3, 2, 1]
print("Original array:", arr)
writes = cycle_sort(arr)
print("Sorted array:", arr)
print("Number of writes performed:", writes)
```
# Pigeonhole Sort Algorithm

## Overview
Pigeonhole Sort is a sorting algorithm that works well for sorting lists where the range of values (i.e., the difference between the maximum and minimum values) is not significantly larger than the number of elements in the list. It is a non-comparison-based sorting algorithm.

The algorithm works by placing each element into its corresponding "pigeonhole" (a slot or bucket) and then iterating through the pigeonholes in order to reconstruct the sorted list.

## Complexity
- **Time Complexity**:
- The time complexity of Pigeonhole Sort is O(n + range), where n is the number of elements in the list and range is the difference between the maximum and minimum values.

- This makes it efficient for lists with a small range of values.
- **Space Complexity**: The space complexity is O(range), as it requires additional space for the holes list.
- **Limitations**: Pigeonhole Sort is not suitable for lists with a large range of values, as it would require a lot of memory for the holes list.

## Usage Example
```python
from PigeonHole_Sort import pigeonhole_sort

arr = [4, 5, 3, 2, 1]
print("Original array:", arr)
writes = pigeonhole_sort(arr)
print("Sorted array:", arr)
27 changes: 27 additions & 0 deletions Data Structures and Algorithms/queues.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class Queue:
def __init__(self):
self.queue = []

def enqueue(self, item):
self.queue.append(item)

def dequeue(self):
if not self.is_empty():
return self.queue.pop(0)
return "Queue is empty"

def is_empty(self):
return len(self.queue) == 0

def peek(self):
return self.queue[0] if not self.is_empty() else None

def size(self):
return len(self.queue)

# Example Usage
q = Queue()
q.enqueue(10)
q.enqueue(20)
print(q.dequeue()) # Output: 10
print(q.peek()) # Output: 20
3 changes: 3 additions & 0 deletions FLASK PROJECTS/Anniversary time/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Anniversary Timing

Simple timing page implemented using flask
17 changes: 17 additions & 0 deletions FLASK PROJECTS/Anniversary time/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from flask import Flask, render_template
from datetime import datetime

app = Flask(__name__)

# 在此定义纪念日日期
anniversary_date = datetime(2024, 6, 16)

@app.route('/')
def index():
current_date = datetime.now()
delta = current_date - anniversary_date
days_passed = delta.days
return render_template('index.html', days_passed=days_passed, anniversary_date=anniversary_date.strftime("%Y-%m-%d %H:%M:%S"))

if __name__ == '__main__':
app.run(debug=False)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions FLASK PROJECTS/Anniversary time/static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background: url('background.jpg') no-repeat center center fixed;
background-size: cover;
color: white;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

.container {
text-align: center;
background-color: rgba(0, 0, 0, 0.5);
padding: 20px;
border-radius: 10px;
}

h1 {
font-size: 3em;
}

.time {
font-size: 2em;
margin-top: 20px;
}

.time span {
font-weight: bold;
}
39 changes: 39 additions & 0 deletions FLASK PROJECTS/Anniversary time/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Anniversary</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
<script>
function updateTimer() {
const anniversaryDate = new Date("{{ anniversary_date }}");
const currentDate = new Date();
const timeDiff = currentDate - anniversaryDate;

const days = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
const hours = Math.floor((timeDiff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((timeDiff % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeDiff % (1000 * 60)) / 1000);

document.getElementById("days").innerText = days;
document.getElementById("hours").innerText = hours;
document.getElementById("minutes").innerText = minutes;
document.getElementById("seconds").innerText = seconds;
}

setInterval(updateTimer, 1000);
</script>
</head>
<body onload="updateTimer()">
<div class="container">
<h1>It has passed the xx anniversary</h1>
<div class="time">
<span id="days">0</span>
<span id="hours">0</span> 小时
<span id="minutes">0</span> 分钟
<span id="seconds">0</span>
</div>
</div>
</body>
</html>
133 changes: 133 additions & 0 deletions OTHERS/Encryption/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@

# 🔐 Simple Symmetric Encryption in Python

This project demonstrates the basics of **symmetric encryption** using Python and the [`cryptography`](https://cryptography.io/en/latest/) library. It's a great starting point for beginners interested in **cybersecurity**, **cryptography**, or contributing to **open-source security tools**.

---

## 📚 What You'll Learn

- How to generate secure keys
- How to encrypt and decrypt messages
- Basic key management (saving & loading keys)
- How `Fernet` (AES-based encryption) works under the hood

---

## 🚀 Getting Started

### 1. Clone the Repository

```bash
git clone https://github.com/your-username/simple-encryption-python.git
cd simple-encryption-python
```

### 2. Install Dependencies

Make sure you have Python 3.6+ installed.

Install required package using `pip`:

```bash
pip install cryptography
```

### 3. Run the Code

```bash
python simple_encryption.py
```

On first run, it will generate a `secret.key` file that is used for both encryption and decryption. Each time you run the script, it:
- Loads the existing key
- Encrypts a sample message
- Decrypts it back and displays the result

---

## 📂 File Structure

```
simple-encryption-python/
├── simple_encryption.py # Main script to run encryption and decryption
├── secret.key # Auto-generated AES-based symmetric key (DO NOT SHARE)
├── README.md # Documentation
```

---

## 🔒 Security Note

This example is for educational purposes only. If you’re building a production-grade application:
- Never store raw keys in plaintext
- Use environment variables or secure vaults (e.g., AWS KMS, HashiCorp Vault)
- Handle exceptions and errors securely

---

## 🧠 How It Works (In Brief)

- **Fernet** is a module in the `cryptography` package that provides:
- AES-128 in CBC mode
- HMAC-SHA256 authentication
- Random IVs for each encryption

- The encryption key is:
- Generated once and saved to `secret.key`
- Loaded on subsequent runs

- The message is:
- Encrypted using `.encrypt()`
- Decrypted using `.decrypt()`

---

## 💡 Sample Output

```
[*] Key loaded from 'secret.key'
Original Message: This is a secret message.
Encrypted Message: b'gAAAAABlZ...'
Decrypted Message: This is a secret message.
```

---

## 🤝 Contributing

Contributions are welcome! You can help by:
- Improving the CLI interface
- Adding file encryption support
- Implementing password-based key derivation
- Writing unit tests

To contribute:
1. Fork the repo
2. Create a new branch (`git checkout -b my-feature`)
3. Commit your changes
4. Push and create a Pull Request

---

## 📜 License

This project is licensed under the **MIT License**. See [LICENSE](LICENSE) for details.

---

## 👨‍💻 Author

**Afolabi Adewale**
A data and security enthusiast exploring the intersection of Python, encryption, and open-source software.
[GitHub Profile](https://github.com/your-username)

---

## 🔗 Related Resources

- [Python `cryptography` docs](https://cryptography.io/en/latest/)
- [Understanding Symmetric vs Asymmetric Encryption](https://www.cloudflare.com/learning/ssl/how-does-ssl-work/)
- [OWASP Crypto Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html)
72 changes: 72 additions & 0 deletions OTHERS/Encryption/symmetricEncryption.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# simple_encryption.py

"""
A simple example of symmetric encryption using Python's 'cryptography' package.
This script:
1. Generates a secure encryption key
2. Encrypts a message using the key
3. Decrypts it back to the original message
Author: Afolabi Adewale
"""

from cryptography.fernet import Fernet

# 1. Generate a key for encryption and decryption
def generate_key():
"""
Generates a symmetric key for Fernet (uses AES encryption internally).
"""
key = Fernet.generate_key()
with open("secret.key", "wb") as key_file:
key_file.write(key)
print("[+] Key generated and saved to 'secret.key'")
return key

# 2. Load the existing key from file
def load_key():
"""
Loads the previously generated key from the file.
"""
return open("secret.key", "rb").read()

# 3. Encrypt a message
def encrypt_message(message: str, key: bytes) -> bytes:
"""
Encrypts a message using the provided symmetric key.
"""
f = Fernet(key)
encrypted = f.encrypt(message.encode())
return encrypted


# 4. Decrypt a message
def decrypt_message(encrypted_message: bytes, key: bytes) -> str:
"""
Decrypts an encrypted message using the same symmetric key.
"""
f = Fernet(key)
decrypted = f.decrypt(encrypted_message)
return decrypted.decode()

# 5. Main runner
if __name__ == "__main__":
# Create or load the key
try:
key = load_key()
print("[*] Key loaded from 'secret.key'")
except FileNotFoundError:
key = generate_key()

# Example message
message = "This is a secret message."
print(f"\nOriginal Message: {message}")

# Encrypt it
encrypted = encrypt_message(message, key)
print(f"Encrypted Message: {encrypted}")

# Decrypt it
decrypted = decrypt_message(encrypted, key)
print(f"Decrypted Message: {decrypted}")
21 changes: 21 additions & 0 deletions PYTHON APPS/ResolutionSwapper/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Resolution
This is a small application for switching monitor resolution without having to go into your computer settings. Very useful if you have an older system, and are having trouble running newer/more demanding games.

# Prerequisites
pywintypes
win32con
win32api
time
Pyinstaller (optional, but recommended)

# Usage
This app currently features 720p, 1080p and 1440p resolutions. If you wish to add more, add them in the same format as the other resolutions. The number is a string, so you could choose to set the input to letters if that is your preference.

When run, the app will create a popup terminal for you to enter the resolution you want. It will first check if what you input is valid, then set your monitor's resolution based on the preset dimensions.

# Export to exe
For ease of use, I'd recommend exporting this to an exe using pyinstaller.
Instructions for this can be found here -
```https://pyinstaller.org/en/stable/usage.html```
From there, create a shortcut to have it on your taskbar. To set the image, you can use any image you choose, but it will need to be in a .ico format. You can find converters to make these from other formats online.
That done, simply click on the icon, then enter your resolution in the terminal popup (only the width).
30 changes: 30 additions & 0 deletions PYTHON APPS/ResolutionSwapper/ResolutionMulti.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import pywintypes
import win32con
import win32api
import time


devmode = pywintypes.DEVMODEType()
valid = 0
while valid == 0:
heightinp = input('Set resolution: -- ')
if heightinp in ['720','1080','1440']:
valid += 1
else:
print('Invalid resolution. Please try again')
time.sleep(2)


if heightinp == '720':
devmode.PelsWidth = 1280
devmode.PelsHeight =720
if heightinp == '1080':
devmode.PelsWidth = 1920
devmode.PelsHeight =1080
if heightinp == '1440':
devmode.PelsWidth = 2560
devmode.PelsHeight = 1440

devmode.Fields = win32con.DM_PELSWIDTH | win32con.DM_PELSHEIGHT

win32api.ChangeDisplaySettings(devmode, 0)
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -113,15 +113,16 @@ guide [HERE](https://github.com/larymak/Python-project-Scripts/blob/main/CONTRIB
| 64 | [Umbrella Reminder](https://github.com/larymak/Python-project-Scripts/tree/main/TIME%20SCRIPTS/Umbrella%20Reminder) | [Edula Vinay Kumar Reddy](https://github.com/vinayedula) |
| 65 | [Image to PDF](https://github.com/larymak/Python-project-Scripts/tree/main/IMAGES%20%26%20PHOTO%20SCRIPTS/Image%20to%20PDF) | [Vedant Chainani](https://github.com/Envoy-VC) |
| 66 | [KeyLogger](https://github.com/larymak/Python-project-Scripts/tree/main/OTHERS/KeyLogger) | [Akhil](https://github.com/akhil-chagarlamudi) |
| 67 | [PDF Text Extractor](https://github.com/SamAddy/Python-project-Scripts/tree/main/PYTHON%20APPS/PDF-Text-Extractor) | [Samuel Addison](https://github.com/SamAddy)
| 68 | [Analyze docx file](https://github.com/larymak/Python-project-Scripts/tree/main/AUTOMATION/analyzing%20and%20writing%20.docx%20file) | [Kashaan Mahmood](https://github.com/Kashaan-M)
| 69 | [Bitcoin Price](https://github.com/larymak/Python-project-Scripts/tree/main/WEB%20SCRAPING/Bitcoin%20Price) | [Olu-Olagbuji Delight](https://github.com/Dheelyte)
| 70 | [Password Generator](https://github.com/larymak/Python-project-Scripts/tree/main/GUI/Password%20Generator) | [LpCodes](https://github.com/LpCodes)
| 71 | [HTML to Excel](https://github.com/larymak/Python-project-Scripts/tree/main/CONVERSION%20SCRIPTS/HTML%20to%20Excel) | [LpCodes](https://github.com/LpCodes)
| 67 | [PDF Text Extractor](https://github.com/SamAddy/Python-project-Scripts/tree/main/PYTHON%20APPS/PDF-Text-Extractor) | [Samuel Addison](https://github.com/SamAddy)|
| 68 | [Analyze docx file](https://github.com/larymak/Python-project-Scripts/tree/main/AUTOMATION/analyzing%20and%20writing%20.docx%20file) | [Kashaan Mahmood](https://github.com/Kashaan-M)|
| 69 | [Bitcoin Price](https://github.com/larymak/Python-project-Scripts/tree/main/WEB%20SCRAPING/Bitcoin%20Price) | [Olu-Olagbuji Delight](https://github.com/Dheelyte) |
| 70 | [Password Generator](https://github.com/larymak/Python-project-Scripts/tree/main/GUI/Password%20Generator) | [LpCodes](https://github.com/LpCodes) |
| 71 | [HTML to Excel](https://github.com/larymak/Python-project-Scripts/tree/main/CONVERSION%20SCRIPTS/HTML%20to%20Excel) | [LpCodes](https://github.com/LpCodes) |
| 72 | [Star pattern](https://github.com/larymak/Python-project-Scripts/tree/main/OTHERS/Star%20pattern) | [LpCodes](https://github.com/LpCodes) |
| 73 | [Logging Helper](https://github.com/larymak/Python-project-Scripts/tree/main/OTHERS/add-multiprocessing-logger) | [Jerry W.](https://github.com/Jerry0420) |
| 74 | [Notepad](https://github.com/larymak/Python-project-Scripts/tree/main/PYTHON%20APPS/Notepad) | [Annarhysa Albert](https://github.com/Annarhysa) |
| 75 | [Quadratic Equation Solver](https://github.com/larymak/Python-project-Scripts/tree/main/GUI/Quadratic-Equation-Solver) | [Akinfenwa Ezekiel](https://github.com/Ezek-iel) |
| 76 | [Internet Connectivity Monitor](https://github.com/larymak/Python-project-Scripts/tree/main/AUTOMATION/InternetConnectivityMonitor) | [Prince Khunt](https://github.com/princekhunt) |
| 76 | [E-commerce](https://github.com/larymak/Python-project-Scripts/tree/main/FLASK%20PROJECTS/E-commerce) | [Eter Nada](https://github.com/tarenjk24) |

| 77 | [Resolution Swapper](https://github.com/larymak/Python-project-Scripts/tree/main/PYTHON%20APPS/ResolutionSwapper) | [KnightBlue](https://github.com/KnightBlue14) |
| 78 | [Anniversary time](https://github.com/larymak/Python-project-Scripts/tree/main/FLASK%20PROJECTS/Anniversary%20time) | [gyyzzz](https://github.com/gyyzzz) |
1 change: 1 addition & 0 deletions gemini chatbot/Gemini-Chatbot
Submodule Gemini-Chatbot added at 9d3c59
24 changes: 24 additions & 0 deletions gemini chatbot/chatbot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import google.generativeai as genai

genai.configure(api_key="GOOGLE_GEMINI_API_KEY")

model = genai.GenerativeModel("gemini-1.5-flash")

chat = model.start_chat(history=[])

def chat_with_gemini():
print("🤖 Gemini ChatBot (type 'exit' to quit)")
while True:
user_input = input("You: ")
if user_input.lower() in ["exit", "quit"]:
print("Bot: Goodbye 👋")
break

try:
response = chat.send_message(user_input)
print("Bot:", response.text)
except Exception as e:
print("⚠️ Error:", e)

if __name__ == "__main__":
chat_with_gemini()
19 changes: 19 additions & 0 deletions gemini chatbot/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---------------------------------------------- Gemini ChatBot 🤖 ----------------------------------------------

Welcome to the Gemini ChatBot Project — an intelligent, Python-based chatbot powered by Google’s Gemini 1.5 Flash model. This project allows you to have smart, interactive conversations directly in the terminal. It’s ideal for developers, students, or hobbyists exploring Generative AI and conversational interfaces. Whether you're curious about large language models or looking to contribute to open-source AI tools, this chatbot is a perfect place to start.

The Gemini ChatBot maintains conversation history, enabling more context-aware and meaningful interactions. It uses Google’s official Generative AI Python SDK to communicate with the Gemini API. The code is written for clarity and modularity, making it easy to customize, extend, and learn from.

To get started, you’ll need Python 3.8 to 3.10 installed on your machine (Python 3.13 may not be fully compatible yet) and an API key from Google AI Studio, which you can obtain for free. The chatbot is designed to run in a command-line environment and responds to your input in real-time, simulating a natural conversation. You can modify the script to integrate it into other platforms later, such as a web app or a GUI interface.

To ensure clean package management and avoid conflicts with other Python projects, it’s recommended to set up a Conda environment. Start by opening Anaconda Prompt or your terminal, then create a new environment with Python 3.10. Once the environment is created and activated, you can install the required google-generativeai package using pip. After that, you're ready to run the chatbot.

To launch the chatbot, navigate to the project folder in your terminal and run the Python script. The chatbot will start with a greeting and wait for your input. Simply type anything you’d like to ask or discuss. You can chat freely, and the model will respond with AI-generated replies. To end the session at any time, just type “exit” or “quit,” and the chatbot will close the conversation with a goodbye message.

The project folder is organized for simplicity and ease of use. The main script is chatbot.py, where all the chatbot logic is implemented. The requirements.txt file contains a list of dependencies, so others can easily replicate your environment using pip. A .gitignore file is included to exclude virtual environment folders and temporary files from version control.

Looking ahead, there are many exciting directions this project could take. You can add a web interface using Streamlit or Flask, implement support for file or image inputs using Gemini Pro Vision, enable chat logging to save previous conversations, or even integrate secure key storage using environment variables. These enhancements are perfect opportunities for open-source contributions.

If you’d like to contribute, you’re welcome to fork the repository, create your own feature branch, and submit a pull request. Feedback, improvements, and new ideas are encouraged — collaboration is at the heart of open-source.

Thank you for checking out the Gemini ChatBot! Whether you’re here to learn, experiment, or build, we hope this project helps you get one step closer to the future of AI-powered applications. Let’s build something incredible together. 🚀
1 change: 1 addition & 0 deletions gemini chatbot/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
google-generativeai>=0.3.2