2024,江端さんの忘備録

次女:「(就活の)最終面接の前に、再度、あの練習をやって欲しい」

Second daughter: "I want you to do that exercise again before the final interview."

と言われました。

She said that.

"あの"練習とは、"これ"のことです。

面接では、「言葉に詰って沈黙を3秒作ったら負けだ」、と思っています。

The "that" practice is this.

前回は、大学入試対策だったのですが、今回は就活面接対策となります。

The last issue was preparation for the college entrance exam, and this issue will be a preparation for job-hunting interviews.

『立っている者は親でも使え』は、単なることわざではなく、我が家の方針でもあります。

"Whoever stands up, you must use she/he, even if they are your parents" is not only a proverb but also the policy of the Ebatas.

私の子どもたちは、徹底的に親を使い倒すつもりのようです。

My children seem to intend to use their parents thoroughly.

------

私:「就活の面接なんて、私は数回くらいしか受けたことがないぞ。他の人の方がプロパーだと思うが」

Me: "I've only had a few job interviews, man. I'm sure the others are better."

次女:「パパに期待しているのは『圧迫面接』の練習だから」

Second daughter: "I expect you to practice 'pressure interviews.'"

私:「そんなに、"圧迫"を再現したかなぁ?」

Me: "I wonder if I reproduced the "pressure interviews" that well?"

次女:「パパの"圧迫"想定が大量で内容もエグかったので、大学入試の面接は楽勝だった」

Second daughter; "Your 'pressure' assumptions were so voluminous and so egregious that the college admissions interview was a piece of cake."

-----

これは、『私は褒められている』で、いいんですよね?

This is 'I am complimented,' right?

2024,江端さんの忘備録

今も、入浴しながらの読書は、続けております。

I am still reading while bathing.

しかし、最近は、本を電子書籍で購入していることもあり、タブレットを浴室に持ち混んでいます。

Recently, however, I have been purchasing books in e-book format and taking my tablet into the bathroom with me.

昨夜、2台目のタブレットを水没させてしまいました。

I submerged my second tablet in the water last night.

現在、プラスチックの食品保存容器に生米を入れて、そのタブレットを潜り込ませています。

Currently, we put raw rice in plastic food storage containers and sneak the tablet into the rice.

これ、結構有名な、水没機器の対応です。

This is a fairly well-known response to submerged equipment.

-----

年末に、嫁さんが、テレビのリモコンを水没させて、動かなくなりました。

At the end of the year, my wife submerged the TV remote control in water, and it stopped working.

水没に気がつかずに、10分間ほど水の中に沈んでいたそうです。

My wife was submerged in the water for about 10 minutes without realizing she was immersed.

ダメもとで、この対応を試してみたら、2日ほどで復活しました。今は、問題なく動いています。

As a no-go, I tried this response, restored in about two days. Now it is working fine.

さらに、正月に、嫁さんが、別のリモコンを水没させましたが、こちらも復活しました。

In addition, my wife submerged another remote control at New Year's, but this one was also restored.

で、今度は私が、タブレットを水没させた訳です。

So now I am the one who submerged my tablet in water.

現時点で稼動していません。もう1日ほど様子を見る予定です。

The tablet is not operational at this time. We plan to give it another day or so.

それにしても、昨年から、水没が多すぎます。

Still, there has been too much submersion since last year.

-----

風呂持ち込み用のタブレットの1台目は復活せず、2代目は生米の中です。

The first of the tablets for bringing into the bath was not restored, and the second is in raw rice.

ちょっと、うかつにも程があります。

It is a little too careless.

しかし、これには、いくつか理由があります。

However, there are several reasons for this.

(1)紙の本を買うことがなくなった ―― 最近は、電子書籍の購入が多いです。地震で、本だなが壊れたことも遠因です。

(1) I no longer buy paper books -- I have been buying more e-books recently. The fact that the earthquake damaged the bookstore is a distant cause.

(2)いくら、紙の本が好きでも、やってはいけないことがある ―― さすがに図書館の本を、浴室に持ち込むほど、私はインモラルではありません

(2) No matter how much I like paper books, there are some things I should not do -- I am not immoral enough to bring library books into the bathroom, as I should be

(3)素人さんの投稿の小説が、結構面白い ―― ただ、その多くはウェブサイトでないと読めません

(3) Novels submitted by amateurs are pretty fascinating -- but many of them can only be read on the website

(4)タブレットの値段が十分に安い ―― 読書目的の中古であれば、本の原価より安いこともあります

(4) The price of the tablet is low enough -- sometimes more bass than the cost of the book if it is used for reading purposes

