Skip to content

Commit a80aa96

Browse files
authored
Merge branch 'king04aman:main' into feature/crypto-tracker
2 parents 7f01337 + 90a36fe commit a80aa96

19 files changed

+588
-14
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
### Project Suggestion Title
2+
_A concise title for your project suggestion._
3+
4+
### Description
5+
_Provide a detailed description of the project idea or feature you would like to propose._
6+
7+
### Benefits
8+
_Explain how this project or feature would benefit the community or improve the existing repository._
9+
10+
### Implementation Ideas
11+
_Offer any initial thoughts on how the project could be implemented, including potential technologies or approaches._
12+
13+
### Additional Context
14+
_Include any other relevant information, links, or references that might help._
15+
16+
### Suggested Contributors
17+
_If you have specific contributors in mind who might be interested in this project, please list them here._

.github/pull_request_template.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### Developer Checklist
2+
- [ ] Adhered to the guidelines outlined in the README & Contributing file.
3+
- [ ] Maintained the correct directory structure (e.g., ProjectName/...yourfiles).
4+
- [ ] Please ensure to include a README file for enhanced project clarity.
5+
- [ ] Starred ⭐ the repository (optional).
6+
7+
### Summary
8+
###### _Please provide a brief summary here._
9+
10+
### Screenshot
11+
###### _Attach any relevant screenshots or GIFs here._
12+
13+
### Live Project Link
14+
###### _Include a link to the live project here._

.github/workflows/contributors.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Contributors
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
7+
jobs:
8+
contributors:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: wow-actions/contributors-list@v1
12+
with:
13+
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}
14+
round: true
15+
svgPath: CONTRIBUTORS.svg
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Generate Project List
2+
3+
on:
4+
schedule:
5+
- cron: 0 0 * * *
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
generate-list:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
with:
17+
token: ${{ secrets.ACTION_TOKEN }}
18+
persist-credentials: true
19+
20+
- name: Fetch latest changes
21+
run: git fetch origin
22+
23+
- name: Merge changes
24+
run: |
25+
git merge origin/main || echo "No new changes to merge or merge conflict"
26+
27+
- name: Generate project list
28+
run: |
29+
exclude_dirs=(.github)
30+
exclude_files=("LICENSE" "README.md" "CONTRIBUTING.md" "Example README.md" "CODE_OF_CONDUCT.md" "PROJECTS.md")
31+
32+
projects=()
33+
for dir in */; do
34+
if [[ ! " ${exclude_dirs[@]} " =~ " ${dir%/} " ]]; then
35+
projects+=("$dir")
36+
fi
37+
done
38+
39+
echo "# Project List" > PROJECTS.md
40+
echo "" >> PROJECTS.md
41+
42+
for project in "${projects[@]}"; do
43+
project_name=${project%/}
44+
safe_project_name=${project_name// /%20}
45+
echo "* [$project_name](https://github.com/king04aman/All-In-One-Python-Projects/tree/main/$safe_project_name)" >> PROJECTS.md
46+
done
47+
48+
for file in "${exclude_files[@]}"; do
49+
sed -i "/$file/d" PROJECTS.md
50+
done
51+
52+
# Debug output to check the content of PROJECTS.md
53+
cat PROJECTS.md
54+
55+
- name: Commit project list
56+
run: |
57+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
58+
git config --global user.name "github-actions[bot]"
59+
git add PROJECTS.md
60+
if ! git diff --cached --exit-code; then
61+
git commit -m "Update project list"
62+
git push --force-with-lease
63+
else
64+
echo "No changes to commit."
65+
fi
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}

.github/workflows/welcome.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: New Contributor Welcome
2+
3+
permissions:
4+
issues: write
5+
pull-requests: write
6+
7+
on:
8+
pull_request:
9+
types: [opened, closed]
10+
issues:
11+
types: [opened]
12+
13+
jobs:
14+
greet_new_contributor:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: wow-actions/[email protected]
18+
with:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
FIRST_ISSUE_REACTIONS: "+1, hooray, rocket, heart"
21+
FIRST_ISSUE: >
22+
👋 Greetings @{{ author }}!
23+
24+
We're thrilled to see you opening your first issue! Your input is invaluable to us. Don’t forget to adhere to our issue template for the best experience.
25+
26+
FIRST_PR: >
27+
👋 Welcome aboard, @{{ author }}!
28+
29+
We're delighted to have your first pull request! Please take a moment to check our contributing guidelines to ensure a smooth process.
30+
31+
FIRST_PR_MERGED: >
32+
🎉 Kudos @{{ author }}!
33+
34+
You've just merged your first pull request! We're excited to have you in our community. Keep up the fantastic contributions!
35+
STAR_MESSAGE: If you enjoy this project, please consider ⭐ starring ⭐ our repository!
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CONTRIBUTORS.svg

Lines changed: 24 additions & 0 deletions
Loading

