kanejaku.org

Frobbing - 2020/11/25

25 Nov 2020

This week I tried not to see the Internet as much as I could.

I was reading a document that was written by a programmer back in late 2000. I came across a word which I didn’t know of. I’ve seen the word several times in the past years. I thought it’s a signal that I should know the meaning of the word. I searched the web.

The word was “frobbing.” The urban dictionary explains the word as “to spend time on a computer surfing the net.” Ths was what I was trying to avoid.

I felt the irony.

Aside: According to the Jargon File, “frob” also means to tweak. Tweak is one of the words I use frequently in commit messages. The document seemed to use the word in that sense.

5 PM - 2020/11/17

17 Nov 2020

My desk is set up on the window side.

I was waiting for a long compile. I gazed absently out of the window. I saw a beautiful moon in the twilight.

2020/11/16

16 Nov 2020

ホームレスの人たちを新鮮な目でとらえる意見を見聞きした。引っかかりを言葉として残す。

書かれた感想は見知らぬ人々の生活を目にした率直な反応だろう。

今の自分の住処はホームレスが多い地域だ。自分は日常的に彼らを目にする。彼らがどういう立ち振る舞いをするのかだいたい把握していると思う。おおなるほど、とか思うことは確かにある。でもそれはあくまで日常だ。冬の時期に道端に落ちている手袋を見つけて、おや?、みたいな、そんな感じに近い。

公園や河川敷を散歩していると、ときどき彼らに炊き出しをしている場面に遭遇する。写真撮影しないで欲しい、という看板を立てている。好奇の目にさらされるのを避けていると自分は理解した。

彼らをコンテンツとして消費していないか。大多数の彼らやその支援者はそれを望んでいないのに?違和感はそこからきている。

2020/11/12

12 Nov 2020

I’m trying to decode SNES BRR.

The waveform above in the figure is the output of the library I’m referring to. The below is the output of mine.

Mine sounds like what it sounds, but I hear a lot of noises. The figure shows the difference clearly. The next step is to figure out where the noises come from.

ピクニック - 2020/11/08

9 Nov 2020

ふらっと出かけるピクニックはいつも楽しい。

Grafana + InfluxDB + Telegraf to monitor Raspberry Pi

8 Nov 2020

I was planning to do spare-time programming this weekend but I couldn’t think straight so I did something different for a change.

Several weeks ago, I wrote a Prometheus exporter which records speedtest results. Currently it is running on a VM which lives in my desktop computer. I want to move the exporter to a Raspberry Pi 4 device.

Before moving the exporter, I thought it would be better to set up a nice visualization tool, not only for the exporter but metrics (CPU usage, tempurature etc) of the device. I searched the Web and Grafana looked a good candidate.

My initial attempt was to use Prometheus as a data source of device metrics, but I noticed that someone already created a nice dashboard for Raspberry Pi monitoring which doesn’t use prometheus.

I ended up following nicolargo/docker-influxdb-grafana.

Understanding and searching these tools (Grafana, InfluxDB and Telegraf) took some time, but all I had to do was writing a few configuration files to get the following dashboard. Now I understand why people say docker-compose is great.

2020/10/28

6 Nov 2020

図書館が好きで足繫くとは言わないまでも月に数度は立ち寄っている。子供のころからの習慣が続いている。

テッド・チャン『息吹』を借りた。「ソフトウェア・オブジェクトのライフサイクル」を読む。rebuild.fm で紹介されていて気になっていた中編だ。面白い。ページをめくる。

しみを見つけた。

これは前に借りた人がご飯を食べながら読んでいるときについたしみだろうか。今の自分みたいに。しみにはしっぽがついているから拭き取ろうとしたんだろう。ひと時のメタ認知が働く。

子供のころのように話に没頭することができない自分に気づく。

Q: How to limit the number of inflight async tasks in Rust?

4 Nov 2020

Let’s say we want to have some concurrency for an async function in Rust. We want to execute the function thousands of times with different parameters (e.g. indexing many files). We also want to limit the number of inflight tasks so that the load on the system doesn’t exceed a certain level.

struct Task { /* ... */ }
struct TaskResult { /* ... */ }

async fn do_task(task: Task) -> Result<TaskResult> {
  // ...
}

const N: usize = 5;

async fn run_tasks(tasks: Vec<Task>) {
  // Q: How to limit the number of inflight tasks to N?
}

How would you do that?

I had no idea how to search the web for the question. After spending some time, a random search pointed out StreamExt::buffered().

Here is my current approach:

async fn run_tasks(tasks: Vec<Task>) {
  // Convert Vec<Task> to Vec<impl Future<Output=TaskResult>>
  let tasks = tasks.into_iter().map(|t| do_task(t));
  // Convert Vec<impl Future<Output=TaskResult>> to impl Stream<Item=TaskResult>
  let tasks = stream::iter(tasks);
  // Limit the number of tasks in the stream to consume at the same time.
  let tasks = tasks.buffered(N);
  while let Some(result) = tasks.next().await {
    // ...
  }
}

It worked but I guess that I’m wrong in the first place. Code is simple but I feel I’m doing something strange. I think it’s a common situation where we want to restrict the number of inflight tasks. I suspect that there is an idiomatic way to do that.

Half moon - 2020/11/02

2 Nov 2020

I’m practicing developing photos. The moon was clearer than I thought. I didn’t use a tripod when I took the photo.

Short trip to Atami

1 Nov 2020

I took a day off and went on a short trip to Atami. It was my first time in Atami. It seems that it was a good idea to go to such a resort city before the holidays. The city wasn’t so clouded and everything went smoothly.

I stayed in a hotel with a great view. The sunrise was beautiful.

This statue is what I think of when I hear Atami. I had no idea about the statue though.

I was going to have a fresh seafood bowl for lunch but I changed my mind had this curry and rice with pork cutlets (カツカレー) at Takara-tei.

Looking down on Atami from the observation deck at Atami Ropeway.