feat: use hexo

This commit is contained in:
2021-01-21 21:45:05 +09:00
parent 2d93c3d6ca
commit 039bac5e09
185 changed files with 2400 additions and 2575 deletions

View File

@@ -0,0 +1,36 @@
---
date: 2019-10-25 19:49:01 +0900
title: Bose Noise Cancelling Headphones 700レビュー
---
Bose Noise Cancelling Headphones 700を使い始めて一ヶ月が経ったので、現時点での印象をまとめる。
## Pros
* ノイズキャンセリング性能の高さ
* デザイン
* 8台までのマルチペアリング
* 2台までのマルチポイント
* タッチコントロール
* 3段階ノイズキャンセリングレベルコントロール
* 10段階の内3つをあらかじめ選んでおき、ボタンを押してローテーションできる
* QC30は1段階ずつしか変更出来ずボタンを連打させられる仕様だったので、大きな改善
* バッテリーの持ちの良さ
* 15時間くらいは動く
* 有線対応
* 有線時もANCが働く
* USB-C充電対応
## Cons
* マルチポイント時の混線ノイズ
* 音楽再生中にもう一方のデバイスで何か通知音が鳴るとストリームに対して「プツプツ」ノイズが入る
* システムサウンドが大きすぎる(変更不可)
* 消耗部品の多さ
* ヒンジ部分はケースに仕舞う度に動かなさいといけないため消耗が心配
* 可動部が多いほど故障率は上がる
* 本体側での接続先選択が不可能
* QC30では出来ていた本体側のボタンで接続先を選択できる機能が無くなっていた
* ボタン配置のミス
* ボタンが手に触れやすい位置にあるため、ヘッドホンを外す度に間違って押してしまう
* ストリーム元とボタンの送信先が異なるバグ
* マルチポイント接続で一方のデバイスで音楽を流している際に、再生ボタンの信号が音楽を流していない方のデバイスに送信されてしまうバグがある

View File