Geographic Distance/README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Geographic Distance and Travel Time Calculator
2+
3+
This Python script calculates the geodesic distance between two geographic coordinates and estimates travel time based on a given average speed. It uses the geopy library to compute distances.
4+
5+
## Features
6+
7+
- Input coordinates for two locations (latitude and longitude) interactively.
8+
- Calculate the distance between the two coordinates in kilometers.
9+
- Estimate the travel time based on a given average speed (in km/h).
10+
11+
## Prerequisites
12+
13+
- Python 3.x installed on your system.
14+
15+
## Setup
16+
17+
1. Clone the repository
18+
19+
```bash
20+
git clone https://github.com/king04aman/All-In-One-Python-Projects.git
21+
cd All-In-One-Python-Projects/Geographic Distance
22+
```
23+
24+
2. Create and activate a virtual environment
25+
26+
- For macOS/Linux:
27+
28+
```bash
29+
python3 -m venv venv
30+
source venv/bin/activate
31+
```
32+
33+
- For Windows:
34+
35+
```bash
36+
python -m venv venv
37+
venv\Scripts\activate
38+
```
39+
40+
3. Install the required dependencies
41+
42+
The required packages are listed in requirements.txt. Install them using the following command:
43+
44+
```bash
45+
pip install -r requirements.txt
46+
```
47+
48+
Note: The main dependency is geopy for calculating distances based on geodesic coordinates.
49+
50+
## Usage
51+
52+
1. Run the script:
53+
54+
```bash
55+
python geographic_distance.py
56+
```
57+
58+
2. Enter the coordinates (latitude and longitude) of the two locations when prompted.
59+
3. Enter the average speed in km/h to calculate the travel time.
60+
61+
Example input:
62+
63+
```
64+
Enter the latitude and longitude of the first location (lat1, lon1) Example: 40.7128, -74.006: 52.5200, 13.4050
65+
Enter the latitude and longitude of the second location (lat2, lon2) Example: 37.7749, -122.4194: 48.8566, 2.3522
66+
Enter the average speed in km/h Example: 60: 80
67+
```
68+
69+
Example output:
70+
71+
```
72+
Distance between the two coordinates: 878.84 kilometers
73+
Estimated travel time: 10.99 hours
74+
```
75+
76+
## Requirements
77+
78+
Here’s a list of Python dependencies in requirements.txt:
79+
80+
```
81+
geopy==2.2.0
82+
pytest==8.3.3
83+
```
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
from geopy.distance import geodesic
2+
3+
4+
def calculate_distance_and_time(coord1, coord2, avg_speed):
5+
"""
6+
Calculate the distance between two coordinates and estimate travel time.
7+
:param coord1: Tuple containing the latitude and longitude of the first location (lat1, lon1)
8+
:param coord2: Tuple containing the latitude and longitude of the second location (lat2, lon2)
9+
:param avg_speed: Average speed in km/h for estimating travel time
10+
:return: Distance in kilometers and estimated travel time in hours
11+
"""
12+
13+
# Calculate geodesic distance
14+
distance = geodesic(coord1, coord2).kilometers
15+
# Estimate travel time (distance / speed)
16+
travel_time = distance / avg_speed
17+
18+
return distance, travel_time
19+
20+
21+
def main():
22+
# Coordinates (latitude, longitude)
23+
try:
24+
coord1 = tuple(map(float, input('Enter the latitude and longitude of the first location (lat1, lon1) Example: 40.7128, -74.006: ').split(',')))
25+
coord2 = tuple(map(float, input('Enter the latitude and longitude of the second location (lat2, lon2) Example: 37.7749, -122.4194: ').split(',')))
26+
except ValueError as e:
27+
raise ValueError("Coordinates must be in the format 'lat, lon'") from e
28+
29+
if not all(-90 <= x <= 90 for x in (coord1[0], coord2[0])) or not all(-180 <= x <= 180 for x in (coord1[1], coord2[1])):
30+
raise ValueError('Invalid coordinates')
31+
32+
# Speed in km/h (e.g., driving speed)
33+
try:
34+
avg_speed = float(input('Enter the average speed in km/h Example: 60: '))
35+
except ValueError as e:
36+
raise ValueError('Average speed must be a number') from e
37+
38+
if avg_speed <= 0:
39+
raise ValueError('Average speed must be greater than 0.')
40+
41+
# Calculate the distance and travel time
42+
distance, travel_time = calculate_distance_and_time(coord1, coord2, avg_speed)
43+
44+
print(f'Distance between the two coordinates: {distance:.2f} kilometers')
45+
print(f'Estimated travel time: {travel_time:.2f} hours')
46+
47+
48+
if __name__ == '__main__':
49+
main()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
geopy==2.4.1
2+
pytest==8.3.3

Geographic Distance/runtime.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python-3.12.7

0 commit comments

Comments
 (0)