Skip to content

Instantly share code, notes, and snippets.

View santhoshvr's full-sized avatar
🏠
Working from home

Santhosh VR santhoshvr

🏠
Working from home
View GitHub Profile
@santhoshvr
santhoshvr / monitor_load_average_linux.sh
Last active November 20, 2024 11:07
This shell script monitors the server load average and sends an email notification if it exceeds a dynamically calculated threshold based on the number of CPU cores. It also identifies the process with the highest CPU usage. This script can be scheduled to run periodically using a cron job.
#/bin/bash
# Get the number of CPU cores
CPU_CORES=$(nproc)
# Calculate the threshold based on CPU cores, 0.7 -> indicates the 70% of CPU usage
THRESHOLD=$(echo "$CPU_CORES * 0.7" | bc -l)
# Email recipient
EMAIL="[email protected]"
"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------