Added earthquakes.ps1

This commit is contained in:
Markus Fleschutz 2020-12-14 19:28:21 +00:00
parent 4c9a6b2390
commit d66a10c6a2
2 changed files with 21 additions and 0 deletions

View File

@ -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

20
Scripts/earthquakes.ps1 Executable file
View File

@ -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
}