という訳で、『入浴時のタブレット読書』は、私にとって合理的な行動なのです。

Therefore, "tablet reading while bathing" is reasonable for me.

今、私の2台目のタブレットは、生米の中ですが、仮に復活しなかったら、すぐに、どこかで3台目のタブレットを手に入れると思います。

My second tablet is in raw rice, but if it doesn't return, I will soon get a third one somewhere else.

-----

『大人しく風呂に入れ』という意見もあるでしょうが、私にとって入浴とは、単なる入浴時間ではありません。

Some may say, 'Be an adult and take a bath,' but for me, bathing is more than just a time to take a bath.

私が、入浴に持ち込むものは、

What I bring to bathing are,

(1)タブレット

(1) Tablet

(2)ノンアルコールビール

(2) Non-alcoholic beer

(3)煎餅、大福餅、キムチ、あるいは、他のツマミ

(3) rice crackers, Daifukumochi, kimchi, or other snacks

です。

『1人喫茶、または1人居酒屋 @ 江端家バスルーム』です。

This is a "One-person coffee shop or pub @ Ebata Family Bathroom."

この時間を守るためであれば、これからもタブレットを浴槽に落すことなど、どうということはありません。

I don't care about dropping my tablet in the bathtub to save this time.

―― で、まあ、なんというか「困っている」のです。

 

未分類

スプリングコードの終端が切れてしまった場合

スプリングコード 最長90cm カラビナ付 [色指定不可] (100円ショップ 100円均一 100均一 100均)の通販はau PAY マーケット  - 100円雑貨&日用品卸−BABABA | au PAY マーケット-通販サイト

結束バンドで閉じることができます。

未分類

特定時間の同じ部屋、喋りやすさ、子供(幼児、乳児)をきっかけに会話スタート、年代別他人へのアクセス(要先行研究)

地図を複数用意して、そこにエージェントをランダムウォークさせれば良い。
エージェントは、一日単位で滞留・移動を計算して、また複数の地図に展開すれば良い。
選択される地図は、エージェントの戦略となり、戦略は常時変更しても良い。
SCのコストは原則移動距離。あとは年齢によるコスト変化とか入れても良いかも。

2024,江端さんの忘備録

今日、『ブックオフに行ってくる』という嫁さんに、『中古の金属バットを、買ってきて』と頼みました。

Today, I asked my wife, who said, "I'm going to a Book-Off," to buy me a used metal bat.

「野球」に興味を持った訳ではなく(私に限って、そんな訳があるはずがない)、不法侵入者撃退用にです。

Not because I'm interested in "baseball" (how could I be?), but to repel trespassers.

我が家の玄関の傘立には、義父から貰ったというゴルフクラブが置いてあるのですが、以前から『これは反撃能力が弱い』と思っていました。

There is a golf club in the umbrella stand at the entrance of our house that was given to me by my father-in-law, and I have always thought, 'This has a weak ability to fight back.

Amazonで購入しようかとも思ったのですが、『人を殴打するためのバット』に、定価を支払うのもなんだなぁ、と思いまして。

I thought about buying it on Amazon, but then I thought, why pay the list price for a "bat for beating people up"?

-----

『江端、一体、何考えているんだ?』と思われるかもしれませんが、この理由については、すでに以前に記載した通りです。

'Ebata, what the hell are you thinking?' You may be thinking, "What in the world is Ebata thinking?" but the reason for this has already been described.

という訳で ―― この平和な時代にあっても、「武装」という概念を持ち続けているシニアが存在していることを、覚えておいて下さいね。

これ以外にも、いくつかの撃退手段を準備しているのですが ―― ちょっと公にはできない内容なので、割愛させて頂きます。

In addition, I am preparing several other means of fighting back. However, I'll spare you the details. Because it is against public order and morals.

2024,江端さんの忘備録

『首相が妙な指導力を発揮すると、救助活動に関わる人や、被災している方に、どえらい迷惑をかけることになる』

"If the prime minister tries to show strange leadership, it will cause a lot of trouble for those involved in the rescue efforts and the people affected by the disaster."

ということは、東日本大震災の際、当時の首相が見事に証明してくれました。

The then Prime Minister beautifully proved this during the Great East Japan Earthquake.

(「総理を落ち着かせてくれ」で検索すると記事が出てきます)

(Search for "calm the PM" to find the article)

----

組織のトップは、

The head of the organization is,

(1)どんなにもどかしくても、前線に出でこないで、後方で災害全体を把握し続けなければならない

(1) No matter how frustrating it may be, they must not come out to the front lines but stay in the rear to keep track of the entire disaster.

そして、

and,

