mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-16 07:38:15 +02:00
Renamed to list-earthquakes.ps1
This commit is contained in:
20
Scripts/list-earthquakes.ps1
Executable file
20
Scripts/list-earthquakes.ps1
Executable file
@ -0,0 +1,20 @@
|
||||
#!/snap/bin/powershell
|
||||
|
||||
# Syntax: ./list-earthquakes.ps1
|
||||
# Description: lists earthquakes >= 6.0 for the last 30 days
|
||||
# Author: Markus Fleschutz
|
||||
# Source: github.com/fleschutz/PowerShell
|
||||
# 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
|
||||
}
|
Reference in New Issue
Block a user