Last active
April 25, 2023 04:01
-
-
Save AspenForester/ce5f1e0ccb6920679abd94810662936e to your computer and use it in GitHub Desktop.
Gets the current local Lunar phased by assuming your location based on your public IP address, which isn't always accurate.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$PublicIP = (Invoke-WebRequest -uri 'https://api.ipify.org?format=json' | convertfrom-json).ip | |
$GeoInfo = Invoke-WebRequest -Uri "http://www.geoplugin.net/json.gp?ip=$PublicIP" | ConvertFrom-Json | |
$location = "$($GeoInfo.geoplugin_latitude),$($GeoInfo.geoplugin_longitude)" | |
$TZ = [TimeZoneInfo]::Local.BaseUtcOffset.Hours | |
$Now = Get-date -Format M/dd/yyyy | |
$uri = "http://api.usno.navy.mil/rstt/oneday?date=$Now&coords=$Location&TZ=$TZ" | |
$Astro = Invoke-WebRequest -Uri $uri | ConvertFrom-Json | |
$Astro.curphase | |
# GET https://atlas.microsoft.com/timezone/byCoordinates/json?api-version=1.0&options={options}&timeStamp={timeStamp}&transitionsFrom={transitionsFrom}&transitionsYears={transitionsYears}&query={query} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This could also be implemented with Invoke-RestMethod