(2)我慢して、現場に判断を委ねなければならない

(2) They must be patient and let the field decide.

という姿勢が重要であることを示してくれた、素晴しい反面教師となりました。

The prime minister was a great role model at the time, showing us the importance of such an attitude.

----

そういう意味では、私は、今回の災害に対する現首相のスタンスを、それなりに評価しているんです。

In that sense, I appreciate the Prime Minister's stance on this disaster.

これを『指導力がない』と見るかどうかは、人それぞれかと思います。

I guess it depends on whether you see this as a 'lack of leadership' or not.

しかし、下っ端の管理職として、現場仕事を続けてきた私に言わせれれば、「土壇場で割り込み」を出してくる上司というのは、本当に迷惑な存在です。

However, as a lower-level manager who has continued to work in the field, I can say that bosses who offer "last-minute interruptions" are a real nuisance.

上司は、その職務にかかわるチェックをしなければなりませんが、最終フェーズで現場に乗りこまれたり、ましてや「提案」なんぞされると、本当に困るのです。

Supervisors have to check on their duties. However, I don't want them to join in the project's final phase, much less make "suggestions."

----

「口を出さないシニア」というのは、それだけで十分に価値があるものです。

A "senior who doesn't talk is well worth it."

日本語に不自由な外国人の居住者 ―― つまり"言語"の問題です。

 

未分類

横浜市統計書によると2022年度の1日平均乗降人員18,339人(乗車人員:9,255人、降車人員:9,084人)である[3]。2020年度の1日平均乗降人員は16,535人であり[4]、京急線全72駅中30位。1988年をピークに乗降客数は減少し続けている。

https://ja.wikipedia.org/wiki/%E4%BA%AC%E6%80%A5%E5%AF%8C%E5%B2%A1%E9%A7%85

乗り場 系統 経由 行先 備考
富1 富岡西四丁目 横浜氷取沢高校 平日は朝夜のみ
富2 横浜氷取沢高校 能見台車庫前
富3 氷取沢 金沢文庫駅西口
富5 富岡西四丁目 富岡9期ニュータウン 朝夕のみ
富6 富岡西循環 京急富岡駅 日中のみ

 

Photo

2024,江端さんの忘備録

(国際的な観点から)日本の物価が安い ―― これは、地味に私にインパクトを与えています。

The low cost of living in Japan (from an international perspective) -- has had a sobering impact on me.

インバンド需要によって、海外観光客の取り込みという点では良いことでしょう。

This would be a good thing for attracting international tourists due to in-band demand.

しかし、エネルギー輸入大国日本は、ご存知の通り、大打撃を受けています。

However, as you know, Japan, a major energy importer, has been hit hard.

-----

30年程前、私が一人でアジアを放浪していたというお話は何度かしたと思います。

携帯やメールのない時代の連絡方法

I have told you several times that about 30 years ago, I was wandering alone in Asia.

未整備なインフラ、清潔とは言えない環境、通じない言葉などの問題はありましたが、アジアは私の心の拠り所でした。

Despite the problems of undeveloped infrastructure, unclean environment, and language barriers, Asia was my spiritual home.

特に中国(大陸の方)は、「私の心の支え」といっても過言ではありませんでした。

In particular, China (the mainland) was "my heart and soul".

―― 何もかもが嫌になったら、中国大陸に逃げて、姉から毎月5000円を送金して貰いながら生きていこう

"If I get sick of everything, I'll run away to mainland China and live off my sister's monthly remittance of 5,000 yen."

当時の中国は、5000円もあれば、一ヶ月間くらいなら、余裕で宿泊と飲食を賄えるほど「安い国」だったのです。

At that time, China was such a "cheap country" that one could afford to stay, eat, and drink for a month or so with as little as \5,000.

-----

今、凄い勢いで、「私の心の支え」は壊れつつあります。

Now, "my heart and soul" is breaking down at a terrific rate.

今や日本は、経済大国第2位の国から、私の生きている間に、ランク外まで落ち込む可能性も出てきています。

Japan has gone from being the second-largest economy to possibly falling out of the ranks in my lifetime.

私の「換金レート差額を使った不労所得戦略」は完全に瓦解し、もはや逃げ場がないという事実が、今の私を苦しめています。

The fact that my "unearned income strategy using the exchange rate difference" has completely fallen apart, and there is no longer any way out is now hurting me.

-----

「お金に愛されないエンジニア」シリーズで、この「換金レート差額を使った不労所得戦略」の、過去と現在の話を書きたいのですが ―― 今、そんな時間は、全くありません。

