mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-25 08:09:17 +01:00
21 lines
667 B
PowerShell
Executable File
21 lines
667 B
PowerShell
Executable File
#!/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
|
|
}
|