diff --git a/README.md b/README.md index c60084d7..ed8e66cf 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol * [clone-repos.ps1](Scripts/clone-repos.ps1) - clones well-known Git repositories * [configure-git.ps1](Scripts/configure-git.ps1) - sets up the Git configuration * [download.ps1](Scripts/download.ps1) - downloads the file/directory from the given URL +* [earthquakes.ps1](Scripts/earthquakes.ps1) - prints the stronger earthquakes for the last 30 days * [empty-dir.ps1](Scripts/empty-dir.ps1) - empties the given directory * [enable-crash-dumps.ps1](Scripts/enable-crash-dumps.ps1) - enables the writing of crash dumps * [inspect-exe.ps1](Scripts/inspect-exe.ps1) - prints basic information of the given executable file diff --git a/Scripts/earthquakes.ps1 b/Scripts/earthquakes.ps1 new file mode 100755 index 00000000..e5c1a24d --- /dev/null +++ b/Scripts/earthquakes.ps1 @@ -0,0 +1,20 @@ +#!/snap/bin/powershell + +# Syntax: ./earthquakes.ps1 +# Description: prints the stronger earthquakes for the last 30 days +# Author: Markus Fleschutz +# Source: github.com/fleschutz/PowerShell +# License: CC0 + +$Format="csv" # csv, geojson, kml, text, xml +$Order="time" # time, time-asc, magnitude, magnitude-asc +$MinMagnitude=6.0 + +try { + Write-Progress "Querying earthquakes for the last 30 days ..." + (Invoke-WebRequest -Uri "https://earthquake.usgs.gov/fdsnws/event/1/query?format=$Format&orderby=$Order&minmagnitude=$MinMagnitude" -UserAgent "curl" ).Content + exit 0 +} catch { + Write-Error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +}