Mount Eggplant!

One of the 100 famous Japanese mountains in reach for a day hike from Tokyo is Mt Nasu (which in Japanese is a homophone with “eggplant”) in Tochigi. It’s easy (though not particularly cheap) to get there by (bullet) train and bus. This time I went for a quick hike to the Chausu peak (which is a much shorter climb than the highest Sanbon-yari). The weather wasn’t exactly great, cloudy and extremely windy, but at least it wasn’t dumping on me.


QUIC and quicker

The past week or so I’ve been working on implementing the QUIC protocol in Clojure. Currently there is no Java implementation to use either (that I know of), and I just found out the other day that netty decided to use the Cloudflare’s Rust library quiche under the hood instead of rolling their own. The protocol is currently a IETF draft at version 32, expected to turn into an RFC soon.


GitOps with Argo

It’s been a year since I wrote about bootstrapping a cluster with Argo and using Argo Rollouts for canary deploys based on Prometheus metrics. Since then many things have changed. I moved from Digital Ocean to Linode (mostly because Linode has a Tokyo region) and from a single-node k3s “cluster” to a 4-node one. But most of how I use Argo CD for GitOps hasn’t changed.

orange and brown tree branch

Clojure and Java functional interfaces

Java 8 came out in 2014 and brought along functional interfaces. Functional in general just means that you can treat functions (or methods) as “things” instead of having no proper way to talk about them. In this sense Javascript for example is functional: you can pass around functions all you want. Java’s had Runnable and Callable that are pretty similar in concept.

Then came Java 8 and with it the “mighty arrows.” For some reason Ruby, Javascript and Java all opted to use the same bit of syntax to talk about lambdas (anonymous functions): ->. In Ruby it’s ->(foo) { foo }, in Javascript it’s (foo) -> foo, and surprisingly in Java it’s the same. Run a few rounds with futures and/or streaming stuff and you’ll definitely want to pass such a lambda to forEach for example.


Clojure proxy

Next up in the series complaining about Clojure’s Java interop is proxy. While vararg method calls are inconvenient at worst, there are some (I’d say common) things that simply cannot be achieved with proxy.

Once again this is something I ran into while working with Netty. In one of the HTTP/2 examples, they have one implementation extending AbstractHttp2ConnectionHandlerBuilder<T, B> (have I mentioned I find these extremely long Java class names just hilarious?). The Java implementation is pretty straightforward: implement the abstract method of the class and be done with it.


奥多摩トレーニング

#nowplaying Asian Kung-Fu Generation – 七里ヶ浜スカイウォーク (サーフ ブンガク カマクラ)

来年の予定が固まったので、本格的にヒマラヤに向けてトレーニングを始めた。ほぼ毎日何かがある。朝からジムのトレドミルで1時間強やったり、体幹を中心に筋トレしたり。そこで一つ課題は、トレドミルで1時間半ぐらいが限界ということ。それ以上行くといくらポドキャス聞きながらでも飽きる。一方で山なら6時間10時間でも飽きたりはしない(疲れたりはする)。


Clojure vs Java varargs

Variable length argument lists (varargs) have been around since Java 5 (so quite a long while), yet I get the impression that many people either don’t know about this feature or their tools don’t support it. I ran into one of them working with Netty from Clojure and it wasn’t trivial at all how to use them through interop.


Greenbelly Meal2Go

I heard about the Greenbelly trail food from a thru-hiker’s video and since I was looking for some alternative to my protein bars, I gave it a try. I figured ordering the 30-pack box will last me a while.

They’re pretty big granola-bar like blocks of stuff. The packet they come in can be re-sealed too if you can’t eat one in one go (which is a possibility actually).


How does Kubernetes select labels?

kubectl has the feature to select objects by filtering on labels using the -l flag. Labels are key-value pairs attached to objects as metadata and they don’t have to be unique. I’ve most often seen them used to identify what project or app an individual resource belongs to. Helm uses labels to mark resources with the app, chart and revision they belong to.

But wait, if they’re not unique and there is a way to select multiple values with set operators, how does that work? The database backing Kubernetes by default, etcd is a key-value store. While it can natively select multiple records by prefix matching, it’d be hard to imagine labels working like that. There are many of them and the selectors are complex.

So I dove into Kubernetes’s source code to figure out how it works.


Partition of integer into exactly the given number of distinct parts

Ran into this issue in a programming challenge on HackerRank and I was surprised there weren’t any “simple” solutions online. The math related is mostly focused on finding the number of possible partitions of an integer, instead of generating even just one such partition.

A very naive approach might be to enumerate all partitions and then filter them down to those with exactly the wanted number of summands and then filter further to those with distinct parts and pick the first that fulfills the conditions.

But when the subject integer can be 1018 then that simply isn’t realistic. Insert sophisticated simile involving the heat death of the universe.