@@ -0,0 +1,459 @@
---
title: 英語メモ
date: 2019-01-17T10:31:00.000+00:00
redirect_from: "/blog/2019/01/17/english-note"
---
雑多なメモです。
- spin up - 立ち上げる
- woe - 悲しみ
- a little too - 少し〜すぎる
- all that much - それほど(否定形で)
- family doesn't mean all that much to you.
- articulate - 考えをはっきり述べられる
- concordant - 調和した
- ergo - それ故に
- かたい ergo - thus - therefore - so やわらかい
- endeavor - 努力
- I myself struggle with the endeavor of mastering the English language
- vis-à-vis - 〜と向かい合って、〜と比較して
- takeaway - 要点
- thoroughly - 徹底的に
- have little to do with ほとんど関係がない
- As well as I recall, - 記憶している限りでは、
- He is more of a researcher - どちらかというと研究者だ
- It is more a matter of feelings. - どちらかというと気持ちの問題だ
- more of a curse than a blessing - メリットよりデメリットが多い
- manifold — 多数の
- three-fold — 三倍
- evade — 避ける = avoid
- a word that evades definition — 定義しにくい言葉
- don't be fooled by A — A に惑わされるな
- thrice — とても
- Circuit Judge Joseph Bulone called 49-year-old Michael Drejka a “wanna-be” law enforcement officer and a self-appointed “handicapped parking space monitor.”
- encapsulate — 包容している
- atm — at this moment
- so far — これまで
- SMDH — Shaking My Damn Head
- micro stutter — プログラム上の細微な遅延
- When characters are missing from fonts, it's nice to be able to communicate to the user that this happened. — フォントに文字が欠けている場合、それをユーザーに伝えることができると便利です。
- for the sake of A — A の名のもとに
- Firefox has abandoned subpixel-AA for the sake of simplicity — Firefox はシンプルさの名のもとにサブピクセル AA を棄てました。
- The entire idea behind subpixel-AA is that you are abusing how the pixels are laid out in a display. — サブピクセルアンチエイリアスは、ディスプレイにピクセルがどのように配置されているかという知識を基に成り立っています。
- a reasonable balance — 適度なバランス
- That said, — とはいえ、
- A with B on it — B が乗っている A
- can play a bit fast and loose with A — A を大雑把に扱える
- current iteration of A — 現行の A
- A doesn't play nice with B — B がため A が上手く動かない
- our current iteration of search doesn't play nice with CJK characters
- Tried out and see what happens — 試して成り行きを見てみた
- Losing your shit — the state of being pushed over the edge of sanity and having a complete and utter freak out or mental/emotional breakdown ≒ お前は完全にイッちまうぜ
> And this is a Tech Forum, AND it's supposed to be a safe space. — そしてここは技術フォーラムであり、*かつ*心理的安全性が確保されているべき場所だ。
> If you don't want to answer questions for "n00b", then don't answer. — "初心者"の質問に答えたくないなら、ただ口をつぐんでくれ
> Have you thought of what you’ll do after you retire? — 引退したらやりたいことについて考えたことある?
- any of those — これらどれでも (all of, every と交換可能 | 肯定文)
- there aren't any apples on the floor (否定の場合は any の後に複数形)
- you will likely do A — あなたは A することだろう
- 99% of the time this is what you want to use — 99%これを使えば良い
- The one catch is that — 例外は、
- I ended up settling for this which looks incredibly anti-pattern-y but was the only option that wouldn’t explode on me — 最終的にこれに落ち着いた。アンチパターンっぽいけど僕にとっては一番安定している
- Why was that even created? — まずなぜこれが作られたの?
- Putting the main code in another function serves two purposes:
- one week cannot and should not define any team
- it go to show that A — A ということの証明となる
- A is to not have B — 「A」とは、B を持たないことである
> wireless charging is kinda funny because it really goes to show that the only way to get the tech industry to agree on a unified connector is to not have a connector
> me: it’s not that I mind freelancing, I love it. It’s just that the social interaction is pretty minimal and extremely uneven day-to-day and sometimes I wonder how that will affect me long term, you know?
> barista: ok are you going to order
- constitute, make up
> glad you’re happily situated elsewhere now. — あなたが他の場所で活躍しているようで嬉しい
- My dA account turned 10yo. In fact, I had spent 99% of the time as a lurker and six months ago finally started drawing and posting art.
- A conditional request is one that triggers if something happens, like: "If you don't quit talking, I am gonna have to ask you to leave." In this case, you can't really say, "If you don't quit talking, I have to ask you to leave." So even though it's not really conditional, using a conditional form is more polite because it's less direct.
- come to pass
- come across
> I would also half-expect the following sentences to contain further information on this particular group of students, like this:
> It uses the definite article before "majority of the students", as if referring to a known group.
> This sentence uses the indefinite article before the "majority of the students". This has the effect of introducing this group of students to the reader or the listener.
> It may give a hint that the exact number of the students that will vote is uncertain: it could be 51%, but then it could be 88%.
> Design is not just a visual thing, it's a thought process. it's a skill.
- at will — 意思次第で
- for asking — 望むなら
- fuck A up — A をボコボコにする
- friendly reminder - a euphemism for "this is the last warning"
- I feel attached
- I feel called out
> Lots of bittersweet feelings over this
- LRT: My favorite part of this is the upload on Youtube that's titled "Iwata vs Reggie (full fight)" like it was stitched together from multiple episodes of Naruto.
- get around to — 先延ばしにしていたことにやっと取り掛かる
- Finally got around to writing something on @ThePracticalDev, which was a really great experience!
- wordy, lengthy — 言葉の多い、冗長な
- A teenager not old to buy a six-pack — ビールも買えない年頃の子供
- It is likely that 未来形 — 〜になるだろう
- It's likely that the affair will come to nothing — どうやら無事に治まりそうだ
- We will most likely do A — 我々は必ず A をするでしょう
- chirring - 虫が鳴く; bugs chirring
- what are you waiting for
- with a grain of salt — 割り引いて(考えて)
> learning foreign languages is for me lifelong hobby. knowledge likely to requires much time to acquiring but it never decays.
> _sees client, whistles loudly_
> weston comes out of nowhere running on all fours like a gorilla towards client
> I don't even understand how there can be HOURS of planned downtime for a service like this.
> And what could go wrong, in depending on the internet to keep the child warm
> the developer advocate in question understands the language barrier, it would seem; he’s not a native English speaker. regardless, his stance puts many who haven’t had a strong English education at a disadvantage. it prioritizes “getting things done” over people...
> save my dying cactus. what's wrong. cactus should have been easy stuff since they barely need water.
> higher form of something
> i hope it will inspire Americans to pursue a second language
> I love the fact that
> let's see if the result is the same (spoiler alert: it wasn't)
> Feature engineering is when we use existing features to create new features to determine if they provide new signals to predict our outcome.
> The happiest moment of my life was when I passed the entrance test.
> Controversial opinion: Every single opinion is controversial.
- Actually, my younger brother is a bit of a chav. — 弟はちょっとヤンキーなんだよ。
- take leap of faith 確証が持てないことを信じること(盲信とは違う)
- icky — 古めかしい
- adherence — 執着 one's adherence to A
- belief — 信念
- on principle — 道徳的見地から
- in set terms — 決まり文句で
- (Evening|Cold weather) has set in — (夜に|寒く)なった
> i feel like i'm most productive when i'm avoiding some other kind of responsibility
- be more of A — どちらかといえば A である; He is more of a researcher.
- be more of A thant B — B というよりむしろ A だ
- see less pain but also less joy — 痛みを感じることも少ないが喜びも少ない
- in term of A — A の観点から
## Go
- go into 何かを始める;状態に入る;費やされる
- go down 降りる;落ちる;低下する; go down on all fours — 四つん這いになる
- go easy on fellow insiders 身内に甘い;身内に手加減する
- go easy with her 彼女に優しくしろよ
## Get
- get over it (障害を)乗り越えろ
- get out 出て行く
- get down on A for B — B したことに大して A を批判し続ける
- get down to [verb.] — やっと始める。
- get in — 乗り込む
- too much to take - 手に負えない
- de rigueur - 慣習上必要不可欠
- utterly - 完全に
> make sure you know what the author expects you to know.
- The doom-laden feeling that this creates in us is then intensified by our inability to remember the past;
- smoke-laden 煙が立ち込めた
- doom-laden 厭世観で満ちた
> Thanks to his help, we managed to finish the work in time. 彼のおかげでなんとか時間内に仕事を終えることできた
> Thanks to the development of medicine, people have been able to live longer.
> Owing to the rise in oil prices, people are forced to use public transportation.
> The balloon is likely to burst at any time その風船は今にも爆発しそうだ
> It is because the air was polluted that the experiment was a failure.
> The experiment was a failure because the air was polluted.
> Thesis. Remote companies have less of an echo chamber since they are distributed. Thoughts?
> Obviously they should A, and B when C. Not D forever.
- Still - there is no A, just B.
> I think people are angry because Slack A, B and is C. No D, no E.
> Because he's the kind of person who likes helping others and is always gentle and kind as you described
> it was more difficult to get it wrong than guess it right!
> XD
> I'm pretty sure there was a lot of uproar about the Equifax thing
## Idioms
- Don’t make me blush XD — 恥ずかしい XD
- Think before you speak next time — 次からは考えてから話せ
- just a citation of the law they're overcompensating for — 彼らは濫用している法律の引用ただそれだけしか示してない
- repeal — 撤回する
- no respect for their users — ユーザーに対する敬意がない
- be now going the A route — 今度は A 作戦ときた
- in a blunt fashion — 露骨なやり方で
- "DM us, we'll take a look!" faux-friendly route — 偽りの友情作戦「DM で詳しく話を聞かせて!」
- reinstate — (アカウントを)復活させる
- shut the whole thing down — 全てを終わらせる
- as if, as though — 後者は話者の疑いが現れている. 仮定法過去を取る. It's as if I were a movie star.
- predominatly — 大抵は. Your costs are predominantly human labor.
- a myriad of A — 無数の A
- funnel toward 狭いところを前へと通る
- in a verifiable manner — 検証可能な方法で
- in a frigid manner — 冷たい態度で
- are expressed as — 〜として表せる
- a cup of tea — 好きなこと、得意なこと (It's not my cup of tea)
- I have a lot on my plate — やることが沢山ある
- It's a piece of cake — 朝飯前、超簡単
- can enforce fine-grained control over — 何かをきめ細かく制御することができる
- C’est la vie! — それが人生
- What’s done is done — 終わったものは仕方ない
- If you've got it, flaunt it — 良いものは隠さないで
- clench my teeth — 歯を食いしばる(って耐える)
> Hello, I just came across this wonderful library and was really intrigued by it :)
> When teaching, be careful not to mix up "" and "".
- life saver under this condition
- It turned to be such great experience, I couldn’t miss opportunity to share it
- I like Makefiles, they are simple and yet very powerful.
- To my surprise — 驚くべきことに
- I did it out of curiosity — 興味本位でやった
- If you're of the belt-and-suspenders mindset, consider setting UsePAM to 'no' as well. — 心配性な性格のこと
- you can cancel it as long as it has not been matched — 〜されていない限りいつでも
- By definition — 定義によると
- A found B C — A は B が C だと思った
- in that — という点において
- Iconoclast — 因襲打破主義者
> Researchers spend a great deal of time doing something — 研究者は多くの時間を〜するのに割いています。
- ~ upon demand for ~ — ~の要請に応じて~
- Granularity — 粒度
- in a manner — いわば、ある意味
- periodic – 定期的 <=> sporadic – 不定期的
- abuse — 名詞は(a)bjú:s 動詞は(a)bjú:z
- eavesdrop — 盗み聞きする
- hypernym – 上位概念 <=> hyponym – 下位概念
- in this case — 今回の場合
- imply, represent, mean, stand for, refer to — 意味する
- redundant — 余剰であり過剰であり不必要なもの
- appropriate, proper, reasonable — 妥当な
- barely — かろうじて、ほとんど〜ない
> The iPad already has external keyboard support and an external trackpad support would go a long way to making the iPad a Mac replacement.
> Countless wrong inferences could be drawn from those observation.
- it drives me crazy [nuts] — イライラさせられる
- describes the steps that are involved in ~ — ~に関する手順について説明する
- 前置詞 in は特徴の違いを、of は程度の違いを表す
- A is in proportion to B — A は B に比例している
- A is out of proportion to B — A は B に反比例している
- 受動態は不自然に手を加えられて発生した結果に付随する、能動態は自然に発生した場合に付随する — our profits were increased は不正があったかのような表現、our profits increased が正しい
- be collectively known as A — A と総称されている
- Any links to this, as to be honest nobody is providing evidence, just lip-service relying on the ignorance of most readers
- in a great hurry - 大急ぎで
- gross 名詞 — 明らかな〜, a gross oversimplification - 明らかに過度な簡略化
- among — 〜の間で — in, through で代替可能
- throw A away — A を捨てる、A を無駄にする
- throw A up — 急にやめる
- be quick to — すぐ〜する。(People are quick to alienate outsiders 人々はすぐよそ者を阻害する)
- incredulous at — 〜を容易に信じない
- lack of standards for — 〜に対するけじめの無さ
- ludicrous, ridiculous — 馬鹿げた
- derogatory — 差別的な
- A that it was B — A だったので、B , 便利な接続詞
- After (p.p.), He (p.) — 〜の後、彼は〜した
- vicious — 凶悪な
- relentless, ruthless — しつこく、in の時は徹底的な
- mercilessly — 無慈悲に
- reckless — 無謀な
- profound — 心理的影響が重大な、深刻な(物理的には deep が適切)
> I felt like a coward hiding this from people — それを隠すことで自分が臆病者に思えた
> While training for the marathon, she was relentless in following the same schedule — マラソンの練習の間、彼女は同じスケジュールをしつこいほど守った。
- His history of A led to B — 彼が A を繰り返したせいで B を招いた。
- hatred — 憎悪
- coarse — 粗い
- B with A everywhere — A がいたるところに散乱している B
- people, all, the crowd — 人々
> A was quick to spot the potential of the Internet — A はインターネットの可能性をいち早く見出した
- a man who's nice to be around — そばに居てくれると助かる親切な人
- His generosity knows no bounds — 彼の寛大さには限りが無い
- borad-minded — 心が広い
- in one way or the other — どのみち、ある意味 e.g. This inspired you in one way or the other これはある意味あなたをインスピレートした
- to some extent — ある程度は、e.g. Travelling only helps to some extent 旅行はある程度それを助ける
- close-knit — 密接に関係している
- hot take — 走り書き
- cost an arm and a leg — 大変な金がかかる
- person with a forgiving nature — 寛大な心の持ち主
- we are on the same page — これで我々の認識が一致しましたね
- in that — という点で。 Man differ from animals in that they can think and speak.
- That said, — とは言え。ですから。
p.p. the present progressive form, 現在進行系
- There have long been allegations that という噂がある
- The antisocial behaviour you are naturing あなたが心に抱いている反社会的行動
- have a lot to do with ~によるところが大きい
一般に前置詞+ who(m)は既知の情報を確認する際に, who +前置詞は新しい情報を求める際に好まれる
> This is sure to satisfy those who are into computers. これはコンピュータにはまっている人をきっと満足させるだろう
> I've always wanted to study abroad someday but I haven't been able to yet.
## 複文と分詞構文
- A typhoon hit the city, causing big destruction.
- While skiing in Hakuba, I twisted my ankle.
- Not knowing what to say, she kept silent.
- Seeing me, the man ran away. ←→ As the man saw me, he ran away.
- Written in simple English, this book is easy to understand. ←→ Since this book is written in simple English, it is easy to understand.
- Walking along the beach, I found a beautiful shell. ←→ When I was walking along the beach, I found a beautiful shell.
- and そうすれば or 然もなくば but けれども so だから、それで for というのも nor 〜もまた、〜ではない
- She is not a politician, nor is she a diplomat.
## when
1. 未来の条件を表す場合は現在形を使う When I arrive at the station, I'll call you.
2. 過去の時を表す場合は過去形 When I was a child, I used to like soccer.
3. 未来の可能性を話す場合は未来形 I don't know when he will come.
- happened to — たまたま、偶然、もしかして
- Do you happen to know if she has a boyfriend? — あの子に彼氏いるのかな?
不定詞は名詞・形容詞・副詞的働きをする動詞ベースの詞のこと
to 不定詞が unrealized(未実現)、-ing が realized(実現)
- I want (to eat an apple)← 名詞的
- Thank you for playing the game
1. She is studying English hard to study abroad.
2. She study English hard to study abroad.
違いは?
- only to A — 思わぬ悲観的な事実を説明する clause
- He returned after the war only to be told that his wife had left him.
- I tore open the box, only to discover that some of the parts were missing.
- I arrived only to find that the others had already left.
## 倒置法
- So do I — 私も!(I like apple に対して)
- So am I — 私も!(I'm twenty years old に対して)
- Here comes bus — もうバス来たよ
- Here we go — ほら行こう
- In you go — 中にお入り
- What a shitty day — なんて日だ
- How beautiful (that is) — なんて綺麗なの
- "I'm fine", said he — 大丈夫だと彼は言った
- Dark as(though) it was, I found the footprints. — 暗かったが、なんとか足跡を見つけた
- Hard though she tried, she couldn't make the deadline. — 頑張ったが間に合わなかった
- Do what you will, I won't give up — 何をされようとも諦めない
- Walk as he would, he couldn't get to the station. — どんなに歩いても駅にたどり着けなかった
> "We live in a world of churn, but we do not have to accept high churn rates as the only reality." from "Subscription Marketing: Strategies for Nurturing Customers in a World of Churn (English Edition)" by Anne Janzer
> 45 Ways To Avoid Using The Word 'Very' - Writers Write
> I still hate that "atheist" now is code for "bigoted asshole."
> Life only comes around once. So do whatever makes you happy and be with whoever makes you smile!๑╹◡╹)ノ…
> This is exactly what I thought was gonna happen when I saw those tweets, thank you…
> @Nodejs and @the_jsf have merged to form the #OpenJSFoundation! The OpenJS Foundation is to become the central place to support collaborative development of #JavaScript and web technologies.
> I love critical thinking and I admire skepticism, but only within a framework that respects the evidence.
> In earlier versions of TypeScript, we generalized mapped types to operate differently on array-like types. This meant that a mapped type like Boxify could work on arrays and tuples alike.
> a cool thing about the last few years is that the U.S. became the leading exporter of the intellectual machinery of western fascism and one of the leading domestic debates about it is whether undergrads are treating the people behind it politely enough
> Perhaps it would be less of a debate if they were more circumspect in who/what they call fascism. The main criticism seems to be that they have a lot of false positives in their "fascist-test" and treat anyone who points this out as fascist fellow travellers
> Universities are filled with people who feel like they are competing against their colleagues. When you do this, you end up constantly looking in front of you, feeling bitter. Or looking behind you, becoming arrogant. Run your own race.
> — Marc Lamont Hill
> https://twitter.com/marclamonthill/status/1109500482500939776?s=12
> Much discussion about bias in ML due to the training dataset - this has been an active area of study for a long time in population genetics, and is still not fully resolved
> — Miriam Huntley
> https://twitter.com/iam_mir_iam/status/1108819635959418881?s=12
> Welcome to the FGO NA Twitter. If you look to your left, you'll see the salty people club that are currently sulling about not pulling Okita. If you look to your right, you'll see the angry weeb club still screeching about Emiya Alter. Please enjoy your stay.…
> — ℭ𝔦𝔫𝔡𝔢𝔯 𝔉𝔞𝔩𝔩
> https://twitter.com/zettainverse/status/1109231751019278337?s=12
> Probably one of the most auto-bookmarkable post I've seen in a while, regardless of skill level with git:
> — Ben Halpern 🤗
> https://twitter.com/bendhalpern/status/1135319291568562176?s=12
> Now announcing tsconfig-api 🎉 An experimental microservice for retrieving @typescript compiler option details 🔎 100% open source and hosted by @zeithq Now
> — Matterhorn
> https://twitter.com/matterhorndev/status/1138610398159147008?s=12
> Amid all of the chaos, an answer could be found.
> There’s a special kind of joy in UI libraries when you see small primitives working. Like maybe it’s a two rectangle demo. But you’ve already learned that thanks to composition, if it worked for two rectangles, you can make it work for a whole FB/Twitter-level app.
> — Dan Abramov
> https://twitter.com/dan_abramov/status/1143911059717263360?s=12
> Yes, assuming something will work like literally every other software that has ever been created will work is subjective.
> Super annoying that these people are so insecure about themselves that they have to do that kind of thing.…
> — Kent C. Dodds
> https://twitter.com/kentcdodds/status/1147142716280602629?s=12
> Honest question: how does banning people from an opportunity to build a professional presence and potentially escape an oppressive regime advance human rights?…
> — Dan Abramov
> https://twitter.com/dan_abramov/status/1154871232459956224?s=12
> The national flag of Japan is a rectangular white banner bearing a crimson-red disc at its center. This flag is officially called Nisshōki (日章旗, the "sun-mark flag"), but is more commonly known in Japan as Hinomaru (日の丸, the "circle of the sun"). It embodies the country's sobriquet: Land of the Rising Sun.
> reading this tweet is weird because at first you're like "hahaha they're not used to how gacha works" then you realize you've just been conditioned into being ok with predatory game models
> You're offering subjective value assessments, not facts.…
> — Levi Roach
> https://twitter.com/DrLRoach/status/1172907254892421120?s=17
> My takeaway is that I'm starting a support group for design systems engineers across the world. 😛 We're all going through different versions of the same challenges at each of our companies and it's always encouraging to share information about where we are in this journey.
> — Maja Wichrowska
> https://twitter.com/majapw/status/1187891828189589504?s=17

