DEV Community

Orbit Websites
Orbit Websites

Posted on

Week's Win Achievements: Personal Triumphs and Tech Innovations

Week's Win Achievements: Personal Triumphs and Tech Innovations

Celebrating small wins is one of the best ways to stay motivatedโ€”especially in tech, where progress can feel slow. In this article, Iโ€™ll walk you through real, beginner-friendly wins from my past week, both personal and technical. Each win includes step-by-step code examples, practical tips, and how you can apply them to your own journey.

Letโ€™s dive in.


๐ŸŽฏ Win #1: Automated My Morning Routine with Python

Problem: I kept forgetting to check the weather and my calendar before starting work.

Solution: I built a simple Python script that runs at startup and tells me the weather, upcoming events, and motivational quote.

Step 1: Install Required Libraries

pip install requests google-api-python-client google-auth-httplib2 google-auth-oauthlib
Enter fullscreen mode Exit fullscreen mode

Step 2: Get Weather Using OpenWeatherMap API

import requests

def get_weather(city="London"):
    API_KEY = "your_openweather_api_key"
    url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={API_KEY}&units=metric"
    response = requests.get(url)
    data = response.json()
    temp = data['main']['temp']
    description = data['weather'][0]['description']
    return f"๐ŸŒค๏ธ {temp}ยฐC, {description}"

print(get_weather("San Francisco"))
Enter fullscreen mode Exit fullscreen mode

๐Ÿ”‘ Get your free API key at openweathermap.org

Step 3: Fetch Google Calendar Events

Set up Google Calendar API (follow quickstart guide).

from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
import datetime

SCOPES = ['https://www.googleapis.com/auth/calendar.readonly']

def get_calendar_events():
    creds = None
    if os.path.exists('token.json'):
        creds = Credentials.from_authorized_user_file('token.json', SCOPES)
    if not creds or not creds.valid:
        if creds and creds.expired and creds.refresh_token:
            creds.refresh(Request())
        else:
            flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES)
            creds = flow.run_local_server(port=0)
        with open('token.json', 'w') as token:
            token.write(creds.to_json())

    service = build('calendar', 'v3', credentials=creds)
    now = datetime.datetime.utcnow().isoformat() + 'Z'
    events_result = service.events().list(calendarId='primary', timeMin=now,
                                          maxResults=5, singleEvents=True,
                                          orderBy='startTime').execute()
    events = events_result.get('items', [])

    if not events:
        return "โœ… No upcoming events"
    return "๐Ÿ“… " + ", ".join([event['summary'] for event in events[:3]])
Enter fullscreen mode Exit fullscreen mode

Step 4: Combine and Run

import random

quotes = [
    "Code every day. Even if it's just 10 lines.",
    "Progress > perfection.",
    "You're closer than you were yesterday."
]

def morning_brief():
    print("๐ŸŒž Good morning!")
    print(get_weather("Austin"))
    print(get_calendar_events())
    print("๐Ÿ’ฌ", random.choice(quotes))

if __name__ == "__main__":
    morning_brief()
Enter fullscreen mode Exit fullscreen mode

โœ… Win: Runs on startup via cron (Linux/Mac) or Task Scheduler (Windows). Saves me 5 minutes daily.


๐ŸŽฏ Win #2: Fixed a Bug That Took Me 3 Days (Spoiler: It Was a Typo)

Problem: My Flask app kept returning 500 Internal Server Error on login.

@app.route('/login', methods=['POST'])
def login():
    username = request.form['username']
    password = request.form['password']

    # BUG: Used '==' instead of '=' in assignment
    user == User.query.filter_by(username=username).first()  # โŒ

    if user and check_password(user.password, password):
        return redirect('/dashboard')
    return "Invalid credentials"
Enter fullscreen mode Exit fullscreen mode

Debugging Steps:

  1. Added logging:
import logging
logging.basicConfig(level=logging.DEBUG)
Enter fullscreen mode Exit fullscreen mode
  1. Used print() to trace:
print("Username:", username)  # Confirmed input was correct
Enter fullscreen mode Exit fullscreen mode
  1. Checked traceback:
UnboundLocalError: local variable 'user' referenced before assignment
Enter fullscreen mode Exit fullscreen mode

Fix: Simple typo โ€” changed == to =.

user = User.query.filter_by(username=username).first()  # โœ…
Enter fullscreen mode Exit fullscreen mode

๐Ÿ’ก Lesson: Always use linters (pylint, flake8) and enable debug mode:

app.run(debug=True)
Enter fullscreen mode Exit fullscreen mode

๐ŸŽฏ Win #3: Built a GitHub Stats Card for My Profile

I wanted to show my coding activity on my GitHub profile README.

Step 1: Create README.md in Your Profile Repo

Make a repo named yourusername/yourusername (e.g., johndoe/johndoe).

Step 2: Use GitHub Readme Stats

Add this to your README.md:


markdown
[![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=johndoe&show_icons=true&theme=radical)](https://github.com/anuraghazra/github-readme-stats)

[

---

โ˜• **Professional**
Enter fullscreen mode Exit fullscreen mode

Top comments (0)