Skip to content

Instantly share code, notes, and snippets.

@ohaiibuzzle
Created April 21, 2025 09:24
Show Gist options
  • Save ohaiibuzzle/2e645707aba1125faf4d6ba70323f345 to your computer and use it in GitHub Desktop.
Save ohaiibuzzle/2e645707aba1125faf4d6ba70323f345 to your computer and use it in GitHub Desktop.
#!/bin/bash
API="https://api.open-meteo.com/v1/forecast?latitude=35.6895&longitude=139.69171&current=temperature_2m,relative_humidity_2m,apparent_temperature,is_day,precipitation,cloud_cover,wind_speed_10m,wind_direction_10m,wind_gusts_10m&timezone=Asia%2FBangkok&forecast_days=1"
curl --max-time 2 -s $API |
jq -r '"It'"'"'s currently "
+ (.current.temperature_2m | tostring)
+ (.current_units.temperature_2m | tostring) +
" with "
+ (.current.relative_humidity_2m | tostring)
+ (.current_units.relative_humidity_2m | tostring)
+ " relative humidity. The wind is "
+ (.current.wind_speed_10m | tostring)
+ (.current_units.wind_speed_10m | tostring)
+ " at "
+ (.current.wind_direction_10m | tostring)
+ (.current_units.wind_direction_10m | tostring)
+ " with "
+ (.current.cloud_cover | tostring)
+ (.current_units.cloud_cover | tostring)
+ " cloud cover"' || "Could not get weather data"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment