Elasticsearch aggregation to find most popular tags over time

Finding popular keywords or tags is what twitter’s trends are (other than a means to manipulate public opinion and introduce artificial trends by paying good cash). While I think having a “trends” feature tends to introduce more problems than the value it provides for discovery, I wanted to figure out how I’d do it before deciding not to.


Suunto 9 Baro first impressions

I wrote about how I was considering getting a new watch, and a while back I actually put that into action and got a Suunto 9 Baro. I wanted to try something not Garmin to have a more reliable point of view.

Getting the Suunto 9 Baro up and running wasn’t hard, but it wasn’t seamless either. I paired the device with my phone before installing the Suunto app, after which the app wasn’t able to “pair” with it. I had to unpair the smartwatch once and redo it from the app. Weird stuff.

It’s a very different beast from the Garmin Instinct. First of all, it’s much bigger, but I don’t think it’s too heavy or so big as to get in the way. It’s a full-fledged smartwatch with a touchscreen, so my first thing to do was to get a protective film so the glass doesn’t get all scratchy and/or smudgy. It also means that it can show notifications and stuff, which can get pretty noisy if there are too many. Of course it can be configured, but it has to be configured.


Dealing with circular dependencies in Clojure

While working on stuff (of course in Clojure), I kept running into problems with namespaces having circular dependencies. For example I’d have an app.router namespace that defines the, uh, routes. I’d have an app.url namespace that contains helper functions to generate absolute URLs based on route data (so it depends on app.router). I’d have an app.views namespace that uses those URL helpers (thus depending on app.url), and these views would be referenced in the routes so app.router would require app.views.

This completes the dependency circle and is the beginning of my journey. There are a bunch of ways to deal with circular dependencies in Clojure, but I won’t go in-depth about all of them.

timelapse photography of fire

A way to extract an image from Firefox

The problem I faced: I was scrolling through a hashtag‘s timeline in Tweetdeck, when I spotted a nice image. I wanted to retweet it, but that failed: turns out the tweet was deleted in the meanwhile. This usually means that either the artist themselves deleted the tweet for some reason, or it was stolen in the first place and (by some miracle) it was moderated.

In this case it seems to have been the latter, so finding the image through the author’s profile was not an option. As Tweetdeck displays images as CSS backgrounds in the timeline, right-click “Open image in new tab” was not an option. Since the tweet was deleted, its URL was invalidated too, so I couldn’t give that to Saucenao or similar to find matches either.

However, while digging through the Firefox Dev Tools, I noticed that the context menu when right clicking the URL of the background-image had an item “Copy image data URL”. This turned out to be just what I needed.

Pasting the copied (data blob) URL to the address bar I got the image that I could magnify so that I could decipher the artist’s signature on it. (It turned out to have been a partial image so Saucenao couldn’t help either.) After a few tries I found the artist’s profile and there the original post. Yay.


Adding Grafana annotations based on Flux CD events

Earlier this year I wrote about adding Grafana annotations based on Argo CD events. Since this year I actually got around testing out Flux some more, it was natural to follow up with adding some Grafana annotations based on Flux events.


ClojureDartの第一印象

Clojureの文法でFlutterが書けると聞いた時、これだ!と思った。ClojureDartはただClojureの文法をDartに変換するツールよりも、Flutterがメインだと感じた(個人的にDartもそうだと思っている)。ClojureDartはすごく短時間で「やるぞ」の発表から実際にだれでも試せるような形に発展した。あとからコミットログ見返すと、もっと前から作っていたらしいけど。

最近モバイルアプリ手掛けることになって、プロトタイプ作るにClojureDart試すことにした。困ったことはいろいろとあったが、後悔はしていない。

black and brown dart board

Clojure multimethods and derivation

I’ve known about Clojure multimethods of course, but I never really used them much. I didn’t really have data that I’d need polymorphism like multimethods to handle, and when I did need something like that I’d use protocols. However protocols dispatch based on class, so when I faced the problem of handling ActivityPub objects that are all maps, it was time for defmulti to save the day.

red yellow and green abstract painting

Structured logging in Clojure

The first time I ran into “structured logging” was way, way back when I first started working on kitsune. Back then I went with the approach of using a Logback Formatter (the JacksonJsonFormatter) to log Clojure maps as JSON. This was nice because I didn’t have to do anything to “transform” the logs further, but had the quite significant downside that logs weren’t really human readable anymore. This plus that that log processors like Loki and CloudWatch can easily parse huge amounts of “traditional” text logs made me pretty much forget about structured logging until recently.

That is until in a thread on the clojurians slack about logging someone mentioned mulog, a structured logging library that caught my attention. I guess maybe from a traditional Clojure background it would’ve been natural to end up with taoensso/timbre at this point, but I never did that bit (though I do have it as an indirect dependency).


キーボードの感想文です

いろいろと秋田。飽きた。ここ2年はlogicoolのG613をキーボードとして使っていたが、今年のブラックフライデーをきっかけに買い換えようと決めた。最大の理由はやっぱりキーの不調。キーが反応しなかったり、多重に反応したりして、タイポが多発していた。またスタート?スーパー?キーは爆死していて一切反応しなかった。前者はまだbackspaceという神機能でなんとかなったけど、スタートキーはUbuntuだとActivitiesを起動させるショートカットで重宝なのでないと困る(Windowsだとalt-tabみたいなものかな?)

さて買い換えるのもまた簡単じゃない。まず日本語配列であーる。英語で打つことも少なくないないが、日常の業務などでは日本語入力が当たり前でレイアウトに慣れている(変換・無変換キーとか)。また、同時に最低限2端末に接続ができること。仕事用のPCにはBluetoothで、私用PCにはBluetoothもしくは直に指すUSBで。3端末同時に行けると助かる。最後に、とんでもない金額ではないこと。キーボードに出す金は1.5万で上限、それもかなりかけた気分になる。

この条件のキーボード見つけるまではかなり苦戦した。その最大の理由はAmazonの検索はゴミである点にはあるが、検索の過程はキーボード自体に関係ないので省略する。最終的に落ち着いたのはまたlogi製ではあるが、K855という製品だ。


スマート電球の第一印象

スマート電球っていいね… と思っちゃった。わざわざベッドから起きなくても消せるし、スマホから操作もできるし、遠距離で点けたり消したりできるし、明度も調整できるし、強いでしょう?とか思いながらも結局金出すほどやりたいことでもなかった。そして今年の夏、ようつべでルームツアーやインテリア動画にハマった時期に紹介の動画を見たら結局衝動買いしちゃった。なぜかというとその辺飲みに行った店の内観がめっちゃササって、それっぽくできるじゃない?と思ったから。