Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file modified currencyconverter/.gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
68 changes: 68 additions & 0 deletions pomodoro-Timer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# πŸ… Pomodoro Timer

A terminal-based Pomodoro Timer that helps you stay focused using the [Pomodoro Technique](https://en.wikipedia.org/wiki/Pomodoro_Technique).

## πŸ“Έ Preview

```
╔══════════════════════════════════════╗
β•‘ πŸ… POMODORO TIMER πŸ… β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Phase : πŸ”΄ FOCUS β€” Work Session
Cycle : 1 / 4

Time : 24:13

[β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘] 40%

Press Ctrl+C to quit.
```

## ⏱️ How It Works

The Pomodoro Technique breaks work into focused intervals:

| Phase | Duration |
|--------------|-----------|
| Work session | 25 minutes |
| Short break | 5 minutes |
| Long break | 15 minutes (after every 4 cycles) |

## πŸš€ Installation

No external libraries required β€” uses only Python's standard library.

```bash
git clone https://github.com/YOUR_USERNAME/100LinesOfCode.git
cd 100LinesOfCode/Pomodoro-Timer
```

## ▢️ Usage

```bash
python pomodoro.py
```

- Press **Enter** to start/continue each phase
- Press **Ctrl+C** at any time to quit

## βš™οΈ Customization

Edit the config at the top of `pomodoro.py`:

```python
WORK_MINS = 25 # Work session length
SHORT_BREAK = 5 # Short break length
LONG_BREAK = 15 # Long break length
CYCLES_BEFORE_LONG = 4 # Cycles before a long break
```

## πŸ› οΈ Technologies

- Python 3.x
- Standard library only (`time`, `sys`, `os`)

## πŸ“ Lines of Code

**81 lines** (excluding comments and blank lines)
77 changes: 77 additions & 0 deletions pomodoro-Timer/pomodoro.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import time
import sys
import os

WORK_MINS = 25
SHORT_BREAK = 5
LONG_BREAK = 15
CYCLES_BEFORE_LONG = 4

def beep(times=3):
for _ in range(times):
print("\a", end="", flush=True)
time.sleep(0.3)

def clear():
os.system("cls" if os.name == "nt" else "clear")

def format_time(seconds):
m, s = divmod(seconds, 60)
return f"{m:02d}:{s:02d}"

def countdown(label, duration_mins, cycle_info=""):
total = duration_mins * 60
bar_width = 30

for remaining in range(total, -1, -1):
elapsed = total - remaining
filled = int(bar_width * elapsed / total)
bar = "β–ˆ" * filled + "β–‘" * (bar_width - filled)
pct = int(100 * elapsed / total)

clear()
print("╔══════════════════════════════════════╗")
print("β•‘ πŸ… POMODORO TIMER πŸ… β•‘")
print("β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•")
print(f"\n Phase : {label}")
if cycle_info:
print(f" Cycle : {cycle_info}")
print(f"\n Time : {format_time(remaining)}")
print(f"\n [{bar}] {pct}%\n")
print(" Press Ctrl+C to quit.\n")

if remaining > 0:
time.sleep(1)

beep(3)

def run():
cycle = 0
print("\n Welcome to Pomodoro Timer!")
print(f" Work: {WORK_MINS}m | Short break: {SHORT_BREAK}m | Long break: {LONG_BREAK}m\n")
input(" Press Enter to start your first session...")

while True:
cycle += 1
info = f"{cycle} / {CYCLES_BEFORE_LONG}"
countdown("πŸ”΄ FOCUS β€” Work Session", WORK_MINS, info)
print("\n βœ… Work session complete!\n")


if cycle % CYCLES_BEFORE_LONG == 0:
print(f" πŸŽ‰ {CYCLES_BEFORE_LONG} cycles done! Time for a long break.\n")
input(" Press Enter to start your long break...")
countdown("🟒 LONG BREAK", LONG_BREAK)
else:
input(" Press Enter to start your short break...")
countdown("🟑 SHORT BREAK", SHORT_BREAK)

print("\n Break over! Ready for the next session?\n")
input(" Press Enter to continue...\n")

if __name__ == "__main__":
try:
run()
except KeyboardInterrupt:
print("\n\n πŸ‘‹ Session ended. Great work!\n")
sys.exit(0)
Loading