ときどきの雑記帖 RE* (新南口)
T2 (タチムカウ Version 2)
今週のしずえさん
蕎麦屋の屋号(店名)の「庵」
オライリーのアニマルカレンダー 2022
今週になって会社の机の上に出したのだけど、 今までのは日曜始まりだったのが月曜始まりになっていたのでちょっとびっくり>2022年版
しばらく気がつかなかった😄
- Sales Information - 大人気!オリジナルアニマル卓上カレンダー2022年版(付録付き)を貰おう!
- Sales Information - 大人気!オリジナルアニマル卓上カレンダー 2021年版(付録付き)を貰おう!
- Sales Information - 大人気!オリジナルアニマル卓上カレンダー 2020年版を貰おう! - Web直販キャンペーンのお知らせ
- オライリーオリジナルアニマル卓上カレンダー2019年PDF版
Get9
東京MXで日曜夜に攻殻機動隊S.A.C(と2nd GIG)のセレクション再放送 をやっていたのだけど、オープニングでGet9を聴きたかった(観たかった)。
Get9はスカパー版で使っていたオープニング曲(inner universe)とエンディング曲が 契約内容の関係で使えないとかで 日テレ(系列)で放送するときに作られたものだったと思うけど 関東U局で再放送したときはどれもinner universeだったような (なんで?)。
chrome
「Google Chrome」に深刻度「High」のゼロデイ脆弱性 ~すでに悪用の報告も - 窓の杜
本バージョンで修正された脆弱性は、以下の5件(括弧内は深刻度の評価)。
- CVE-2021-4098:Insufficient data validation in Mojo(Critical)
- CVE-2021-4099:Use after free in Swiftshader(High)
- CVE-2021-4100:Object lifecycle issue in ANGLE(High)
- CVE-2021-4101:Heap buffer overflow in Swiftshader(High)
- CVE-2021-4102:Use after free in V8(High)
Chromiumの生ポインタ15000個をスマートポインタraw_ptr<T>に書き換える大変更が完了しました。感謝祭の週末を狙って、44時間以内に完了させるために何度も事前にシミュレートして、当日何か起きたときのために東京・スイス・カナダで24時間体制を組んでやったんですが、https://t.co/N9fjufqagn
— Kentaro Hara (@xharaken) November 28, 2021
C++のコンパイラバグを踏むという想定外の自体にも関わらず(この手のバグはそもそもコンパイラバグだと特定するのが難しい)、知恵を持ち寄って速やかに回避パッチを当ててしまうチームプレーすごかったしGoogleエンジニアの本領見た感ある🙂MiraclePtrの実現に一歩近づきました。
— Kentaro Hara (@xharaken) November 28, 2021
unix options
- The growth of command line options, 1979-Present (2020) | Hacker News
- The growth of command line options, 1979-Present
UNIXのツール(コマンド)のオプションがどれだけ増えてきたのかという話。
To see if ls is an aberration or if it’s normal to have commands that do this much stuff, we can look at some common commands, sorted by frequency of use.
command | 1979 | 1996 | 2015 | 2017 |
---|---|---|---|---|
ls | 11 | 42 | 58 | 58 |
rm | 3 | 7 | 11 | 12 |
mkdir | 0 | 4 | 6 | 7 |
mv | 0 | 9 | 13 | 14 |
cp | 0 | 18 | 30 | 32 |
cat | 1 | 12 | 12 | 12 |
pwd | 0 | 2 | 4 | 4 |
chmod | 0 | 6 | 9 | 9 |
echo | 1 | 4 | 5 | 5 |
man | 5 | 16 | 39 | 40 |
which | 0 | 1 | 1 | |
sudo | 0 | 23 | 25 | |
tar | 12 | 53 | 134 | 139 |
touch | 1 | 9 | 11 | 11 |
clear | 0 | 0 | 0 | |
find | 14 | 57 | 82 | 82 |
ln | 0 | 11 | 15 | 16 |
ps | 4 | 22 | 85 | 85 |
ping | 12 | 12 | 29 | |
kill | 1 | 3 | 3 | 3 |
ifconfig | 16 | 25 | 25 | |
chown | 0 | 6 | 15 | 15 |
grep | 11 | 22 | 45 | 45 |
tail | 1 | 7 | 12 | 13 |
df | 0 | 10 | 17 | 18 |
top | 6 | 12 | 14 |
tarのこの数は一体…
なお
This table has the number of command line options for various commands for v7 Unix (1979), slackware 3.1 (1996), ubuntu 12 (2015), and ubuntu 17 (2017). Cells are darker and blue-er when they have more options (log scale) and are greyed out if no command was found.
とあるように元記事では表(のセル)に色がついているのだけど それは再現できなかった。 まあ直接HTMLだけで書けばできるんだろうけど。
今日の重箱の隅
[ ].slice.call(arguments) がよくわからなかったので、ECMAScriptの仕様書含めいろいろ調べた - Qiita
ただ、今回注目するべきはNOTE2の部分です。訳してみると、以下のように書かれています。
「slice関数は意図的に汎用的で、この値が配列であることを必要としません。よって、他の種類のオブジェクトに転送して、 メソッドとして使用することができます。」
なんか違和感のある訳文だったので原文に当たってみた。
The slice function is intentionally generic; it does not require that its this value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.
と単純に引用しただけではわかりづらいけど「this」 がボールド体になっているので、
it does not require that its this value be an Array
を「この値が配列であることを必要としません」としちゃいけないと思う。
SectorLISP
MBRブートセクタに収まる、わずか436バイトのLISPインタプリタ SectorLISP。しかもGCつき。これでLISPは491バイトのFORTHを抜き「世界最小のプログラミング言語」になった。ちなみにBrainfuckは99バイトで実装可能だがこれはまともな言語に数えないことにする。https://t.co/WxHozKnviV
— 新山祐介 (Yusuke Shinyama) (@mootastic) December 21, 2021
こういうのは大好物なので早速コードを眺めてみたが
sectorlisp/sectorlisp.S at main · jart/sectorlisp
// LISP meta-circular evaluator in a MBR
// Compatible with the original hardware
.code16
.globl _start
_start: .asciz "NIL" # dec %si ; dec %cx ; dec %sp
kT: .asciz "T" # add %dl,(%si) boot A:\ DL=0
start: ljmp $0x7c00>>4,$begin # cs = 0x7c00 is boot address
.asciz "" # interned strings
kQuote: .asciz "QUOTE" # builtin for eval
kCond: .asciz "COND" # builtin for eval
kCar: .asciz "CAR" # builtin to apply
kCdr: .asciz "CDR" # ordering matters
kCons: .asciz "CONS" # must be 3rd last
kEq: .asciz "EQ" # must be 2nd last
kAtom: .asciz "ATOM" # needs to be last
begin: mov $0x8000,%sp # uses higher address as stack
# and set independently of SS!
# 8088 doesn't stop interrupts
# after SS is set, and PC BIOS
# sets SP to a value that will
# damage our code if int fires
# between it setting SS and SP
push %cs # that means ss = ds = es = cs
pop %ds # noting ljmp set cs to 0x7c00
push %cs # that's the bios load address
pop %es # therefore NULL points to NUL
push %cs # terminated NIL string above!
pop %ss # errata exists but don't care
mov $2,%bx
main: mov %sp,%cx
call GetToken
call GetObject
call Eval
xchg %ax,%si
call PrintObject
mov $'\r',%al
call PutChar
jmp main
GetToken: # GetToken():al, dl is g_look
以下略
脇のコメントに意味ありげなニーモニックが並んでいるけど
いきなりシンボル(NIL
)から始まっている?
と悩んでしまったが
GAS Listing for SectorLISP
のInitialization
のところに解説があった。
One problem that arises is that the BIOS asks the CPU to execute the ASCII strings at the beginning of the image. By sheer luck we learned NIL and T could be safely decoded without side-effects. Had that not been the case, we’d’ve needed to choose a different terminator than NUL which would have made the program file larger.
"N" dec %si "I" dec %cx "L" dec %sp "\0T\0" add %dl,(%si) # and we know for certain %dl is 0 ljmp $0x7c00>>4,$begin
なるほど? 🤔
動きを把握するのはちょっと手ごわそうだけど読んでみるか (これまでの最小だったFORTHも気になる…)。
- LISP with GC in 436 bytes
- sectorlisp/lisp.c at main · jart/sectorlisp
- MBR(Master Boot Recode)
- Assembler/なぜx86ではMBRが"0x7C00"にロードされるのか?(完全版) - Glamenv-Septzen.net
- ブートストラップローダの詳細
ダンドリオン?
ストッキングの袋詰めを内職に出すことに。まずは一箱どのくらい手間がかかるか調べなくては。両親二人で三時間。ということは、一人だと一箱六時間かかる。それを参考に、一箱あたりの内職代を決めた。案の定、慣れてきた人でも四時間を切ることはできなかった。ところが。
— shinshinohara (@ShinShinohara) December 18, 2021
からの一連のツイートを追いかけて 「(テキシコーの)ダンドリオンじゃん」 と思った😄 (ツイート内容は 単純作業は創意工夫の小宇宙|shinshinohara|note にもまとめられている)
テキシコー 効率第1ダンドリオン② pic.twitter.com/pHuOLiC7Ga
— めおんご✌︎('ω'✌︎ ) (@ksm52_wg) December 29, 2019
テキシコー 効率第一ダンドリオン④ pic.twitter.com/px51McXHWr
— めおんご✌︎('ω'✌︎ ) (@ksm52_wg) December 29, 2019