Useful tools for Codeforces users(On the macOS)
A lightweight Python script that monitors your friends' Codeforces submissions in real-time. It sends instant macOS notifications and plays system sounds whenever a friend submits a solution.
- Real-time Monitoring: Automatically polls the Codeforces API at a configurable interval.
- Native macOS Alerts: Uses
osascriptfor pop-up notifications andafplayfor system sounds. - Customizable Settings:
- Adjustable check frequency (in seconds).
- Multiple sound options (Ping, Glass, Hero, Funk, etc.).
- Detailed Logs: Prints problem name, verdict, and timestamp directly to your terminal.
- Operating System: macOS (required for native sound/notification features)
- Python: Version 3.6+
- Library:
requests
Install the required library:
pip install requests-
Save the script code into a file named
cf_monitor.py. -
Run the script via your terminal:
python3 cf_monitor.py
-
Follow the Prompts:
- Enter your own Codeforces handle.
- Enter the list of friends' handles separated by commas (e.g.,
tourist,petr,ecnal-kcm). - Set the checking interval (default is 60 seconds).
- Select a preferred notification sound.
- Initialization: Upon starting, the script fetches the latest 5 submissions from each friend to "sync" history. This ensures you are only alerted about future submissions, not old ones.
- Loop: It runs an infinite loop, sleeping for the defined interval between checks.
- Alert Trigger: If a new submission ID is found, it triggers the sound, pushes the macOS notification, and prints the info to the console.
Press Ctrl+C at any time to stop the monitor gracefully.
This tool uses the public Codeforces API. Please respect their rate limits (this script is designed to be lightweight). Free to use and modify.