ときどきの雑記帖 RE* (新南口)
Let it be
JR渋谷駅
ホームからどの階段(やエスカレーター)を使うとどこの改札(出口)に出るのかがまだよくわかってない😓 ハチ公のところに出たかったのにヒカリエの方に出たりとか。
日本の巨大ロボット群像
横須賀美術館でやる前に福岡で開催されるのね。
展覧会『日本の巨大ロボット群像』巨大ロボットとは何か、大きさを体験 鉄人28号やガンダム等、変形やメカニズム展示 福岡と横須賀で開催 - ロボスタ
展覧会名 | 日本の巨大ロボット群像 - 巨大ロボットアニメ、そのデザインと映像表現- |
(英訳)Giant Robots: The Core of Japanese Mecha Anime | |
巡回会場・会期 | 福岡市美術館 2023年9月9日~11月12日 |
横須賀美術館 2024年2月10日~4月7日 | |
以降、京都(2024年夏)など追加巡回を調整中。 |
ヨドバシカメラ
アキヨドに行ったときにふと気になったこと。
例の歌の、「丸い緑の」に続くのが「やまのてせん」なんだけど、 昔(?)は「やまてせん」だったような? (「山手線」を「やまてせん」と読むか「やまのてせん」と読むのかはまた別の話で、 今回のポイントは歌で使っている読みがどうだったかということ)
ということで調べてみると…
「ヨドバシカメラ」の古いCMソングをビデオで見たら・・・「山手線・・・やま… - Yahoo!知恵袋
「ヨドバシカメラ」の古いCMソングをビデオで見たら・・・
「山手線・・・やまてせん」と発音していました。
歌詞が間違っていませんか・・・
戦後の一時期、「やまてせん」という読みが一般的だったため、主に40~50代以上の人は「やまてせん」と読むことが多いです。 ヨドバシカメラのCMソングでは、1990年頃まで「やまてせん」という読みのものが使われており、 その後、客の指摘で「やまのてせん」に変わっています。
記憶違いではなかったようだけど、 今まで気がつかなかったのか😓 >読みの変化
- ヨドバシカメラの歌 歌詞まとめ 日本全国 各店舗 CMソング
- ヨドバシカメラの歌 (新宿西口編)/ヨドバシカメラCM
- やまのて線とやまて線はどちらが正しい?:この差って何ですか?【2017/08/08】 | 何ゴト?
オスプレイ
特に理由もなく観音崎の辺りに行ってきたのだけど、 海岸で東京湾を出入りする船を眺めていたときに (距離があったのではっきりとはわからなかったが) オスプレイじゃないかと思うような機体が飛んできたのを目撃した。
三浦半島を横断するような進路だったので 横須賀や横田で発着した機体ではなさそうだったけど どこからどこへ行くものだったのだろう? (そもそもオスプレイじゃなかったかもしれない)
新刊近刊
Tidy First?
Tilde expantion
[Bash/Zsh] 以前に居たディレクトリを表す記号たち [TIPS]
検索しても詳細が出てこず。
どうやってこの記法を見つけたのが謎だけど、マニュアルに(ry
Tilde Expansion (Bash Reference Manual)
If a word begins with an unquoted tilde character (‘~’), all of the characters up to the first unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-prefix. If none of the characters in the tilde-prefix are quoted, the characters in the tilde-prefix following the tilde are treated as a possible login name. If this login name is the null string, the tilde is replaced with the value of the HOME shell variable. If HOME is unset, the home directory of the user executing the shell is substituted instead. Otherwise, the tilde-prefix is replaced with the home directory associated with the specified login name.
If the tilde-prefix is ‘~+’, the value of the shell variable PWD replaces the tilde-prefix. If the tilde-prefix is ‘~-’, the value of the shell variable OLDPWD, if it is set, is substituted.
A ‘~’ followed by a number is replaced by the directory at that position in the directory stack. ‘~0’ is equivalent to ‘~+’, and ‘~1’ is the top of the stack. ‘~+’ followed by a number is replaced by the directory at that position in the directory stack. ‘~+0’ is equivalent to ‘~+’, and ‘~+1’ is the top of the stack. ‘~-’ followed by a number is replaced by the directory that many positions from the bottom of the stack. ‘~-0’ is the bottom of the stack. The PUSHD_MINUS option exchanges the effects of ‘~+’ and ‘~-’ where they are followed by a number.
MID$ statement
本題の解決に繋がるようなことは見つからなくて 今回もわき道にそれた話。
GW-BASICのソースコードを見ていると
gweval.asm
INTDPC: MOV BX,OFFSET INTDSP ;INTEGER INTEGER CASE
MOV CH,LOW 0 ;SPECIAL DISPATCH FOR SPEED
ADD BX,CX ;[H,L] POINTS TO THE ADDRESS TO GO TO
ADD BX,CX
INS86 56 ;FETCH FROM CODE SEGMENT
MOV CL,BYTE PTR [BX] ;[B,C]=ROUTINE ADDRESS
INC BX
INS86 56 ;FETCH FROM CODE SEGMENT
MOV CH,BYTE PTR [BX]
POP DX ;[D,E]=LEFT HAND OPERAND
MOV BX,FACLO ;[H,L]=RIGHT HAND OPERAND
PUSH CX ;DISPATCH
RET
のような808[68]特有のコード
(ここではセグメントオーバーライドを指定するINS86 56
)
が入っている場所が散見される。
これって各CPU向けのものを生成するもとになった
ソースコードではどうなっていたんだろう?
ifdef 8086
みたいな条件コンパイルとかだろうか。
ところでGW-BASICでは整数の比較は以下のサブルーチンで まとめて行っていて (SUB命令のあとに条件ジャンプ命令が三つも並んでいるのは符号付きで比較を行うため)、
math1.asm
ICOMP: ;COMPARE (DX) AND (BX)
;(AL)=1 IF (DX) .LT. (BX)
;(AL)=0 IF (DX) = (BX)
;(AL)=-1 IF (DX) .GT. (BX)
MOV AX,BX ;SO WE CAN HAVE SEPARATE ENTRY FOR AX
ICMPA: SUB AX,DX ;COMPARISONS
JZ IC40 ;ALL OK , JUST EXIT
JO IC20 ;IF SF=1 ADDITIONALLY THEN AX LARGER
JS IC30 ;DX DEFINITELY LARGER
IC10: XOR AL,AL ;(AX) LARGER
INRART: INC AL ;(AL)=1
IC15: RET
IC20: JS IC10
IC30: STC
SBB AL,AL ;(AL)=377
IC40: RET
その戻り値(-1、0、1)と実際に使いたい演算子を表す ビットフラグをごにょごにょして最終的に求めたい結果を得る。
gweval.asm
SUBTTL MORE FORMULA EVALUATION - LOGICAL, RELATIONAL OPS
DOCMP: INC AL ;SETUP BITS
ADC AL,AL ;4=LESS 2=EQUAL 1=GREATER
POP CX ;WHAT DID HE WANT?
AND AL,CH ;ANY BITS MATCH?
ADD AL,LOW 255 ;MAP 0 TO 0
SBB AL,AL ;AND ALL OTHERS TO 377
CALL CONIA ;CONVERT [A] TO AN INTEGER SIGNED
JMP SHORT RETAPG ;RETURN FROM OPERATOR APPLICATION
-1, 0, 1 をビットフラグ(bi2, bit1, bit0)にあわせるために小技を駆使している。
FORTRAN Compiler on IBM 704
level analysis
論文では -XYZF(A,B*C**(-D))/E+F
という式から作った
(●は実際の論文では○に十字が入った(島津氏の家紋すな)記号なんだけど
IMEの入力候補に出てこないので代わりに使ったもの)
-( *( **( ●XYZF ●( +( +( **( ●A ) ) ) ) ●( +( *( **( ●B ) )
*( **( ●C ) **( ●( -( *( **( ●D ) ) ) ) ) ) ) ) ) )
/( **( ●E ) ) ) +( *( **( ●F ))
というパターンを例に説明しているのだけど、
それだと54ステップもあって大変なので
まずはA+B
と簡単なものを使って説明する。
この式からは
+( *( **( ●A ) ) ) +( *( **( ●B ) ) )
のようなパターンが作られる (パターン生成の手順は省略😓余裕があったら別の機会に)。
そして以下のようなステップで解析が進む iはステップの進み具合を表す数字、 N、C、Aはソース中に現れるNBAR、CBAR、ABARに該当するもの(のはず)。
入力 | i | N | C | A | K |
---|---|---|---|---|---|
+( | 1 | 1 | 0 | 0 | {0} |
*( | 2 | 2 | 1 | 1 | {0,1} |
**( | 3 | 3 | 2 | 2 | {0,1,2} |
●A | 4 | 4 | 3 | 3 | {0,1,2} |
) | 5 | 4 | 3 | 3 | {0,1} |
) | 6 | 4 | 2 | 2 | {0} |
) | 7 | 4 | 1 | 1 | Λ |
+( | 8 | 5 | 0 | 0 | {0} |
*( | 9 | 6 | 8 | 1 | {0,8} |
**( | 10 | 7 | 9 | 2 | {0,8,9} |
●B | 11 | 8 | 10 | 3 | {0,8.9} |
) | 12 | 8 | 10 | 3 | {0,8} |
) | 13 | 8 | 9 | 2 | {0} |
) | 14 | 8 | 8 | 1 | Λ |
15 | 8 | 0 | 0 | Λ |
★ K0 = Λ (空リスト)
各ステップでの操作は以下の通り。
入力が
(
ならば
Ni+1 = Ni + 1 |
Ci+1 = Ni |
Ai+1 = Ai + 1 |
Ki+1 = (Ki,Ci) |
変数ならば
Ni+1 = Ni |
Ci+1 = Ci |
Ai+1 = Ai |
Ki+1 = Ki |
‘)‘ならば
Ni+1 = Ni |
Ci+1 = Ki’ |
Ai+1 = Ai - 1 |
Ki+1 = Ki |
ここで、 Ki’ はリストの末尾の要素で、 Ki はリストの末尾以外のすべての要素(のリスト)
データ構造としてはスタックじゃないの?という気がするのだけど、 この論文が書かれた時点ではまだ発明されていないか、 広く使われてはいなかったという感じなんだろうか。 ハードウェアのスタックもIBMのメインフレームには360の時代になってもなかったし。
Hugo メモ
なんか大き目の機能追加?
The main new thing in this release is that we now support both major versions of the Dart Sass Embedded protocol, which means that you now can use the regular Dart Sass binary. We measured the new protocol to be faster with high concurrency:
We have also moved to a new log library and added some new math functions and also revised the existing set to work better with a mix of scalars and slices.
tty
ps -elf
— Yutaka Hirata (@yutakakn) June 19, 2023
とすると長いコマンド列が右端で切れるわけですが、
ps -elf | ?????
あるコマンドにpipeすると切れないことを知って、目から鱗。 pic.twitter.com/0IFamtMVYA
pipeする必要なし
— cannabis_c4 (@cannabis_c4) June 19, 2023
ps -elfww
でOK
「目から鱗」と形容するほどのことかなあ と思いつつ
こんばんは、多分そうだと思います。 https://t.co/zkdWWlfPep
— ぱぴろんちゃん😱🙀 (@papiron) June 19, 2023
自分もこう考えたので(ry
今回はGNUのものではなく libbb - busybox - BusyBox: The Swiss Army Knife of Embedded Linux から。
出力する文字列を組み立てているのがこの辺りで
busybox/procps/ps.c at 2d4a3d9e6c1493a9520b907e07a41aca90cdfd94 · mirror/busybox
static void format_process(const procps_status_t *ps)
{
int i, len;
char *p = buffer;
i = 0;
if (out_cnt) while (1) {
out[i].f(p, out[i].width, ps);
// POSIX: Any field need not be meaningful in all
// implementations. In such a case a hyphen ( '-' )
// should be output in place of the field value.
if (!p[0]) {
p[0] = '-';
p[1] = '\0';
}
len = strlen(p);
p += len;
len = out[i].width - len + 1;
if (++i == out_cnt) /* do not pad last field */
break;
p += sprintf(p, "%*s", len, " "); /* " ", not "", to ensure separation of fields */
}
printf("%.*s\n", terminal_width, buffer);
}
terminal_width
といういかにもアヤシイ名前の変数があるので
これを使っているところを探すと
busybox/procps/ps.c at 2d4a3d9e6c1493a9520b907e07a41aca90cdfd94 · mirror/busybox
/* Was INT_MAX, but some libc's go belly up with printf("%.*s")
* and such large widths */
terminal_width = MAX_WIDTH;
if (isatty(1)) {
terminal_width = get_terminal_width(0);
if (--terminal_width > MAX_WIDTH)
terminal_width = MAX_WIDTH;
}
で、
isatty(1)
を使って出力先が端末かどうか(≒リダイレクトされているか)を判定し、
端末であった場合にはget_terminal_width(0)
で得た値で設定されているのがわかる。
さらにここで呼び出している
get_terminal_width
では
busybox/libbb/xfuncs.c at 2d4a3d9e6c1493a9520b907e07a41aca90cdfd94 · mirror/busybox
int FAST_FUNC get_terminal_width(int fd)
{
unsigned width;
get_terminal_width_height(fd, &width, NULL);
return width;
}
と
get_terminal_width_height
を呼び出している。
その
get_terminal_width_height
は
busybox/libbb/xfuncs.c at 2d4a3d9e6c1493a9520b907e07a41aca90cdfd94 · mirror/busybox
/* It is perfectly ok to pass in a NULL for either width or for
* height, in which case that value will not be set. */
int FAST_FUNC get_terminal_width_height(int fd, unsigned *width, unsigned *height)
{
struct winsize win;
int err;
int close_me = -1;
if (fd == -1) {
if (isatty(STDOUT_FILENO))
fd = STDOUT_FILENO;
else
if (isatty(STDERR_FILENO))
fd = STDERR_FILENO;
else
if (isatty(STDIN_FILENO))
fd = STDIN_FILENO;
else
close_me = fd = open("/dev/tty", O_RDONLY);
}
win.ws_row = 0;
win.ws_col = 0;
/* I've seen ioctl returning 0, but row/col is (still?) 0.
* We treat that as an error too. */
err = ioctl(fd, TIOCGWINSZ, &win) != 0 || win.ws_row == 0;
if (height)
*height = wh_helper(win.ws_row, 24, "LINES", &err);
if (width)
*width = wh_helper(win.ws_col, 80, "COLUMNS", &err);
if (close_me >= 0)
close(close_me);
return err;
}
ioctrlを使ったり
さらにwh_helper
を呼び出している。
そのwh_helper
は
busybox/libbb/xfuncs.c at 2d4a3d9e6c1493a9520b907e07a41aca90cdfd94 · mirror/busybox
static int wh_helper(int value, int def_val, const char *env_name, int *err)
{
/* Envvars override even if "value" from ioctl is valid (>0).
* Rationale: it's impossible to guess what user wants.
* For example: "man CMD | ...": should "man" format output
* to stdout's width? stdin's width? /dev/tty's width? 80 chars?
* We _cant_ know it. If "..." saves text for e.g. email,
* then it's probably 80 chars.
* If "..." is, say, "grep -v DISCARD | $PAGER", then user
* would prefer his tty's width to be used!
*
* Since we don't know, at least allow user to do this:
* "COLUMNS=80 man CMD | ..."
*/
char *s = getenv(env_name);
if (s) {
value = atoi(s);
/* If LINES/COLUMNS are set, pretend that there is
* no error getting w/h, this prevents some ugly
* cursor tricks by our callers */
*err = 0;
}
if (value <= 1 || value >= 30000)
value = def_val;
return value;
}
なんか環境変数を見てますな。
ということは、リダイレクトしていない場合でも
COLUMNS
にそれなりに大きな値を設定して
psを呼び出せば出力が切り取られない?
再放送
【発表】『夏目友人帳』第1期、7月5日よりテレビ東京で再放送決定https://t.co/xcd2MENy0t
— ライブドアニュース (@livedoornews) June 23, 2023
テレビアニメ『夏目友人帳』シリーズが15年目に突入することを記念して、7月5日よりテレビ東京で第1期が再放送されることが決定した。毎週水曜26:35から全13話放送を予定しているという。 pic.twitter.com/yODqW6WuCM
第1期は2話と子ぎつねの話が(ry
void
I love that someone voided the warranty just to get this picture pic.twitter.com/lJah7rMCiO
— Paul Asadoorian @paulasadoorian@infosec.exchange (@securityweekly) June 22, 2023
「笑わない数学」
パンサー尾形「笑わない数学」第2シリーズ放送決定、10月からNHK総合で https://t.co/kD1nl46bi6
— 日曜数学会 (@nichimath) June 24, 2023
今日(6/23)放送された再放送の最後でも案内があったけど新シリーズやるのか。 これは楽しみ(何を取り上げるのかが気になるけど)
パンサー尾形「笑わない数学」第2シリーズ放送決定、10月からNHK総合で(コメントあり) - お笑いナタリー
第2シーズンでも「非ユークリッド幾何学」「コラッツ予想」「1+1=2」「結び目理論」「超越数」「ケプラー予想」「BSD予想」「極限」など、 天才数学者たちを苦しめてきた難問を扱う。尾形は「僕はこの番組のおかげで好きじゃなかった数学が大好きになりました!!! 僕みたいな人が増えてほしい!! 笑わない数学サンキューーーー!!」とコメントしている。