kota.nz notes vids pics code about
It’s the dead of winter. I moved down here to Aotearoa just as it was warming up in the northern hemisphere, I skipped summer. It’s strange, but so much is new and exciting that it hasn’t bothered me all too much. I’ve been hiking more, exploring the region, and I’ve even gotten back into climbing. During the rainy and colder days I’ve been reading and programming. I’ve never lived near by the shore before and I’m really enjoying it. I decided I wanted to see the local tide height on my computer. LINZ puts out official tide predictions in the form of a CSV sheet. They have a formula for calculating the current height.
If t₁ and h₁ denote the time and height of the tide preceeding time t, and t₂ and h₂ denote the height of the tide following time t, then the height h at time t is given by the following formula. h = h₁ + (h₂ - h₁)[(cosA + 1)/2] A = π([t - t₁)/(t₂ - t₁)] + 1)
I went and wrote a little Go program that reads these CSV files and prints the current tide height along with a little ascii bar graph. It only prints the graph if the output is into a terminal. That way you can output it to a file or notification and it’ll just print the current height with either an up or down arrow.
You may notice the weather information in my notification. Once I finished up the tide program I turned to my next issue. I had been using https://wttr.in/ to show the temperature, but it doesn’t work as well in Aotearoa. After a quick search I found that the national weather service here hosts json files with the current weather forecast. I wrote a little Go module for reading this API. Then a few days later I wrote a command line tool to use my module. The command line tool doesn’t implement everything. I only added what I needed, but the module is pretty much complete with what I’ve discovered. If you live here and want to add to either I’ll merge in patches. The coding style is pretty straight forward – I took heavy inspiration from the go-github library.
The other thing I worked on recently is getting a gemini site online! I’ve been interested in gemini and reading gemlogs for the last year, but didn’t get around to putting up my own page until just now. Grab a gemini client like Amfora or Ariane and check out gemini://kota.nz.
If you’ve never used gemini before you can learn about from Drew’s post and the official project page. Once you have a client you can explore the gemini version of both those pages and checkout medusae.space for a lovely gemini directory. I’ll be writing about how I converted my site and some of my favourite gemlogs soon!