I want to write about the past and present of this "unearned income strategy using the difference in exchange rates" in the "Engineers Unloved by Money" series -- but I don't have time for that right now.

2024,江端さんの技術メモ

※fastapiの場合、スレッドでは上手くコンロールできない(らしい)ので、プロセス単位で管理します
(1)execute-commandというAPIから、pingを行う回数Xをjson形式入力して、"ping -n X kobore.net"を起動します。返り値はプロセス番号(pid)がjson形式で戻ります。
curl -X POST -H "Content-Type: application/json" -d "{\"count\": \"5\"}" http://localhost:8000/execute-command
(2)terminate-processというAPIから、上記のpidをjson形式で入力して、プロセスを強制終了します。返り値は、この成否(1/-1)がjson形式で戻ります。
curl -X POST -H "Content-Type: application/json" -d "{\"pid\": \"10164\"}" http://localhost:8000/terminate-process
(3)以下のファイルをtest.pyとして、uvicorn test:app --host 0.0.0.0 --reload を投入してfastapiサーバを起動します。
# curl -X POST -H "Content-Type: application/json" -d "{\"count\": \"5\"}" http://localhost:8000/execute-command
# curl -X POST -H "Content-Type: application/json" -d "{\"pid\": \"10164\"}" http://localhost:8000/terminate-process

import subprocess
from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()

class ExecuteRequest(BaseModel):
    count: int  # pingコマンドの実行回数を指定

class TerminateRequest(BaseModel):
    pid: int  # 終了させるプロセスのPID

# 実行中のプロセスを格納する辞書
running_processes = {}

@app.post("/execute-command")
def execute_command(request: ExecuteRequest):
    count = request.count

    try:
        command = f"ping -n {count} kobore.net"  # pingコマンドの回数をcountに指定
        # コマンドを非同期で実行し、プロセスを取得
        process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        pid = process.pid  # プロセスのPIDを取得
        running_processes[pid] = process

        return {"pid": pid}  # PIDのみを返す
    except Exception as e:
        return {"message": f"コマンドの実行中にエラーが発生しました: {str(e)}"}


@app.post("/terminate-process")
def terminate_process(request: TerminateRequest):
    pid = request.pid
    print("pid in terminate-process", pid)

    try:
        # プロセスを取得し、終了させる
        process = running_processes.get(pid)

        process.terminate()  # プロセスを終了させる(SIGTERMを送信)
        process.wait()
        del running_processes[pid]  # プロセスを辞書から削除

        # 成功の場合は1を返す
        return {"status": 1}
    except Exception as e:
        return {"status": -1}  # 失敗の場合は-1を返す

if __name__ == "__main__":
    # FastAPIサーバーを開始
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000)

出力結果
C:\Users\ebata\fastapi7>curl -X POST -H "Content-Type: application/json" -d "{\"count\": \"100\"}" http://localhost:8000/execute-command
{"pid":1784}
C:\Users\ebata\fastapi7>curl -X POST -H "Content-Type: application/json" -d "{\"pid\": \"1784\"}" http://localhost:8000/terminate-process
{"status":1}
C:\Users\ebata\fastapi7>curl -X POST -H "Content-Type: application/json" -d "{\"pid\": \"1784\"}" http://localhost:8000/terminate-process
{"status":-1}


起動したプロセスを監視して、プロセスが予定通り/突然停止した場合、それを通知する仕組みを追加しました。

# curl -X POST -H "Content-Type: application/json" -d "{\"count\": \"5\"}" http://localhost:8000/execute-command
# curl -X POST -H "Content-Type: application/json" -d "{\"pid\": \"10164\"}" http://localhost:8000/terminate-process
# C:\Users\ebata\fastapi7>uvicorn test:app --host 0.0.0.0 --reload

import subprocess
import os
import time
import multiprocessing  # multiprocessingモジュールを追加
from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()

class ExecuteRequest(BaseModel):
    count: int  # pingコマンドの実行回数を指定

class TerminateRequest(BaseModel):
    pid: int  # 終了させるプロセスのPID

# 実行中のプロセスを格納する辞書
running_processes = {}
process_monitor_processes = {}

@app.post("/execute-command")
def execute_command(request: ExecuteRequest):
    count = request.count

    try:
        command = f"ping -n {count} kobore.net"  # pingコマンドの回数をcountに指定
        # コマンドを非同期で実行し、プロセスを取得
        process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        pid = process.pid  # プロセスのPIDを取得
        running_processes[pid] = process

        # プロセスを監視するプロセスを起動
        monitor_process = multiprocessing.Process(target=monitor_process_status, args=(pid,))
        monitor_process.start()
        process_monitor_processes[pid] = monitor_process

        return {"pid": pid}  # PIDのみを返す
    except Exception as e:
        return {"message": f"コマンドの実行中にエラーが発生しました: {str(e)}"}


