mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-25 08:09:17 +01:00
21 lines
704 B
PowerShell
Executable File
21 lines
704 B
PowerShell
Executable File
#!/snap/bin/powershell
|
|
<#
|
|
.SYNTAX ./list-earthquakes.ps1
|
|
.DESCRIPTION lists earthquakes with magnitude >= 6.0 for the last 30 days
|
|
.LINK https://github.com/fleschutz/PowerShell
|
|
.NOTES Author: Markus Fleschutz / License: CC0
|
|
#>
|
|
|
|
$Format="csv" # csv, geojson, kml, text, xml
|
|
$MinMagnitude=6.0
|
|
$OrderBy="time" # time, time-asc, magnitude, magnitude-asc
|
|
|
|
try {
|
|
write-progress "Querying earthquakes for the last 30 days ..."
|
|
(Invoke-WebRequest -Uri "https://earthquake.usgs.gov/fdsnws/event/1/query?format=$Format&minmagnitude=$MinMagnitude&orderby=$OrderBy" -UserAgent "curl" ).Content
|
|
exit 0
|
|
} catch {
|
|
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
exit 1
|
|
}
|