View File

@@ -0,0 +1,59 @@
---
title: Give Your App Slick Name with namae.dev
date: 2019-08-29 03:12:00 +09:00
---
Have you ever struggled with naming your new OSS project or web app? While hoping no one claimed your desired one in GitHub, npm, Homebrew, PyPI, Domains, etcetera, choosing the best name is weary work.
That's why I created [namae](https://namae.dev).
# namae
![np1a40lrch9m10b1s7nz.gif](/uploads/np1a40lrch9m10b1s7nz.gif)
[namae](https://namae.dev) is an inter-platform name availability checker for developers and entrepreneurs.
Once you fill out a form with a name you want to use, namae will check through various registries and check if the name is already in use or not.
![pww3x6ycshadfiiotep9.png](/uploads/pww3x6ycshadfiiotep9.png)
# Supported Platforms
namae supports 15 package registries and web platforms, and it's growing.
- Domains
- GitHub Organization
- npm / npm Organization
- PyPI
- RubyGems
- Rust (crates.io)
- Homebrew / Homebrew Cask
- Linux (Launchpad & APT)
- Twitter
- Spectrum
- Slack
- Heroku
- ZEIT Now
- AWS S3
- js.org
Additionally, the search result comes with a list of projects which has a similar name on **GitHub** and **App Store**.
# Name Suggestion
namae also has a unique feature called __Name Suggestion__. It suggests auto-generated names made up of common prefix/suffix and synonyms. Take look at some examples.
![aas52pwbrueyzrulfiae.png](/uploads/aas52pwbrueyzrulfiae.png)
![j6jv0rq4gin28hks1ika.png](/uploads/j6jv0rq4gin28hks1ika.png)
Clicking the suggestion, namae completes the form with it and start searching around the registries.
# Open Source
namae is completely open-sourced and the entire source code is available at [GitHub](https://github.com/uetchy/namae). It consists​ of Node.js Lambda for APIs and React app for the web frontend, and is running on [ZEIT Now](https://now.sh).
# Conclusion
namae saves your time searching for a universally available name around a set of hosting providers and package registries.
Go to [namae.dev](https://namae.dev/) and grab a report for the availability of your future product name. If you have any suggestion, poke me on Twitter ([@uechz](https://twitter.com/uechz)).

View File

@@ -0,0 +1,34 @@
---
title: padStartにおけるpadSizeの求め方
date: 2019-01-14 00:00:00 +09:00
redirect_from: "/blog/2019/01/14/padsize"
---
padStart における padSize の求め方です。
$$
\textrm{padSize} = \lceil \log_{10}(\mathbf{arraySize} + 1) \rceil
$$
```js
const padSize = Math.ceil(Math.log10(arr.length + 1));
arr.forEach((item, index) => {
console.log(`${index.padStart(padSize, "0")}: ${item}`);
});
```
結果は以下のようになる。
```
01: item1
02: item2
03: item3
04: item4
05: item5
06: item6
07: item7
08: item8
09: item9
10: item10
```

View File

@@ -0,0 +1,187 @@
---
title: Electronアプリをコード署名してApple 公証 (Notary) を通過させる方法
date: 2019-06-05 00:00:00 +09:00
redirect_from: "/blog/2019/06/05/sign-and-notarize-electron-app"
---
electron-builder を利用して macOS 向け Electron アプリをコード署名し、公証を通過させます。
> **tl;dr**: コード署名と公証に対応した macOS アプリ Juno のリポジトリを[GitHub で公開](https://github.com/uetchy/juno)しています
# Code Sign
アプリのコード署名は`electron-builder`によって自動で行われます。内部的には[electron-osx-sign](https://github.com/electron-userland/electron-osx-sign)が使用されます。
リリース用のアプリにコード署名をするには、Keychain に有効な Developer ID Certificate が格納されている必要があります。macOS Developer Certificate は開発用のコード署名のみ可能なので、リリース用としては不十分です。
まだ証明書を発行していない場合は、[Apple Developer](https://developer.apple.com/account/resources/certificates/list)で証明書の追加ウィザードに進み、**Developer ID Application**を選択して証明書を発行してください。
# Notarize
コード署名済みのアプリを[electron-notarize](https://github.com/electron-userland/electron-notarize)を使用して Apple Notary Service に提出します。
```js
const { notarize } = require("electron-notarize");
notarize({
appBundleId,
appPath,
appleId,
appleIdPassword,
ascProvider,
});
```
- **appBundleId**: アプリの Bundle ID です。`package.json``build.appId`と同じものを使います。
- **appPath**: `.app`の絶対パスを指定します。
- **appleId**: Apple Developer として登録している Apple ID を指定します。
- **appleIdPassword**: Apple ID のパスワードです。2 要素認証を必要としないパスワードが必要なので、[Apple ID](https://appleid.apple.com/#!&page=signin)にアクセスして**App-specific Password**を発行してください。
- **ascProvider**: Apple Developer の Membership に記載されている**Team ID**を指定します。
## electron-builder の afterSign フック
electron-builder の afterSign フックを使用して、コード署名が済んだアプリを自動で Notary に提出します。
フックスクリプトを`./scripts/after-sign-mac.js`に置きます。
```js
const path = require("path");
const { notarize } = require("electron-notarize");
const appleId = process.env.APPLE_ID;
const appleIdPassword = process.env.APPLE_PASSWORD;
const ascProvider = process.env.ASC_PROVIDER;
const configPath = path.resolve(__dirname, "../package.json");
const appPath = path.resolve(__dirname, "../dist/mac/App.app");
const config = require(configPath);
const appBundleId = config.build.appId;
async function notarizeApp() {
console.log(`afterSign: Notarizing ${appBundleId} in ${appPath}`);
await notarize({
appBundleId,
appPath,
appleId,
appleIdPassword,
ascProvider,
});
console.log("afterSign: Notarized");
}
exports.default = async () => {
await notarizeApp();
};
```
`package.json``build``afterSign`を追加してコード署名が終わった後にスクリプトが実行されるようにします。
```json
"build": {
"afterSign": "./scripts/after-sign-mac.js"
}
```
## Hardened Runtime and Entitlements
このままでは公証に失敗します。デフォルトで書き出されるバイナリでは、セキュリティの強化された[Hardened Runtime](https://developer.apple.com/documentation/security/hardened_runtime_entitlements)が有効になっていないためです。以下のようなエラーメッセージを貰います。
```json
{
"status": "Invalid",
"statusSummary": "Archive contains critical validation errors",
"statusCode": 4000,
"issues": [
{
"severity": "error",
"code": null,
"path": "App.zip/App.app/Contents/MacOS/App",
"message": "The executable does not have the hardened runtime enabled.",
"docUrl": null,
"architecture": "x86_64"
},
}
}
```
`package.json``build.mac.hardenedRuntime``true`にして Hardened Runtime を有効にします。
```json
"build": {
"mac": {
"hardenedRuntime": true
}
}
```
Hardened Runtime 下では、必要に応じて Entitlement を指定しなくてはなりません。Electron の実行には`allow-unsigned-executable-memory`という Entitlement が必要なので、`entitlement.plist`ファイルを`build`フォルダに作成し、以下のような plist を記述します。
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
</dict>
</plist>
```
`package.json``entitlements`及び`entitlementsInherit`に Entitlment が記述された plist のファイルパスを指定します。
```json
"build": {
"mac": {
"hardenedRuntime": true,
"entitlements": "./src/build/entitlement.plist",
"entitlementsInherit": "./src/build/entitlement.plist"
}
}
```
Hardened Runtime で Electron を実行することができるようになったので、Notary を通過できる状態になりました。
実際に`electron-builder`を実行してすべてのプロセスが上手く動作することを確かめてください。
# Verify Notary Status
ただしく公証を得られたかどうかは`altool`で調べることができます。
公証通過後に送られてくるメールに`Request Identifier`が記載されているのでメモします。
```
Dear Yasuaki,
Your Mac software has been notarized. You can now export this software and distribute it directly to users.
Bundle Identifier: <Bundle ID>
Request Identifier: <UUID>
For details on exporting a notarized app, visit Xcode Help or the notarization guide.
Best Regards,
Apple Developer Relations
```
`xcrun altool --notarization-info`コマンドに UUID と Apple ID、パスワードを指定して公証ステータスを確認します。
```
xcrun altool --notarization-info <UUID> -u $APPLE_ID -p $APPLE_PASSWORD
```
正しく公証が得られている場合は以下のようなメッセージが表示されます。おめでとうございます!
```
2019-06-05 13:51:18.236 altool[5944:261201] No errors getting notarization info.
RequestUUID: <UUID>
Date: 2019-06-05 04:45:54 +0000
Status: success
LogFileURL: https://osxapps-ssl.itunes.apple.com/itunes-assets/Enigma123/v4/<Log file identifier>
Status Code: 0
Status Message: Package Approved
```
## 参考文献
- [Resolving Common Notarization Issues](https://developer.apple.com/documentation/security/notarizing_your_app_before_distribution/resolving_common_notarization_issues)
- [Notarizing your Electron application](https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/)
- [Feature request: Enable hardened runtime for macOS #3383](https://github.com/electron-userland/electron-builder/issues/3383)

View File

@@ -0,0 +1,207 @@
---
title: プログラムの速度改善が誤差かどうかを統計的に調べる
date: 2019-10-03 17:21:00 +09:00
---
**Welch の t 検定**を用いて 2 つのベンチマークの分布の平均が等しい(速度差は誤差の範疇)か、あるいは異なる(=有意な速度改善が成されている)かどうかを判定します。
ベンチマーク用の TypeScript プログラムを用意します。
```ts a.ts
function a() {
const noise = Math.random() - 0.5;
const offset = 1.0;
const t = noise * 2 + offset;
setTimeout(() => console.log(t), t * 1000);
}
a();
```
```ts b.ts
function b() {
const noise = Math.random() - 0.5;
const offset = 2.0;
const t = noise * 2 + offset;
setTimeout(() => console.log(t), t * 1000);
}
b();
```
まず[hyperfine](https://github.com/sharkdp/hyperfine)で 2 つの プログラムのベンチマークを取り、`result.json`に保存します。
```shell
hyperfine 'ts-node a.ts' 'ts-node b.ts' -r 50 --warmup 3 --export-json ab.json
```
`result.json`の中身は以下のようになります。
```json result.json
{
"results": [
{
"command": "ts-node a.ts",
"mean": 1.9369869248950002,
"stddev": 0.6074252496423262,
"median": 2.005230080295,
"user": 1.549546345,
"system": 0.08031985000000001,
"min": 0.8807363742950001,
"max": 2.830435366295,
"times": [
1.4010462692949999,
2.830435366295,
1.010024359295,
1.159667609295,
1.8311979602950001,
...
]
},
{
"command": "ts-node b.ts",
"mean": 2.833931665055,
"stddev": 0.6505564501747996,
"median": 2.7373719187950005,
"user": 1.5474132649999999,
"system": 0.07978893000000001,
"min": 1.938184970295,
"max": 3.946562622295,
"times": [
2.2806011012950003,
2.0140897212950004,
2.1835023382950003,
2.304886362295,
3.8122057912950003,
...
]
}
]
}
```
> t 検定はサンプルが正規分布に従っているという仮定を置いているので、大数の法則から本当はもっと試行回数を増やした方が良いです。
この`result.json`の`times`配列を受け取り、2 つの分布間に有意差があるかどうかを判定します。
```ts
import fs from "fs";
import { jStat } from "jstat";
const log = console.log;
const sum = (x: number[]) => x.reduce((a: number, b: number) => a + b); // 総和
const sqsum = (x: number[], mu: number) =>
x.reduce((a: number, b: number) => a + (b - mu) ** 2); // 自乗誤差の総和
function ttest(X: number[], Y: number[]) {
const Xn = X.length; // サンプル数
const Yn = Y.length;
log(`Xn = ${Xn}`);
log(`Yn = ${Yn}`);
const X_mu = sum(X) / Xn; // 平均
const Y_mu = sum(Y) / Yn;
log(`X_mu = ${X_mu}`);
log(`Y_mu = ${Y_mu}`);
const X_sigma = sqsum(X, X_mu) / (Xn - 1); // 不偏分散
const Y_sigma = sqsum(Y, Y_mu) / (Yn - 1);
log(`X_sigma = ${X_sigma}`);
log(`Y_sigma = ${Y_sigma}`);
const t = (X_mu - Y_mu) / Math.sqrt(X_sigma / Xn + Y_sigma / Yn); // t値
log(`t = ${t}`);
const df =
(X_sigma + Y_sigma) ** 2 /
(X_sigma ** 2 / (Xn - 1) + Y_sigma ** 2 / (Yn - 1)); // 自由度
log(`df = ${df}`);
return jStat.studentt.cdf(-Math.abs(t), df) * 2.0; // p値
}
const filename = process.argv.slice(2)[0];
const result = JSON.parse(fs.readFileSync(filename).toString());
const X = result.results[0].times;
const Y = result.results[1].times;
const p = ttest(X, Y);
log(`p = ${p}`);
log(`p < 0.05 = ${p < 0.05}`);
log(p < 0.05 ? "Possibly some difference there" : "No difference");
```
ここで`X_mu`は分布 X の平均、`X_sigma`は分布 X の不偏分散です。
$$
\begin{eqnarray}
\mu_X &=& \frac{1}{n_X} \sum^{n_X}_i X_i\\
\sigma_X &=& \frac{1}{n_X-1}\sum^{n_X}_i (X_i - \mu_X)^2
\end{eqnarray}
$$
これを X と Y 両方に対して求めます。さらに以下のようにして t を求めます。
$$
t = \frac{\mu_X - \mu_Y}{\sqrt{\frac{\sigma_X}{n_X} + \frac{\sigma_Y}{n_Y}}}
$$
t 分布の累積密度関数 (Cumlative Distribution Function; CDF) を定義します。面倒すぎたので[jstat](https://github.com/jstat/jstat)の`studentt.cdf`を使ってます。コードを見ると、分子の積分は[シンプソンの公式](https://ja.wikipedia.org/wiki/シンプソンの公式)を使って近似していました。
$$
\text{CDF} =\frac{\int_0^{\frac{v}{t^2+v}}\frac{r^{\frac{v}{2}-1}}{\sqrt{1-r}}dr{}}{\text{exp}(\ln(\Gamma(\frac{v}{2}))+\ln(\Gamma(0.5))+\ln(\Gamma(\frac{v}{2}+0.5)))}
$$
CDF を用いて p 値を求めます。両側検定をするので 2 を掛けます。t 分布の自由度 (degree of freedom; df) は$n-1$なので、両分布の自由度を$n_X+n_Y-2$で与えます。本当は
$$
\text{df} = \frac{(\sigma_X + \sigma_Y)^2}{
\frac{\sigma_X^2}{n_X - 1} + \frac{\sigma_Y^2}{n_Y - 1}}
$$
で求める必要がありますが、さぼって近似しました。
$$
p = \text{CDF}(-|t|, n_X+n_Y-2) \times2
$$
## 結果
異なる実行時間を示すプログラム`a`,`b`を比較すると、2 つの分布の平均が異なることが示唆されました。
```
❯ ts-node test.ts ab.json
Xn = 10
Yn = 10
X_mu = 1.8022945422950003
Y_mu = 2.9619571628950006
X_sigma = 0.6067285795623545
Y_sigma = 0.6593856215802901
t = -3.2590814831310353
df = 17.968919419652778
-0.0001571394779906754
p = 0.004364964634417297
p < 0.05 = true
Possibly some difference there
```
p 値が 0.05 未満となり、帰無仮説「2つの分布は等しい」が棄却されたので「2つの分布は等しくない」ことがわかりました。同じプログラム同士でベンチマークを取るとどうなるでしょうか。
```
❯ ts-node test.ts aa.json
Xn = 10
Yn = 10
X_mu = 1.7561671737900002
Y_mu = 1.9892996860899999
X_sigma = 0.5127362786380443
Y_sigma = 0.442053230382934
t = -0.754482245774979
df = 17.901889803947558
-27359.526584574112
p = 0.4603702896905685
p < 0.05 = false
No difference
```
p 値が 0.05 未満ではないので帰無仮説は棄却されずつまり2つの分布は等しいことがわかりました
ウェルチの t 検定はスチューデントの t 検定と違って等分散性2つの分布の分散が等しいことを仮定しないのでとても取り扱いやすい検定ですもちろん等分散性のある分布でも使用できるので基本的にはウェルチの方法を使う方針で良さそうです
## 参考文献
- [Welch's t-test - Rosetta Code](https://rosettacode.org/wiki/Welch%27s_t-test)