@app.post("/terminate-process")
def terminate_process(request: TerminateRequest):
    pid = request.pid
    print("pid in terminate-process", pid)

    try:
        # プロセスを取得し、終了させる
        process = running_processes.get(pid)

        process.terminate()  # プロセスを終了させる(SIGTERMを送信)
        process.wait()
        del running_processes[pid]  # プロセスを辞書から削除

        # 成功の場合は1を返す
        return {"status": 1}
    except Exception as e:
        return {"status": -1}  # 失敗の場合は-1を返す

def monitor_process_status(pid):
    while True:
        if not is_process_running(pid):
            # プロセスが存在しない場合
            # メッセージを生成して出力(または送信)
            message = {
                "status": "Process Disappeared",
                "pid": pid
            }
            print("Process Disappeared:", message)

            # プロセス監視プロセスを停止
            ### del process_monitor_processes[pid]
            break

        # 一定の待機時間を設定して監視を継続
        time.sleep(10)  # 10秒ごとに監視

def is_process_running(pid):
    #try:
    #    os.kill(pid, 0)  # PIDを使ってプロセスにシグナルを送信し、存在を確認
    #    return True
    #except OSError:
    #    return False
    try:
        # ここの部分Windows特有のやりかたなので、後で、例の、os.kill(pid,0)を試してみること
        # tasklistコマンドを実行してプロセス一覧を取得
        result = subprocess.check_output(["tasklist", "/fi", f"PID eq {pid}"], universal_newlines=True)

        # 結果から指定したPIDの行を検索
        lines = result.splitlines()
        for line in lines:
            if f"{pid}" in line:
                return True

        # 指定したPIDが見つからない場合
        # ここに、停止時のメッセージ送信を組み込めばO.K.のはず   

        return False
    except Exception as e:
        return False





if __name__ == "__main__":
    # FastAPIサーバーを開始
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000)

2024,江端さんの忘備録

「働き方改革」に対して、「働き方改悪」というものもあるんじゃないか、と思うのです。

In contrast to "work style reform," there is also something called "work style deterioration."

私、ここ1年半の間の全ての平日と休日の間、一日も休んだことがありません。年末年始も、GWも、夏季休暇も。

 I have not missed a single day during all the weekdays and holidays in the last one and a half years. No New Year's holidays, no GW, no summer vacation.

時間の長短こそあれ、必ず、論文書いていますし、プログラミングをしていますし、データベースを作っています。

I am always writing papers, programming, and creating databases, no matter how long or short the working time.

『大学での研究は、労働ではない』と言われたら、もう仕方がないのですが。

If you say, 'Research at a university is not labor,' it cannot be helped anymore.

仕事と勉学の両立は「大変」ではありません ―― 「地獄」です。

Balancing work and study is not "hard" -- it is "hell.

-----

月1回でリリースしていたコラムは、今や完全休止状態です。

The column we used to release once a month is now wholly dormant.

コラムの執筆もも大変だったと思うのですが、コラムは、私の頭の中と計算結果を原稿の上にぶちまける、という作業でしたので、それなりに楽しかったと思います。

Writing the column was hard work, too, but it was fun because it was a process of putting my mind and the results of my calculations all over the manuscript.

多くの人に読んで貰って、色々な意見を貰えるのは、 ―― 腹の立つことも多いですが、嬉しいことも多いです。

To have so many people read it and get so many different opinions is a lot to be angry about, but it's also a lot to be happy about.

「コラムの執筆」と「勉学」は、同じようなものだと思っていたのですが、全く違いました。

I used to think that "writing a column" and "studying" were the same, but they were pretty different.

見積りを誤った、としか思えません。

I can only assume that the estimate was incorrect.

-----

"自分で選んだことをやっているなら、文句を言うな"

"If you are doing what you choose, don't complain."

"自分の"夢"の為にやっていることで、他人に迷惑をかけるな"

"Don't bother others with what you do for your 'dream.'"

これらは、絶対に反論できない定番の「世間のご意見」です。

These are standard "public opinions" that can never be refuted.

ただ、世間がどう言おうとも、この「自業自得の呪縛」―― 「サンクコストの呪い」で苦しんでいる人は、少なくない、と思っています。

However, no matter what the world says, many people suffer from this "curse of deservedness" - the "curse of sunk costs.

誰からも同情して貰えなくとも。

Even if I am not getting sympathy from anyone like me.

―― エジソン、バカ