-
Notifications
You must be signed in to change notification settings - Fork 962
Gyyzzz branch #409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Gyyzzz branch #409
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
Data Structures and Algorithms/queues.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Binary file added
FLASK PROJECTS/Anniversary time/static/background.jpg
32 changes: 32 additions & 0 deletions
FLASK PROJECTS/Anniversary time/static/style.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.