Array.prototype.map passes 3 arguments to callback: currentValue, index, array
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map

parseInt takes string and the 2nd optional argument radix.
Valid radix is an integer between 2 and 36.
radix is 10 if 0 is specified and the string doesn’t start with “0x” or “0X”.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt

So the parseInt is called with arguments:

(‘11’, 0, [‘11’, ‘11’, ‘11’]) => 11 // 0 is interpreted as 10
(‘11’, 1, [‘11’, ‘11’, ‘11’]) => NaN // invalid radix
(‘11’, 2, [‘11’, ‘11’, ‘11’]) => 3 // radix is 2

BTW, partialRight of Ramda.js doesn’t help. partialRight just add another argument to the end of the function call.

> const R = require(‘ramda’);
> [‘11’, ‘11’, ‘11’].map(R.partialRight(parseInt, [10]))
[ 11, NaN, 3 ]

  1. Google Authenticator: three-dot menu > Transfer accounts > Export accounts > (PIN) > Next > (Pick your accounts) > Next
  2. You will get a QR code
  3. Scan the QR code by any QR code scanner to get the text like otpauth-migration://offline?data=…
  4. Decode the otpauth-migration link by using https://github.com/scito/extract_otp_secret_keys
  5. You will get the Name, Secret, Issuer, Type and the QR code
  6. The following code can generate the TOTP and you can find it’s same as the code generated in Google Authenticator

Links:

Android Phone の電池を自前で交換してタッチパネルが効かなくなってしまった。

ADB が有効になっているので ADB を通して操作できないかと思って WSL 上 opencv-python を試してみた。

結果的には時間が経ってタッチパネルも復活したので必要なくなったが、せっかく試したのでここにメモを残すことに。

事前準備

コード

参考情報

Xiangqun Chen

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store