Skip to content

Instantly share code, notes, and snippets.

@leo-aa88
Created February 18, 2024 21:40
Show Gist options
  • Save leo-aa88/18b4fbfa2c68da88933f1488158b8c75 to your computer and use it in GitHub Desktop.
Save leo-aa88/18b4fbfa2c68da88933f1488158b8c75 to your computer and use it in GitHub Desktop.
Xfce utilities (generic monitors)

Memory monitor

free | awk '/Mem:/ {printf("%.2f%%", $3/$2 * 100.0)}'

CPU monitor

mpstat 1 1 | awk '/Average:/ {printf("%.2f%%", 100 - $NF)}'

Temperature monitor (São Paulo Brazil)

# Define API URL and parameters
API_URL="https://api.open-meteo.com/v1/forecast"
LATITUDE="-23.5475"
LONGITUDE="-46.6361"
TIMEZONE="America/Sao_Paulo"

# Make the API request and store the response
response=$(curl -s "${API_URL}?latitude=${LATITUDE}&longitude=${LONGITUDE}&current_weather=true")

# Parse and print the necessary information from the response
current_temperature=$(echo $response | jq '.current_weather.temperature')
echo "${current_temperature}°C"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment