←back to thread

79 points jbreckmckye | 2 comments | | HN request time: 0.446s | source

I love the sunlight and dread the long, dark winter evenings of Northern Europe. I often look up sunrise / sunset times and count off the days until the darkness is gone.

Now I've written a terminal app for this (Mac/Linux)

Features: a colorful summary of daylight times for your location; projected change over the coming days; handles NO_COLOR and a ---short flag if you dislike the output format.

The location is IP-based but you can override this if you're on a VPN. Just create a terminal alias with the --loc flag. The app supports areas in the arctic / antarctic circle too.

Check our the repository for a preview and instructions on how you can install it with Homebrew.

(There is a Windows build but it's not yet tested)

Show context
rrr_oh_man ◴[] No.43340598[source]
Great looking app!!

I immediately checked how you do location lookups:

> IP lookup is powered by https://ipinfo.io. They provide a good service so please don't spam requests.

There was a thread about them recently — the scale of their operation was very surprising.

replies(2): >>43345929 #>>43351408 #
1. jbreckmckye ◴[] No.43345929[source]
It _is_ possible to use native OS APIs for location lookup, but these all seem to rely on cgo. Which was a bit intimidating for a "let's learn Golang" project

(Probably not the nicest code and no doubt I've broken a lot of Go idioms, but it was a good learning exercise)

IPInfo is a good service and their developer relations were surprisingly relaxed about me (mis)using their API this way

replies(1): >>43351451 #
2. reincoder ◴[] No.43351451[source]
"Surprisingly relaxed," you say. Let me tell you about the time our users reverse-engineered our apps, submitted 2.2 million IPs, and broke our systems for our hackathon.

https://ipinfo.io/blog/ipinfos-ip-hunt-2-2-million-ips-submi...

This is just our user base, to be honest and we like them for their mindset. We are happy to see users try our service in different ways and we learn a ton from them in that process. I certainly learned from you :)