ASi

Javascript

Javascript で乱数バイト列のBase64を得る方法

スマートじゃない。。。。 let arr = new Uint8Array(100) crypto.getRandomValues(arr) let str: string = "" for (let i in arr){ str += String.fromCharCode(arr[i]) } let b64str = btoa(str)

乱数文字列

暗号学的に安全ではない node -e "var S='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; var N=20; console.log(Array.from(Array(N)).map(()=>S[Math.floor(Math.random()*S.length)]).join(''));"

node でコマンドラインで stdin 処理

echo test | node -e " \ var input = ''; process.stdin.on('data', function(chunk){ input += chunk; }); process.stdin.on('end', function(){ // input を処理 }); "

Slack の記事をコマンドラインで取得

Get messages on Slack by command line / terminal. https://api.slack.com/custom-integrations/legacy-tokens で token 作成 https://api.slack.com/methods/search.all を使用。 パラメータ query の内容は下記を参考に。 https://get.slack.help/hc/ja/…