<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Ikuto.Y</title>
    <description>A simple, beautiful theme for Jekyll that emphasizes content rather than aesthetic fluff.</description>
    <link>https://ikuto0608.github.io//</link>
    <atom:link href="https://ikuto0608.github.io//feed.xml" rel="self" type="application/rss+xml" />
    
      <item>
        <title>1ハゼは「予測」できるか？——複雑系物理学とAIで挑む焙煎の臨界点</title>
        <description>&lt;p&gt;&lt;img src=&quot;/images/bullet-r1.jpg&quot; alt=&quot;Aillio Bullet R1 V2&quot; width=&quot;100%&quot; style=&quot;border-radius: 8px; margin-bottom: 2rem;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;ここ数年、手網焙煎にはじまり去年から家におけるコンパクトな焙煎機&lt;a href=&quot;https://aillio.com/&quot;&gt;Aillio&lt;/a&gt;（Aillio Bullet R1 V2）を購入して珈琲豆を焙煎している。本記事の検証で紹介するデータもすべて、この &lt;strong&gt;Aillio Bullet R1 V2&lt;/strong&gt; の焙煎ログを使用している。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://aillio.com/&quot;&gt;Aillio&lt;/a&gt;には専用の焙煎ログアプリの&lt;a href=&quot;https://roastime.aillio.com/&quot;&gt;RoasTime&lt;/a&gt;があるが、自由の幅の多い&lt;a href=&quot;https://artisan-scope.org/&quot;&gt;Artisan&lt;/a&gt;に乗り換えてからWebsocketでリアルタイムに焙煎ログを飛ばせることを知る。
とてもおもしろそうなので、Websocketで飛ばしたログをリアルタイムに表示する焙煎実況アプリを作ってみることにした。&lt;/p&gt;

&lt;p&gt;AI真っ盛り、焙煎ログをリアルタイムで可視化するだけでは面白くないので、AIで1ハゼの予兆を検知できないか、検証機能も実装した。&lt;/p&gt;

&lt;h2 id=&quot;カオス理論と焙煎の出会いcsd臨界減速理論&quot;&gt;カオス理論と焙煎の出会い：CSD（臨界減速）理論&lt;/h2&gt;

&lt;p&gt;コーヒーの焙煎において、豆の組織が破壊され水分が気化する「1ハゼ」は、急激な熱変化を伴う暴れ馬のような現象。1ハゼ周辺の温度管理が重要であることを理解し始めたので、そのタイミングを予測できないかと考えた。&lt;/p&gt;

&lt;p&gt;そこでGeminiに聞くと、気象学や生態系などの複雑系科学で用いられる&lt;strong&gt;臨界減速（Critical Slowing Down: CSD）理論&lt;/strong&gt;がサジェストされた、おもしろそう。&lt;/p&gt;

&lt;p&gt;CSD理論では、「システムが急激な変化（相転移）を起こす直前には、元の状態に戻ろうとする&lt;strong&gt;回復の遅れ&lt;/strong&gt;が生じる」とされている。これを焙煎プロセスにおける1ハゼへの相転移と重ね合わせる。&lt;/p&gt;

&lt;h2 id=&quot;予兆を捉える自己相関と分散&quot;&gt;予兆を捉える：自己相関と分散&lt;/h2&gt;

&lt;p&gt;この「回復の遅れ」を数値化するため、システム内部では主に以下の2つの指標をリアルタイムで監視する。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;AR(1) 自己相関:&lt;/strong&gt; 状態の回復が遅くなり、直前の状態を引きずる度合いの上昇。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;分散（Variance）のローリング計算:&lt;/strong&gt; システム全体の「揺らぎ」が大きくなる現象の検知。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;これらの指標が一定の閾値を超えた瞬間、アラートを発し焙煎の臨界点が近いことを知らせる。&lt;/p&gt;

&lt;video src=&quot;/files/roasting.mp4&quot; width=&quot;100%&quot; controls=&quot;&quot; autoplay=&quot;&quot; loop=&quot;&quot; muted=&quot;&quot; playsinline=&quot;&quot; style=&quot;border-radius: 8px; margin: 2rem 0;&quot;&gt;&lt;/video&gt;

&lt;h2 id=&quot;検証データ過去ログによるバックテスト&quot;&gt;検証データ：過去ログによるバックテスト&lt;/h2&gt;

&lt;p&gt;過去に蓄積した数十回の焙煎ログ（&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.alog&lt;/code&gt; 等）を用いたバックテストの結果、このCSDアルゴリズムは、&lt;strong&gt;実際の1ハゼ発生の30〜120秒前（リードタイム）&lt;/strong&gt;に、悪くない精度で検知できていることが見えた、データからも解析も一瞬でClaudeやってくれる、便利すぎる。&lt;/p&gt;

&lt;p&gt;豆の水分量や投入量によってリードタイムに幅はあるが、「もうすぐハゼる」という準備を整えるには十分な時間的猶予だ。&lt;/p&gt;

&lt;iframe src=&quot;/files/csd-backtest-result.html&quot; width=&quot;100%&quot; height=&quot;900&quot; frameborder=&quot;0&quot; style=&quot;border:1px solid #2a2a3a; border-radius: 8px; margin: 2rem 0; background: #0a0a0f;&quot;&gt;&lt;/iframe&gt;

&lt;h2 id=&quot;現在のステータスまだまだはじまったばかり&quot;&gt;現在のステータス：まだまだはじまったばかり&lt;/h2&gt;

&lt;p&gt;バックテストでの良さそうな結果は見えたものの、まだまだ実験段階。引き続き焙煎を続けて良さそうな塩梅を見つけていきたい。&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;strong&gt;焙煎実況アプリはこちらからご覧いただけます：&lt;/strong&gt;
☕️ &lt;a href=&quot;https://roastery.arigato.coffee/&quot;&gt;ARIGATO COFFEE ROASTERY&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Fri, 20 Mar 2026 03:00:00 +0000</pubDate>
        <link>https://ikuto0608.github.io//data-science/coffee/roasting/2026/03/20/arigato-coffee-csd-prediction-ja/</link>
        <guid isPermaLink="true">https://ikuto0608.github.io//data-science/coffee/roasting/2026/03/20/arigato-coffee-csd-prediction-ja/</guid>
      </item>
    
      <item>
        <title>Can First Crack Be Predicted? —— Challenging the Tipping Point of Roasting with Complex Systems Physics and AI</title>
        <description>&lt;p&gt;&lt;img src=&quot;/images/bullet-r1.jpg&quot; alt=&quot;Aillio Bullet R1 V2&quot; width=&quot;100%&quot; style=&quot;border-radius: 8px; margin-bottom: 2rem;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Over the past few years, having started with a hand roaster, I purchased a compact home roaster, &lt;a href=&quot;https://aillio.com/&quot;&gt;Aillio&lt;/a&gt; (Aillio Bullet R1 V2), last year and have been roasting coffee beans. All the data and logs used for the verification in this article are derived from this &lt;strong&gt;Aillio Bullet R1 V2&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;While &lt;a href=&quot;https://aillio.com/&quot;&gt;Aillio&lt;/a&gt; has its own dedicated roasting log app, &lt;a href=&quot;https://roastime.aillio.com/&quot;&gt;RoasTime&lt;/a&gt;, I switched to the more customizable &lt;a href=&quot;https://artisan-scope.org/&quot;&gt;Artisan&lt;/a&gt; and discovered that I could stream roasting logs in real-time via Websocket.
This seemed very interesting, so I decided to build a live roasting app that visualizes the logs sent via Websocket in real-time.&lt;/p&gt;

&lt;p&gt;With AI being so prevalent, simply visualizing roasting logs in real-time isn’t quite enough. So, I also implemented an experimental feature to see if AI could detect the underlying signs of the first crack.&lt;/p&gt;

&lt;h2 id=&quot;chaos-theory-meets-roasting-csd-critical-slowing-down-theory&quot;&gt;Chaos Theory Meets Roasting: CSD (Critical Slowing Down) Theory&lt;/h2&gt;

&lt;p&gt;In coffee roasting, the “first crack,” where the cellular structure of the bean breaks down and moisture vaporizes, is a phenomenon as volatile as an untamed horse, accompanied by rapid thermal changes. As I began to understand the importance of temperature management around the first crack, I wondered if its timing could be predicted.&lt;/p&gt;

&lt;p&gt;When I asked Gemini about it, it suggested the &lt;strong&gt;CSD (Critical Slowing Down) theory&lt;/strong&gt;, a concept used in complex systems science such as meteorology and ecology. It sounded fascinating.&lt;/p&gt;

&lt;p&gt;According to CSD theory, “just before a system undergoes a sudden change (phase transition), a &lt;strong&gt;delay in recovery&lt;/strong&gt;, where the system struggles to return to its original state, occurs.” I can overlay this concept onto the phase transition leading up to the first crack in the roasting process.&lt;/p&gt;

&lt;h2 id=&quot;catching-the-signs-autocorrelation-and-variance&quot;&gt;Catching the Signs: Autocorrelation and Variance&lt;/h2&gt;

&lt;p&gt;To quantify this “delay in recovery,” our system primarily monitors the following two indicators in real-time:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;AR(1) Autocorrelation:&lt;/strong&gt; The slowing down of state recovery, marked by an increase in the degree to which the immediate past state is carried over.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Rolling Variance Calculation:&lt;/strong&gt; Detecting the phenomenon where the “fluctuations” of the entire system become larger.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The moment these indicators exceed a certain threshold, an alert is triggered, signaling that the roasting tipping point is near.&lt;/p&gt;

&lt;video src=&quot;/files/roasting.mp4&quot; width=&quot;100%&quot; controls=&quot;&quot; autoplay=&quot;&quot; loop=&quot;&quot; muted=&quot;&quot; playsinline=&quot;&quot; style=&quot;border-radius: 8px; margin: 2rem 0;&quot;&gt;&lt;/video&gt;

&lt;h2 id=&quot;verification-data-backtesting-with-past-logs&quot;&gt;Verification Data: Backtesting with Past Logs&lt;/h2&gt;

&lt;p&gt;As a result of backtesting using dozens of accumulated past roasting logs (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.alog&lt;/code&gt;, etc.), I’ve seen that this CSD algorithm can detect a clear sign with decent accuracy, &lt;strong&gt;30 to 120 seconds before the actual first crack occurs (lead time)&lt;/strong&gt;. Also, Claude analyzes the data instantly, which is incredibly convenient.&lt;/p&gt;

&lt;p&gt;Although the lead time varies depending on the bean’s moisture content and batch size, it provides a sufficient time buffer to prepare yourself that “it’s going to crack soon.”&lt;/p&gt;

&lt;iframe src=&quot;/files/csd-backtest-result-en.html&quot; width=&quot;100%&quot; height=&quot;900&quot; frameborder=&quot;0&quot; style=&quot;border:1px solid #2a2a3a; border-radius: 8px; margin: 2rem 0; background: #0a0a0f;&quot;&gt;&lt;/iframe&gt;

&lt;h2 id=&quot;current-status-still-just-the-beginning&quot;&gt;Current Status: Still Just the Beginning&lt;/h2&gt;

&lt;p&gt;While the backtesting showed promising results, I am still very much in the experimental stage. I want to continue roasting to find the perfect balance.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;strong&gt;You can view the live roasting app here:&lt;/strong&gt;
☕️ &lt;a href=&quot;https://roastery.arigato.coffee/&quot;&gt;ARIGATO COFFEE ROASTERY&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Fri, 20 Mar 2026 03:00:00 +0000</pubDate>
        <link>https://ikuto0608.github.io//data-science/coffee/roasting/2026/03/20/arigato-coffee-csd-prediction-en/</link>
        <guid isPermaLink="true">https://ikuto0608.github.io//data-science/coffee/roasting/2026/03/20/arigato-coffee-csd-prediction-en/</guid>
      </item>
    
      <item>
        <title>チームでボールを投げあうに至った話</title>
        <description>&lt;p&gt;この記事は &lt;a href=&quot;https://qiita.com/advent-calendar/2021/smarthr&quot;&gt;SmartHR AdventCalendar&lt;/a&gt; の6日目です。&lt;/p&gt;

&lt;p&gt;従業員が数百人いてかつリモートワークで日々仕事していると普段関わりのない同僚はほんとうに関わらないまま時間は過ぎて少しさみしいなと思っていたところにTwitterに流れてきたtweetがこれ。&lt;/p&gt;

&lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;We built an internal game at Shopify to make virtual hangouts more fun. It’s called Shopify Party, and I’d love to tell you all about it 👇🏻 &lt;br /&gt;[1/6] &lt;a href=&quot;https://t.co/DwzxwWty3V&quot;&gt;pic.twitter.com/DwzxwWty3V&lt;/a&gt;&lt;/p&gt;&amp;mdash; Daniel Beauchamp (@pushmatrix) &lt;a href=&quot;https://twitter.com/pushmatrix/status/1442839002432802818?ref_src=twsrc%5Etfw&quot;&gt;September 28, 2021&lt;/a&gt;&lt;/blockquote&gt;
&lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;Shopify Partyとはなんぞ？Mario Partyから文字ってるものだと思っていて、Shopify社内でインターナルに公開してるゲームで同僚と一緒になっていろんなミニゲームができるものですと、ちょっとしたアイスブレイクに、スタンドアップの合間に遊びつつ、とっても楽しそうに映りました。&lt;/p&gt;

&lt;p&gt;(やってみたい！公開してくれないのかShopifyー。)&lt;/p&gt;

&lt;p&gt;これこれこれこれこういうのがあるとリモートでもコミュニケーションパスが増えてよさそう！と思ったので詳しくみていきました。&lt;/p&gt;

&lt;p&gt;使われている技術はUnityとマルチプレイヤーを容易に実装できるサービス&lt;a href=&quot;https://normcore.io/&quot;&gt;normcore.io&lt;/a&gt;を使っていて、WebGL buildでブラウザ上で遊べてしまうと。お手軽！(WebGLはPrivateプランでのみ有効でした)&lt;/p&gt;

&lt;p&gt;ということで、ここでは実際に&lt;a href=&quot;https://normcore.io/&quot;&gt;normcore.io&lt;/a&gt;を使ってものすごく簡単にマルチプレイヤー実現できちゃうんじゃんと驚いたことを記していきます。&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;まずはSign upから、free planが用意されているので気軽に試すことができました。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/normcore-plan.png&quot; alt=&quot;normcore plan&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://normcore.io/documentation/guides/creating-a-player-controller.html&quot;&gt;チュートリアル&lt;/a&gt;があったので最初にこれを写経して雰囲気を掴みました。プレイヤーの移動ロジックやカメラ移動の実装はあとでごっそり参考にしました。&lt;/p&gt;

&lt;p&gt;このチュートリアルにはなかったんですが、&lt;a href=&quot;https://normcore.io/&quot;&gt;normcore.io&lt;/a&gt;はボイスチャットにも対応していて話したい欲求が強くなってきました。会社にはカシュと呼ばれるカルチャーがあって、業後にフリースペースにおのおのそれぞれまばらに集まってフリードリンクを嗜むというものでコロナ前の頃ではよかったんですがいまや家から働くのが普通になってしまったので参加することができず…. これをバーチャルの世界で実現できたら楽しそう！をモチベーションに進めていきました。ゲームの中で自由に歩き回って人の輪を作れておのおのグループになってわいわいできたらいいなを目標にして。&lt;/p&gt;

&lt;p&gt;便利なものでUnity Asset Storeにはなんでも揃っているんですね！フィールドにはオフィスを、プレイヤーにはヒトを再現したくていろいろあさったところ&lt;/p&gt;

&lt;p&gt;いい感じのオフィスのアセット：&lt;a href=&quot;https://assetstore.unity.com/packages/3d/environments/urban/hq-archviz-loft-office-modular-186002&quot;&gt;https://assetstore.unity.com/packages/3d/environments/urban/hq-archviz-loft-office-modular-186002&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;歩くなどのアニメーションも付いているタイツマン：&lt;a href=&quot;https://assetstore.unity.com/packages/3d/characters/stickman-character-prototype-182000&quot;&gt;https://assetstore.unity.com/packages/3d/characters/stickman-character-prototype-182000&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;などなどよさそうに思ったので課金しました。&lt;/p&gt;

&lt;p&gt;アセットを落としてきてそこからせっせかせっせとそれらしき空間に整えて、チュートリアルにもあったようにEmpty objectにPlayerManagerと名付けてRealtimeコンポーネントを追加しました。ここでApp Keyを&lt;a href=&quot;https://normcore.io/&quot;&gt;normcore.io&lt;/a&gt;から生成して持ってくる必要がありました。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/player-manager.png&quot; alt=&quot;PlayerManager&quot; /&gt;&lt;/p&gt;

&lt;p&gt;プレイヤーとしたいタイツマンprefabにはRealtime View/Realtime Transform、それからボイスチャットを可能にするためRealtime Avatar Voiceコンポーネントを追加しました。追加するだけマルチプレイヤーになってしまうすごい。。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/player.png&quot; alt=&quot;Player&quot; /&gt;&lt;/p&gt;

&lt;p&gt;だいたい動くことがみれたので、実際に試したい欲が高まり休日に遊んで書いていたものだったんですがチームの雑談時間を利用してチームメンバーに入ってもらって雑談をこの中でできないかテストをお願いしました。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/preview1.png&quot; alt=&quot;Preview1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;一度目、、惨敗。。。会話ができない。。ヒトの声が聞こえる距離を見誤りめっちゃ至近距離でないと声が聞こえませんでした。あと、タイツマン誰が誰だかわかんない問題。みんなにZoomに入りもらい直して反省会をさせてもらったりしました。感謝&lt;/p&gt;

&lt;p&gt;Realtime Avatar Voiceは内部でUnityのAudioSourceを参照してるので明示的に宣言することで自由に設定が変えられ、声が聞こえる範囲を自分のフィールドに合わせて調節しました。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/audio-source.png&quot; alt=&quot;AudioSource&quot; /&gt;&lt;/p&gt;

&lt;p&gt;それに加え、名前を表示したり申し訳程度に遊べる機能を追加してまたテストをお願い。&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;二度目、、聞こえる！喋れる！！&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/preview2.png&quot; alt=&quot;Preview2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;牛になれるオプションを用意したり、&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/preview3.png&quot; alt=&quot;Preview3&quot; /&gt;&lt;/p&gt;

&lt;p&gt;ボールを投げる機能をいれたところ話すより投げるほうで盛り上がり結果雑談をまったくせずひたすらボールを投げては当てて終わりました。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/cow.gif&quot; alt=&quot;cow&quot; /&gt;&lt;/p&gt;

&lt;p&gt;(実際に投げ合う画を撮り忘れたのでそれらしいものを添付)&lt;/p&gt;

&lt;p&gt;プレイヤーの位置情報はRealtimeコンポーネントを追加することで勝手にしてくれますが、アニメーションの状態の同期やニックネームの同期は数ステップで必要で、&lt;a href=&quot;https://normcore.io/documentation/room/realtimemodel.html#realtimemodel-realtimeproperty-attributes&quot;&gt;RealtimeModel&lt;/a&gt;スクリプトを差し込んでこれを実現できました。&lt;/p&gt;

&lt;p&gt;ここまでで、簡単にマルチプレイヤーでボイスチャットができるアプリを作れることが見れました。Zoomなどと違って同じ空間に複数グループを無作為に作って会話ができるのがいいのかなと。話すだけでなくShopifyのようにいろんなミニゲームを仕込んでいくのもよし(大変そう)、metaverseの波に乗ってVRにするのもよし(もはやそれはVRchatかな)、なにがしの形になるように引き続き進めていきます！&lt;/p&gt;
</description>
        <pubDate>Mon, 06 Dec 2021 00:00:00 +0000</pubDate>
        <link>https://ikuto0608.github.io//unity/shopify/2021/12/06/virtual-chat/</link>
        <guid isPermaLink="true">https://ikuto0608.github.io//unity/shopify/2021/12/06/virtual-chat/</guid>
      </item>
    
      <item>
        <title>さっそくAWS LambdaをRubyで触ってみる</title>
        <description>&lt;p&gt;こちらは&lt;a href=&quot;https://adventar.org/calendars/2875&quot;&gt;&lt;strong&gt;Frog Advent Calendar 2018&lt;/strong&gt;&lt;/a&gt;の14日目の記事となります。&lt;/p&gt;

&lt;p&gt;先月にAWS LambdaがRubyでかけるようになると&lt;a href=&quot;https://aws.amazon.com/blogs/compute/announcing-ruby-support-for-aws-lambda/&quot;&gt;&lt;strong&gt;Amazonからアナウンス&lt;/strong&gt;&lt;/a&gt;があり、界隈で話題になっていたので早速手を動かしてみようということで。仕事でもすこーしだけLambdaで実装している部分があって、それはJavascriptで書いています。メインはAWS EC2で複数インスタンスを立ててその中でMicroservicesの形を取って複数のDockerインスタンスが各々Railsアプリを動かしています。で各サービス間はRESTでやりとりしたり、AWS SQS/SNSでサブスクリプションし合う形を取っています。その脇役として小さな処理をLambdaに任せている、ざっくり仕事のバックエンド環境はこのようになります。とりあえずバックエンドのみの説明だけ、backend developerとして働いているので。
&lt;br /&gt;
&lt;br /&gt;
さて、Lambdaとは何か、&lt;a href=&quot;https://aws.amazon.com/lambda/&quot;&gt;&lt;strong&gt;Amazonの公式サイト&lt;/strong&gt;&lt;/a&gt;では、&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;Run code without thinking about servers. Pay only for the compute time you consume.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;とありますが、少し前にサーバーレスという言葉が流行ってた気がするのだけれど(最近そんな聞かない)、Lambdaはサーバーレスで、小さなアクション単位に作ることができる。RailsとかMVCなアーキテクチャーのフレームワークで例えると、コントローラーの中の１アクションをひとつのLambdaで表現できるイメージで僕はいます。&lt;/p&gt;

&lt;p&gt;便利なものでLambdaの発動条件(トリガー)も様々から選べて、RESTで受けるAWS Gatewayから始まり、AWS S3に噛ませればファイルの更新をトリガーに走らせることでもできて、CloudWatach Eventでcronタスクでスケジューラーとしても走らせることができ、考えられることはなんでもできるといったところでしょうか。&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;それでは実際に触っていくのですが、すごーい簡単なもので何かないか、どうせ作るのなら何か欲しいものをと、考えていたら最近おしゃれなTattooを描くアーティストを見つけたことを思い出し、バンクーバーbasedの人なんですがInstagramのアカウントをちょくちょく見ていて、&lt;/p&gt;

&lt;blockquote class=&quot;instagram-media&quot; data-instgrm-permalink=&quot;https://www.instagram.com/p/Bjsb1NLlz0I/?utm_source=ig_embed&amp;amp;utm_medium=loading&quot; data-instgrm-version=&quot;12&quot; style=&quot; background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:658px; min-width:326px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);&quot;&gt;&lt;div style=&quot;padding:16px;&quot;&gt; &lt;a href=&quot;https://www.instagram.com/p/Bjsb1NLlz0I/?utm_source=ig_embed&amp;amp;utm_medium=loading&quot; style=&quot; background:#FFFFFF; line-height:0; padding:0 0; text-align:center; text-decoration:none; width:100%;&quot; target=&quot;_blank&quot;&gt; &lt;div style=&quot; display: flex; flex-direction: row; align-items: center;&quot;&gt; &lt;div style=&quot;background-color: #F4F4F4; border-radius: 50%; flex-grow: 0; height: 40px; margin-right: 14px; width: 40px;&quot;&gt;&lt;/div&gt; &lt;div style=&quot;display: flex; flex-direction: column; flex-grow: 1; justify-content: center;&quot;&gt; &lt;div style=&quot; background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; margin-bottom: 6px; width: 100px;&quot;&gt;&lt;/div&gt; &lt;div style=&quot; background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; width: 60px;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;padding: 19% 0;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;display:block; height:50px; margin:0 auto 12px; width:50px;&quot;&gt;&lt;svg width=&quot;50px&quot; height=&quot;50px&quot; viewBox=&quot;0 0 60 60&quot; version=&quot;1.1&quot; xmlns=&quot;https://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;https://www.w3.org/1999/xlink&quot;&gt;&lt;g stroke=&quot;none&quot; stroke-width=&quot;1&quot; fill=&quot;none&quot; fill-rule=&quot;evenodd&quot;&gt;&lt;g transform=&quot;translate(-511.000000, -20.000000)&quot; fill=&quot;#000000&quot;&gt;&lt;g&gt;&lt;path d=&quot;M556.869,30.41 C554.814,30.41 553.148,32.076 553.148,34.131 C553.148,36.186 554.814,37.852 556.869,37.852 C558.924,37.852 560.59,36.186 560.59,34.131 C560.59,32.076 558.924,30.41 556.869,30.41 M541,60.657 C535.114,60.657 530.342,55.887 530.342,50 C530.342,44.114 535.114,39.342 541,39.342 C546.887,39.342 551.658,44.114 551.658,50 C551.658,55.887 546.887,60.657 541,60.657 M541,33.886 C532.1,33.886 524.886,41.1 524.886,50 C524.886,58.899 532.1,66.113 541,66.113 C549.9,66.113 557.115,58.899 557.115,50 C557.115,41.1 549.9,33.886 541,33.886 M565.378,62.101 C565.244,65.022 564.756,66.606 564.346,67.663 C563.803,69.06 563.154,70.057 562.106,71.106 C561.058,72.155 560.06,72.803 558.662,73.347 C557.607,73.757 556.021,74.244 553.102,74.378 C549.944,74.521 548.997,74.552 541,74.552 C533.003,74.552 532.056,74.521 528.898,74.378 C525.979,74.244 524.393,73.757 523.338,73.347 C521.94,72.803 520.942,72.155 519.894,71.106 C518.846,70.057 518.197,69.06 517.654,67.663 C517.244,66.606 516.755,65.022 516.623,62.101 C516.479,58.943 516.448,57.996 516.448,50 C516.448,42.003 516.479,41.056 516.623,37.899 C516.755,34.978 517.244,33.391 517.654,32.338 C518.197,30.938 518.846,29.942 519.894,28.894 C520.942,27.846 521.94,27.196 523.338,26.654 C524.393,26.244 525.979,25.756 528.898,25.623 C532.057,25.479 533.004,25.448 541,25.448 C548.997,25.448 549.943,25.479 553.102,25.623 C556.021,25.756 557.607,26.244 558.662,26.654 C560.06,27.196 561.058,27.846 562.106,28.894 C563.154,29.942 563.803,30.938 564.346,32.338 C564.756,33.391 565.244,34.978 565.378,37.899 C565.522,41.056 565.552,42.003 565.552,50 C565.552,57.996 565.522,58.943 565.378,62.101 M570.82,37.631 C570.674,34.438 570.167,32.258 569.425,30.349 C568.659,28.377 567.633,26.702 565.965,25.035 C564.297,23.368 562.623,22.342 560.652,21.575 C558.743,20.834 556.562,20.326 553.369,20.18 C550.169,20.033 549.148,20 541,20 C532.853,20 531.831,20.033 528.631,20.18 C525.438,20.326 523.257,20.834 521.349,21.575 C519.376,22.342 517.703,23.368 516.035,25.035 C514.368,26.702 513.342,28.377 512.574,30.349 C511.834,32.258 511.326,34.438 511.181,37.631 C511.035,40.831 511,41.851 511,50 C511,58.147 511.035,59.17 511.181,62.369 C511.326,65.562 511.834,67.743 512.574,69.651 C513.342,71.625 514.368,73.296 516.035,74.965 C517.703,76.634 519.376,77.658 521.349,78.425 C523.257,79.167 525.438,79.673 528.631,79.82 C531.831,79.965 532.853,80.001 541,80.001 C549.148,80.001 550.169,79.965 553.369,79.82 C556.562,79.673 558.743,79.167 560.652,78.425 C562.623,77.658 564.297,76.634 565.965,74.965 C567.633,73.296 568.659,71.625 569.425,69.651 C570.167,67.743 570.674,65.562 570.82,62.369 C570.966,59.17 571,58.147 571,50 C571,41.851 570.966,40.831 570.82,37.631&quot;&gt;&lt;/path&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/div&gt;&lt;div style=&quot;padding-top: 8px;&quot;&gt; &lt;div style=&quot; color:#3897f0; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:550; line-height:18px;&quot;&gt; View this post on Instagram&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;padding: 12.5% 0;&quot;&gt;&lt;/div&gt; &lt;div style=&quot;display: flex; flex-direction: row; margin-bottom: 14px; align-items: center;&quot;&gt;&lt;div&gt; &lt;div style=&quot;background-color: #F4F4F4; border-radius: 50%; height: 12.5px; width: 12.5px; transform: translateX(0px) translateY(7px);&quot;&gt;&lt;/div&gt; &lt;div style=&quot;background-color: #F4F4F4; height: 12.5px; transform: rotate(-45deg) translateX(3px) translateY(1px); width: 12.5px; flex-grow: 0; margin-right: 14px; margin-left: 2px;&quot;&gt;&lt;/div&gt; &lt;div style=&quot;background-color: #F4F4F4; border-radius: 50%; height: 12.5px; width: 12.5px; transform: translateX(9px) translateY(-18px);&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-left: 8px;&quot;&gt; &lt;div style=&quot; background-color: #F4F4F4; border-radius: 50%; flex-grow: 0; height: 20px; width: 20px;&quot;&gt;&lt;/div&gt; &lt;div style=&quot; width: 0; height: 0; border-top: 2px solid transparent; border-left: 6px solid #f4f4f4; border-bottom: 2px solid transparent; transform: translateX(16px) translateY(-4px) rotate(30deg)&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-left: auto;&quot;&gt; &lt;div style=&quot; width: 0px; border-top: 8px solid #F4F4F4; border-right: 8px solid transparent; transform: translateY(16px);&quot;&gt;&lt;/div&gt; &lt;div style=&quot; background-color: #F4F4F4; flex-grow: 0; height: 12px; width: 16px; transform: translateY(-4px);&quot;&gt;&lt;/div&gt; &lt;div style=&quot; width: 0; height: 0; border-top: 8px solid #F4F4F4; border-left: 8px solid transparent; transform: translateY(-4px) translateX(8px);&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; &lt;div style=&quot;display: flex; flex-direction: column; flex-grow: 1; justify-content: center; margin-bottom: 24px;&quot;&gt; &lt;div style=&quot; background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; margin-bottom: 6px; width: 224px;&quot;&gt;&lt;/div&gt; &lt;div style=&quot; background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; width: 144px;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/a&gt;&lt;p style=&quot; color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;&quot;&gt;&lt;a href=&quot;https://www.instagram.com/p/Bjsb1NLlz0I/?utm_source=ig_embed&amp;amp;utm_medium=loading&quot; style=&quot; color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none;&quot; target=&quot;_blank&quot;&gt;A post shared by Yi Stropky (@chinatown_stropky)&lt;/a&gt; on &lt;time style=&quot; font-family:Arial,sans-serif; font-size:14px; line-height:17px;&quot; datetime=&quot;2018-06-06T19:04:49+00:00&quot;&gt;Jun 6, 2018 at 12:04pm PDT&lt;/time&gt;&lt;/p&gt;&lt;/div&gt;&lt;/blockquote&gt;
&lt;script async=&quot;&quot; src=&quot;//www.instagram.com/embed.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;こんなおしゃれならちょっとTattoo気になるぞということで、プロフィールの所に&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Books reopen soon&lt;/code&gt;とあったので、この予約不可から可に変わる時をいち早く知りたいなと、プロフィール欄を逐一確認するのは嫌だよねということでこの&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Books reopen soon&lt;/code&gt;が変わったことをお知らせしてくれる機能をLambdaでちょこっと作っていきます。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;インスタグラムのプロフィールページにアクセスして&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Books reopen soon&lt;/code&gt;の有無を確認(予約可になった時にこの文言が消えることを信じてw)&lt;/li&gt;
  &lt;li&gt;もしも予約可になっていたらSlack上でBotから自分宛にメッセージを送る&lt;/li&gt;
  &lt;li&gt;これを定期的に繰り返す&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;というのをコードにすると、こうなりました。飾り気も何もない！&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  &lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;net/http&apos;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;json&apos;&lt;/span&gt;

  &lt;span class=&quot;no&quot;&gt;INSTA_URL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;https://www.instagram.com/chinatown_stropky/&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;freeze&lt;/span&gt;
  &lt;span class=&quot;no&quot;&gt;SLACK_URL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;https://slack.com/api/chat.postMessage&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;freeze&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;is_ready_to_book&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;insta_uri&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;URI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;INSTA_URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;insta_uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;query&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;URI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;encode_www_form&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;hl: &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;en&apos;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;https&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Net&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;HTTP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;insta_uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;insta_uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;https&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;use_ssl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Net&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;HTTP&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;insta_uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;request_uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;https&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;include?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;Books reopen soon&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;slack_uri&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;URI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;SLACK_URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;https&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Net&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;HTTP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;slack_uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;slack_uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;https&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;use_ssl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;header&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;s1&quot;&gt;&apos;Content-Type&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;application/json; charset=iso-8859-1&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;s1&quot;&gt;&apos;Authorization&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Bearer &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ENV&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;SLACK_TOKEN&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Net&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;HTTP&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;slack_uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;channel: &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ENV&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;SLACK_CHANNEL&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;as_user: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;The status has changed! Go to &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;INSTA_URL&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to_json&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;https&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;これをデプロイしていくわけですが、&lt;a href=&quot;https://aws.amazon.com/cli/&quot;&gt;&lt;strong&gt;AWS CLI&lt;/strong&gt;&lt;/a&gt;と&lt;a href=&quot;https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html&quot;&gt;&lt;strong&gt;AWS SAM&lt;/strong&gt;&lt;/a&gt;を使っていきます。SAMは初めてだったんですが、いいですね、バージョンコントロールができて。仕事ではいまだにLambdaのちゃんとしたデプロイフローが確立できていないのがまずいところで、Lambda以外ではしっかりとあって、&lt;a href=&quot;https://www.terraform.io/&quot;&gt;&lt;strong&gt;Terraform&lt;/strong&gt;&lt;/a&gt;でベースを定義して、独自に作ったコマンドで日々のデプロイをしています。これらのツールはPythonが入ってれば普通にターミナルからコマンド叩いて導入できますね(以前に複数versionのPython入れようとしてなんやかんやしていたせいでSAMが動くようなるまで時間がかかりましたが)。AWS CLIは使う前にconfig設定してあげると使えるようなりますね。&lt;/p&gt;

&lt;p&gt;流すコマンドは以下二つ、&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  sam package --template-file template.yml --s3-bucket bucket_name --output-template-file packaged.yaml
  sam deploy --template-file ./packaged.yaml --stack-name stack_name --capabilities CAPABILITY_IAM --region us-east-1

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;ひとつ目がS3 bucketにコードをアップロードして、ふたつ目でLambdaにデプロイするコマンドですね。S3 bucketは事前に作っておく。
デプロイが完了したらAWS consoleで確認できるようなりました！&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/lambda.png&quot; alt=&quot;lambda console&quot; /&gt;&lt;/p&gt;

&lt;p&gt;これで走らせるコードは用意できたので、次にトリガーを設定します。ここではCloudWatch Eventを使って10分ごとにコードが走るように設定していきます。&lt;/p&gt;

&lt;p&gt;CloudWatchでcronタスクを設定するとこのように確認できました。&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  cron(0/10 * ? * * *)

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/clock_ticked.png&quot; alt=&quot;cloud watch event&quot; /&gt;&lt;/p&gt;

&lt;p&gt;これを作ったLambdaに設定してあげると完成ですね。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://gyazo.com/8764c918406cfad8ad7e75eb4358abc9&quot;&gt;&lt;img src=&quot;https://i.gyazo.com/8764c918406cfad8ad7e75eb4358abc9.gif&quot; alt=&quot;Image from Gyazo&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
あとは寝て待つのみ、、
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
朝がきて、夜がきて、、
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
また朝がきて、時は経ち、、
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;img src=&quot;https://ikuto0608.github.io/images/slack_notification.png&quot; alt=&quot;slack notification&quot; /&gt;&lt;/p&gt;

&lt;p&gt;キターー！！！のは来たんですが、実はご丁寧にもInstagramのstoryで告知してたのを先に見てしまっていたのでいつ変わるかを事前に知っていたという。。。&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;早足で駆け抜けましたが以上が初めてのLambda with Rubyでした。気がつけばバンクーバーに移り住んで３年になるようで、一瞬で時間が過ぎていきました。来年は節目、30歳になる年なのでしっかりNew Year’s resolutionを考えなければなと。。。いやでも本当真剣に。&lt;/p&gt;

&lt;p&gt;良いお年を！&lt;/p&gt;

&lt;p&gt;codeは&lt;a href=&quot;https://github.com/ikuto0608/insta_notification&quot;&gt;&lt;strong&gt;ここから&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Fri, 14 Dec 2018 00:00:00 +0000</pubDate>
        <link>https://ikuto0608.github.io//ruby/aws/lambda/2018/12/14/aws-lambda-ruby/</link>
        <guid isPermaLink="true">https://ikuto0608.github.io//ruby/aws/lambda/2018/12/14/aws-lambda-ruby/</guid>
      </item>
    
      <item>
        <title>It describes Blockchain with minimum line.</title>
        <description>&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/coin_news.png&quot; alt=&quot;coin news&quot; /&gt;&lt;/p&gt;

&lt;p&gt;What is Blockchain? Bitcoin? I couldn’t understand it lately but there was a cool repository which is &lt;a href=&quot;https://github.com/lhartikk/naivechain&quot;&gt;naivechain(https://github.com/lhartikk/naivechain)&lt;/a&gt;, so now I’d love to code and understand it! This repo represents what basic knowledge of Blockchain is with a small amount of codes in Javascript. It’s not fun to just copy the code so I’m going to code this in Ruby here. It seems a lot of people are doing the same thing, so I’m not going to be shy and just do it for me!&lt;/p&gt;

&lt;h5 id=&quot;elements&quot;&gt;ELEMENTS&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;Node       –&amp;gt; Cutting board; everything happens on here&lt;/li&gt;
  &lt;li&gt;Mining     –&amp;gt; Knife; Cut, cut, cut, cut, and cut&lt;/li&gt;
  &lt;li&gt;P2P        –&amp;gt; Cooking chopsticks; This lets you move ingredients to a cutting board from other cutting boards&lt;/li&gt;
  &lt;li&gt;Block      –&amp;gt; Ingredient; sausage&lt;/li&gt;
  &lt;li&gt;Blockchain –&amp;gt; Sausages; Sausages connect&lt;/li&gt;
  &lt;li&gt;Hash       –&amp;gt; Spice; Secret spice&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As you can see, it’s not complex; there’s only a few elements here.&lt;/p&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;1-preparation&quot;&gt;1, PREPARATION&lt;/h4&gt;

&lt;p&gt;Let’s put the cutting board first. Let’s assume there are multiple cutting boards so that we need to communicate &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;port&lt;/code&gt; between them to be able to share the sausages smoothly. It is used by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt; also known as cooking chopsticks to build it. I couldn’t understand the relation between &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPServer&lt;/code&gt; at first, but &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPServer&lt;/code&gt; waits for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt;. It waits, waits and waits for coming &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt; and if &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt; comes at last, then &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPServer&lt;/code&gt; waits for another &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt;. This is grabbing sausages.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  class Node
    def initialize(port, other_node_ports = [])
      @clients = []
      other_node_ports.each do |other_node_port|
        client = TCPSocket.open(&apos;localhost&apos;, other_node_port)
        Thread.start do
          listen_message(client)
        end

        @clients &amp;lt;&amp;lt; client
      end

      @server = TCPServer.open(&apos;localhost&apos;, port)
      init_connection
    end
  end

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;initialize&lt;/code&gt; is gonna be like this. It tries to connect to the existing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt; and prepare to wait for other &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt;.&lt;/p&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;2-handling-a-knife&quot;&gt;2, HANDLING A KNIFE&lt;/h4&gt;

&lt;p&gt;Everything is on the stage - the cutting board - so then let’s cut the ingredients! This logic shows you one of the important keywords of Blockchain which is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mining&lt;/code&gt;. We do &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mining&lt;/code&gt; to make the secret spice, and the secret spice is used to make sausage. The more time you take to make the secret spice, the more tasty your sausages will be. That’s a fact, isn’t it? In my understanding, taking much time guarantees the correctness of Blockchain. But I cannot take much time here so I’m gonna use chemical seasoning. It’s called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ajinomoto&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  def mine_with_loop
    Thread.start do
      loop { mine; sleep(Random.rand(10)) }
    end
  end

  def mine
    @blockchain &amp;lt;&amp;lt; generate_next_block(@blockchain.last)
    broadcast
  end

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This code does &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mining&lt;/code&gt; endlessly. Simplified, it cuts every 0 to 10 seconds. One cut makes one sausage.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  def generate_next_block(block_data)
    previous_block = @blockchain.last
    next_index = previous_block[&quot;index&quot;] + 1
    next_timestamp = Time.now.to_i
    next_data = &quot;Smart contract&quot; + next_index.to_s
    next_hash = calculate_hash(
      next_index,
      previous_block[&quot;hash&quot;],
      next_timestamp,
      next_data
    )

    {
      &quot;index&quot; =&amp;gt; next_index,
      &quot;previous_hash&quot; =&amp;gt; previous_block[&quot;hash&quot;],
      &quot;timestamp&quot; =&amp;gt; next_timestamp,
      &quot;data&quot; =&amp;gt; next_data,
      &quot;hash&quot; =&amp;gt; next_hash
    }
  end

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;block&lt;/code&gt; includes&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index&lt;/code&gt; –&amp;gt; which index of block&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;previous_hash&lt;/code&gt; –&amp;gt; previous hash key&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;timestamp&lt;/code&gt; –&amp;gt; created at&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;data&lt;/code&gt; –&amp;gt; data&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hash&lt;/code&gt; –&amp;gt; proof key&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;3-finish&quot;&gt;3, FINISH&lt;/h4&gt;

&lt;p&gt;Finally, you’re going to toss your sausages to people to show them how good your sausages are! You use cooking chopsticks for this part. People who receive your sausages evaluate how your sausages’ tastiness. If they’re delicious and the length of sausages is longer than the person’s own, then the person is going to keep yours but if it’s not, he is gonna throw it away. And then the person will start to cut again.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  def verify(blockchain)
    replace_chain(blockchain) if is_valid_chain(blockchain)
  end

  def is_valid_chain(blockchain)
    if blockchain[0] != get_genesis_block
      return false
    end
    temp_blocks = [blockchain[0]]
    blockchain[1..-1].each_with_index do |block, index|
      if is_valid_new_block(block, temp_blocks[index])
        temp_blocks &amp;lt;&amp;lt; block
      else
        return false
      end
    end

    true
  end

  def is_valid_new_block(new_block, previous_block)
    if previous_block[&quot;index&quot;] + 1 != new_block[&quot;index&quot;]
      return false
    elsif previous_block[&quot;hash&quot;] != new_block[&quot;previous_hash&quot;]
      return false
    elsif calculate_hash_for_block(new_block) != new_block[&quot;hash&quot;]
      return false
    end

    true
  end

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;4-how-to-make-the-secret-spice&quot;&gt;4, HOW TO MAKE THE SECRET SPICE&lt;/h4&gt;

&lt;p&gt;This comes from a secret formula so that it inherits old sausages and adds a new generation. Here we use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;base64digest&lt;/code&gt; to calculate the string. It’s supposed to be an unchanging calculation in order to confirm correctness every time. How to generate hash for real is more difficult than this. I’ll study it another time - here we use simple way:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  def calculate_hash_for_block(block)
    calculate_hash(block[&quot;index&quot;], block[&quot;previous_hash&quot;], block[&quot;timestamp&quot;], block[&quot;data&quot;])
  end

  def calculate_hash(index, previous_hash, timestamp, data)
    Digest::SHA256.base64digest(index.to_s + previous_hash.to_s + timestamp.to_s + data.to_s).to_s
  end

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;
&lt;h4 id=&quot;end&quot;&gt;END&lt;/h4&gt;

&lt;p&gt;As we repeat these process Blockchain is getting bigger and bigger. As a starting point here, I’m going to understand:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;the algorithm of generating hash&lt;/li&gt;
  &lt;li&gt;how data exists and how the data exists differently between altcoins (I believe this is why there are many types of altcoins)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;etc….. I still have a ton of questions for Blockchain, so I’d love to figure them out one by one.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/ikuto0608/naivechain&quot;&gt;Here is the source code https://github.com/ikuto0608/naivechain&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Tue, 19 Dec 2017 19:19:00 +0000</pubDate>
        <link>https://ikuto0608.github.io//blockchain/programming/2017/12/19/naivechain-en/</link>
        <guid isPermaLink="true">https://ikuto0608.github.io//blockchain/programming/2017/12/19/naivechain-en/</guid>
      </item>
    
      <item>
        <title>Dappプログラマへの最初の一歩</title>
        <description>&lt;p&gt;こちらは&lt;a href=&quot;https://adventar.org/calendars/2350&quot;&gt;Frog Advent Calendar 2017 (https://adventar.org/calendars/2350)&lt;/a&gt;の19日目に載っています。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/bitcoin.jpg&quot; alt=&quot;bitcoin&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;はじめに&quot;&gt;はじめに&lt;/h4&gt;

&lt;p&gt;ここ一年のCryptocurrencyの盛り上がり具合は目を見張るものがあります。惜しくもこの波に乗ることはできずミリオネアになることは叶わなかったのですが、Teck業界に従事するものとして知識としてこれらの技術を学ぶのは大切なのではないかなと、まだ遅くはないことを祈ってぐぐっていきたいと思います。&lt;/p&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;dappって&quot;&gt;Dappって?&lt;/h4&gt;

&lt;p&gt;Dappとは &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;decentralized app&lt;/code&gt; の略でBlockchainをベースとする、かつ従来の、データベースをひとつのところで管理しないアプリケーションを指すところが広義の意味だと思うのですが実際にはEthereumをプラットフォームとする派生のアプリケーションをDappと言っているように思います。代表的なところでは&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://storj.io/&quot;&gt;Storj&lt;/a&gt; –&amp;gt; Cloud storage&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://gnosis.pm/&quot;&gt;Gnosis&lt;/a&gt; –&amp;gt; Prediction market platform&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://decentraland.org/&quot;&gt;Decentraland&lt;/a&gt; –&amp;gt; A virtual world owned by creators, powered by economic opportunity&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://golem.network/&quot;&gt;Golem&lt;/a&gt; –&amp;gt; Distributed computation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;などが挙げられます。上記のアプリケーションは&lt;a href=&quot;https://www.stateofthedapps.com/&quot;&gt;https://www.stateofthedapps.com/&lt;/a&gt;の一覧で見られ、かつ&lt;a href=&quot;https://coinmarketcap.com/&quot;&gt;https://coinmarketcap.com/&lt;/a&gt;で上位に位置するものをピックアップしました。あとはつい最近話題に上がった&lt;a href=&quot;https://www.cryptokitties.co/&quot;&gt;cryptokitties&lt;/a&gt;、こちらもEthereumを使ったDappですね、あまりにもTransactionに負荷をかけたことから話題を呼んでいましたね&lt;a href=&quot;https://cryptovest.com/news/ethereum-loses-to-cryptokitties-network-remains-slow/&quot;&gt;https://cryptovest.com/news/ethereum-loses-to-cryptokitties-network-remains-slow/&lt;/a&gt;。こちらは嬉しいことにバンクーバーを拠点とする企業が作ったもので親近感がいっそう湧きました&lt;a href=&quot;https://www.axiomzen.co/&quot;&gt;axiomzen&lt;/a&gt;。(就活中にこの企業に応募しましたが返事は返って来ず。残念)&lt;/p&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;なんでethereumなのか&quot;&gt;なんでEthereumなのか&lt;/h4&gt;

&lt;p&gt;decentralizedなアプリケーションを一から作るのは敷居が高いのですが、この敷居を下げてくれたのがEthereum。イメージとしてはすでにもう存在するEthereumネットワークを間借りする形でそれぞれDappを開発できる。それぞれの &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Contract&lt;/code&gt; が &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ethereum&lt;/code&gt; の &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Transaction&lt;/code&gt; に積まれていく、ただし個々の &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Contract&lt;/code&gt; はそれぞれアプリで固有なので呼ばれた先で振る舞いがそれぞれ違う。そんな形でいろんなDappがEthereumネットワークを共有している、というのがふわっとした私の理解です。&lt;/p&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;どうやってdapp作るの&quot;&gt;どうやってDapp作るの？&lt;/h4&gt;

&lt;p&gt;このチュートリアルブログ&lt;a href=&quot;https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-1-40d2d0d807c2&quot;&gt;(https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-1-40d2d0d807c2)&lt;/a&gt;を参考に投票アプリをプログラミングしていきます。開発する上でキーとなるライブラリ/アプリケーションはこちら&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/ethereum/go-ethereum/wiki/geth&quot;&gt;geth&lt;/a&gt; –&amp;gt; ローカルにEthereumのNodeを立ち上げるsoftware&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://truffleframework.com/&quot;&gt;truffle&lt;/a&gt; –&amp;gt; 自分で作ったcontractをコンパイル/デプロイするフレームワーク&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/ethereum/web3.js/&quot;&gt;web3js&lt;/a&gt; –&amp;gt; クライアントでEthereumと交信するためのライブラリ&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;これらを使いこなすことがDappプログラマの条件なんじゃないかなと。
とはいえ、実際のところ私はまだこの&lt;a href=&quot;https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-2-30b3d335aa1f&quot;&gt;チュートリアル Part2&lt;/a&gt;で止まっているのですが、、なぜか？&lt;/p&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;環境構築って大事&quot;&gt;環境構築って大事&lt;/h4&gt;

&lt;p&gt;どこで今つまづいているか、Dappを作る上で欠かせないのはEthereumですね。Ethereumには二つのパプリックネットワークが存在していて &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Mainnet&lt;/code&gt; (通称 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Homestead&lt;/code&gt; )と &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Testnet&lt;/code&gt; (通称 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ropsten&lt;/code&gt;)があります。本番用のネットワークとテスト用のネットワークですね。なので開発途中は &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ropsten&lt;/code&gt; に接続して実際に動作をチェックできるようになっているのですね、便利!で私は今 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ropsten&lt;/code&gt; に接続するところで詰まっていまして、、初めてネットワークに接続する場合には、存在するBlockchainをまず全てローカルに落とさなきゃいけないのですがそれが終わらない、数GBあるものなので時間がかかることは明記されているんですが、P2Pが全然繋がらず、繋がってもFailedする始末、困ったなと。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/peer_failed.png&quot; alt=&quot;peer failed&quot; /&gt;&lt;/p&gt;

&lt;p&gt;およ、といいつつももう少し待っていたら&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  truffle(development)&amp;gt; web3.eth.syncing
  { currentBlock: 151872,
    highestBlock: 2287008,
    knownStates: 1,
    pulledStates: 0,
    startingBlock: 77312 }

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;となり最新の&lt;a href=&quot;https://ropsten.etherscan.io/block/2287104&quot;&gt;ブロック情報 (https://ropsten.etherscan.io/block/2287104)&lt;/a&gt;と比べると値が近いのでこれはやっとスタート地点のたったのではないかなと。
いやまだでした&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  truffle(development)&amp;gt; web3.eth.getBlock(&quot;latest&quot;).number
  0

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;あれれ、最新の値が取れない、syncが正常にできていないのか。それが証拠に&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  truffle(development)&amp;gt; web3.eth.getBalance(&apos;0x2bd86de9be88fedffccd5fe6f6777dfe51bc00d2&apos;)
  { [String: &apos;0&apos;] s: 1, e: 0, c: [ 0 ] }

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;自分のアドレスに正しい &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ether&lt;/code&gt; の値が表示されない。本来なら所持している &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;5 Ether&lt;/code&gt;  &lt;a href=&quot;https://ropsten.etherscan.io/address/0x2bd86de9be88fedffccd5fe6f6777dfe51bc00d2&quot;&gt;(https://ropsten.etherscan.io/address/0x2bd86de9be88fedffccd5fe6f6777dfe51bc00d2)&lt;/a&gt;表示されるはずなんですが。ちなみにこれは自分で &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mine&lt;/code&gt; したわけではなく、&lt;a href=&quot;https://www.reddit.com/r/ethdev/comments/72ltwj/the_new_if_you_need_some_ropsten_testnet_ethers/&quot;&gt;reddit&lt;/a&gt;で自分のアドレスを投稿すると誰かが送ってくれます。 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;5 Ether&lt;/code&gt; は今の相場ではUS$1,400-くらいですね、テスト用なんで無価値ですが。&lt;/p&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;終わりに&quot;&gt;終わりに&lt;/h4&gt;

&lt;p&gt;全然終わっていないのですが、諸事情により本日はここまでとさせていただきます。次回にはチュートリアル完結版をあげれるように励みます。&lt;/p&gt;

&lt;p&gt;救いの一手をお持ちの方はご一報いただけると。
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;「聞くはいっときの恥、知らぬは一生の恥」&lt;/code&gt; 祖母が口すっぱく言う言葉より&lt;/p&gt;
</description>
        <pubDate>Mon, 18 Dec 2017 01:06:00 +0000</pubDate>
        <link>https://ikuto0608.github.io//blockchain/ethereum/dapp/2017/12/18/hello-dapp-and-ethereum-world/</link>
        <guid isPermaLink="true">https://ikuto0608.github.io//blockchain/ethereum/dapp/2017/12/18/hello-dapp-and-ethereum-world/</guid>
      </item>
    
      <item>
        <title>最小コードでBlockchainを表現する</title>
        <description>&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/coin_news.png&quot; alt=&quot;coin news&quot; /&gt;&lt;/p&gt;

&lt;p&gt;ブロックチェーンて？Bitcoinて？具体的にはどんなものかというのが複雑でいまいち把握できずにいたところ、この&lt;a href=&quot;https://github.com/lhartikk/naivechain&quot;&gt;naivechain(https://github.com/lhartikk/naivechain)&lt;/a&gt;というrepositoryに出会ったので写経しつつ理解しようと思いました。ここでは最小限の機能を持ったブロックチェーンを最小行のソースコードで表現しているのでブロックチェーンの基本的な考えをやさしく理解できるのではないかなと思います。同じように&lt;a href=&quot;https://github.com/lhartikk/naivechain&quot;&gt;naivechain&lt;/a&gt;を参考に書き換えているrepositoryがGithubでたくさん見られたので負けじと僕もやっていこうかなと。Javascriptて書かれたものなのですがこれをRubyでかき換えつつ噛み砕いでいった過程を記します。&lt;/p&gt;

&lt;h5 id=&quot;登場人物&quot;&gt;登場人物&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;Node       –&amp;gt; まな板ですね、全ての作業はここで行われる&lt;/li&gt;
  &lt;li&gt;Mining     –&amp;gt; 包丁ですね、絶えずシャキンシャキン動いています&lt;/li&gt;
  &lt;li&gt;P2P        –&amp;gt; 菜箸ですね、まな板から他のまな板へ材料を移動させる感じ&lt;/li&gt;
  &lt;li&gt;Block      –&amp;gt; 素材です、ウインナーです&lt;/li&gt;
  &lt;li&gt;Blockchain –&amp;gt; 腸詰です、ウインナーが連なってます&lt;/li&gt;
  &lt;li&gt;Hash       –&amp;gt; 秘密のスパイスです&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;といったようにあまり数が多くないので本当にシンプルに事は進みます。&lt;/p&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;1-仕込み&quot;&gt;1, 仕込み&lt;/h4&gt;

&lt;p&gt;まな板を準備します、複数まな板があることを前提として、腸詰を上手にシェアするために &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;port&lt;/code&gt; を教えあいます。菜箸こと &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt; を使ってP2Pを実現します。 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt; と &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPServer&lt;/code&gt; の関係が正直なところ最初 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;？&lt;/code&gt; だったんですが、 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPServer&lt;/code&gt; はひたすら &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt; が来るのを待つんですよね、待って待ってついに &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt; がきたら他の &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt; をあてがってあげて、また新たな &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt; が来るのを待つんです。待つんです。掴んでいるのは腸詰です。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  class Node
    def initialize(port, other_node_ports = [])
      @clients = []
      other_node_ports.each do |other_node_port|
        client = TCPSocket.open(&apos;localhost&apos;, other_node_port)
        Thread.start do
          listen_message(client)
        end

        @clients &amp;lt;&amp;lt; client
      end

      @server = TCPServer.open(&apos;localhost&apos;, port)
      init_connection
    end
  end

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;こんな感じに &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;initialize&lt;/code&gt; はなりまして、すでに存在する &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt; のportに通信を試みる役割と、あとで &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCPSocket&lt;/code&gt; が通信して来る時の備えの役割が主ですね。&lt;/p&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;2-包丁さばき&quot;&gt;2, 包丁さばき&lt;/h4&gt;

&lt;p&gt;舞台はまな板の上で整ったので具材を切っていきしょう。ブロックチェーンで重要なキーワード &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mining&lt;/code&gt; と呼ばれる処理がここになりますね。 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mining&lt;/code&gt; を行って秘密のスパイスを生成します、これを加えたものがウインナーになります。秘密のスパイスを作るのに時間をかけるとその分ウインナーが美味しくなるのは自明ですね、その時間をかける工程によってBitcoinは信頼性を保っていると理解しています。ここではあまり時間をかけられないので化学調味料で代替します。味の素です。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  def mine_with_loop
    Thread.start do
      loop { mine; sleep(Random.rand(10)) }
    end
  end

  def mine
    @blockchain &amp;lt;&amp;lt; generate_next_block(@blockchain.last)
    broadcast
  end

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mining&lt;/code&gt; をエンドレスに行います、行いますが容易に変化がみれるように1シャキンあたり0〜10秒待ってシャキンシャキンします。
一振りで一つのウインナーが作られます。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  def generate_next_block(block_data)
    previous_block = @blockchain.last
    next_index = previous_block[&quot;index&quot;] + 1
    next_timestamp = Time.now.to_i
    next_data = &quot;Smart contract&quot; + next_index.to_s
    next_hash = calculate_hash(
      next_index,
      previous_block[&quot;hash&quot;],
      next_timestamp,
      next_data
    )

    {
      &quot;index&quot; =&amp;gt; next_index,
      &quot;previous_hash&quot; =&amp;gt; previous_block[&quot;hash&quot;],
      &quot;timestamp&quot; =&amp;gt; next_timestamp,
      &quot;data&quot; =&amp;gt; next_data,
      &quot;hash&quot; =&amp;gt; next_hash
    }
  end

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;block&lt;/code&gt; に含まれているのは&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index&lt;/code&gt; –&amp;gt; 何番目のブロックか&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;previous_hash&lt;/code&gt; –&amp;gt; 一つ前の鍵&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;timestamp&lt;/code&gt; –&amp;gt; 作れた時刻&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;data&lt;/code&gt; –&amp;gt; データ&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hash&lt;/code&gt; –&amp;gt; 正しさを示す鍵となるもの&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;から構成されています。&lt;/p&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;3-仕上げ&quot;&gt;3, 仕上げ&lt;/h4&gt;

&lt;p&gt;ここで作ったウインナーを腸詰に繋げてみんなに自慢するために他のまな板へ投げつけます、使うのは菜箸です。これを受けとった他のまな板は、この腸詰の完成度をひとつひとつ入念に調べます。完成度が満足していてかつ腸詰の長さ(ウインナーの数)がおおきければ自分が作っていた腸詰は捨てこれを採用します。出来が今一つの場合、これを投げ捨てます。どちらにせよそこからまた包丁をシャキンシャキンしていきます。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  def verify(blockchain)
    replace_chain(blockchain) if is_valid_chain(blockchain)
  end

  def is_valid_chain(blockchain)
    if blockchain[0] != get_genesis_block
      return false
    end
    temp_blocks = [blockchain[0]]
    blockchain[1..-1].each_with_index do |block, index|
      if is_valid_new_block(block, temp_blocks[index])
        temp_blocks &amp;lt;&amp;lt; block
      else
        return false
      end
    end

    true
  end

  def is_valid_new_block(new_block, previous_block)
    if previous_block[&quot;index&quot;] + 1 != new_block[&quot;index&quot;]
      return false
    elsif previous_block[&quot;hash&quot;] != new_block[&quot;previous_hash&quot;]
      return false
    elsif calculate_hash_for_block(new_block) != new_block[&quot;hash&quot;]
      return false
    end

    true
  end

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;4-秘密のスパイスの作り方&quot;&gt;4, 秘密のスパイスの作り方&lt;/h4&gt;

&lt;p&gt;秘伝の業でなされるものなので、過去のウインナーを参考にしつつ新しい血を加え、特定のアルゴリズム(ここではbase64digest)を用いて文字列に変えます。この値の確かさをのちに確かめる必要があるのでこの変換結果は普遍でないといけないですね。ここのhashの生成方法過程が実用されているコインではきっと面白難しいはずなので追々もっと深掘りしていこうと思います。
ここでは簡易的に味の素を使用します。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  def calculate_hash_for_block(block)
    calculate_hash(block[&quot;index&quot;], block[&quot;previous_hash&quot;], block[&quot;timestamp&quot;], block[&quot;data&quot;])
  end

  def calculate_hash(index, previous_hash, timestamp, data)
    Digest::SHA256.base64digest(index.to_s + previous_hash.to_s + timestamp.to_s + data.to_s).to_s
  end

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;
&lt;h4 id=&quot;終わりに&quot;&gt;終わりに&lt;/h4&gt;

&lt;p&gt;といった風に以上の工程を繰り返し繰り返し行い、ブロックチェーンは巨大化していくのですね。これをはじめとして&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;hash生成のアルゴリズム&lt;/li&gt;
  &lt;li&gt;dataの存在の仕方の詳細、各々コインでどんなdataが入っているのか、多分そこが色々あるコインの特徴となるところなんじゃないの？&lt;/li&gt;
  &lt;li&gt;本当に各Nodeがすべてのブロックチェーンを保持しているの？それってものすごく長くない？&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;などなど疑問は山積みなのでひとつひとつ神砕ければなと思います。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/ikuto0608/naivechain&quot;&gt;コードはここに https://github.com/ikuto0608/naivechain&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Thu, 07 Dec 2017 19:19:00 +0000</pubDate>
        <link>https://ikuto0608.github.io//blockchain/programming/2017/12/07/naivechain-jp/</link>
        <guid isPermaLink="true">https://ikuto0608.github.io//blockchain/programming/2017/12/07/naivechain-jp/</guid>
      </item>
    
      <item>
        <title>ここ1年ちょっとを振り返ってみる</title>
        <description>&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/movie.jpg&quot; alt=&quot;vancouver&quot; /&gt;&lt;/p&gt;

&lt;p&gt;カナダはバンクーバーに来たのは2015年の終わり、クリスマスの数日後のこと。それからかれこれ1年と8ヶ月が過ぎたことになる。
最初の3ヶ月をESLのクラスで勉強、そこから1年間、プログラミングのクラスを受講した。&lt;a href=&quot;http://www.itdcanada.ca/&quot;&gt;ITD&lt;/a&gt;という私立のカレッジに通ったのだけれど、安い授業料のうえ、Co-op付きなので1年間の座学、そしてそのあとに1年間のインターンシップができる。授業の内容は置いといて、総じていいんじゃないかなと思う。それはまぁ仕事が無事決まったので言えることだけれど。&lt;/p&gt;

&lt;p&gt;安い授業料といえど相対的な話で大きな金額であることは変わりがなかったり。&lt;/p&gt;

&lt;p&gt;この1年間をひとまず振り返ってみるとして、ほとんど毎日授業があり、ただ午前か午後のどちらかだけだったので空いた時間のほとんどは&lt;a href=&quot;https://www.vpl.ca/&quot;&gt;図書館&lt;/a&gt;で過ごしていたんじゃないかなと思う。たまにカフェに行って雰囲気を変えて勉強してみたりした。英語の勉強というよりは大部分をプログラミングに時間を費やしていたと思う。英語は今でも本当にまだまだだな感じていてどうしたものかな。。&lt;/p&gt;

&lt;p&gt;最初の方はよく英会話の&lt;a href=&quot;https://www.meetup.com/&quot;&gt;ミートアップ&lt;/a&gt;に参加していた。大抵はカフェで行われてテーブルについてグループではじめましてから話し出す感じ。それから徐々に話すことに慣れて行って今度はIT系のミートアップに参加しはじめた。多くはプログラミングブートキャンプが開催するDemo dayに参加した、そこでは学生たちが作ったアプリを発表する場になっていてなんとピザとビールがお客さんに振舞われるのでよく行ったな。あとはRubyミートアップに定期的に行ってTipsをプレゼンしてくれるので知見を広げられた。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/demoday.jpg&quot; alt=&quot;meetup&quot; /&gt;&lt;/p&gt;

&lt;p&gt;そんな感じで数ヶ月を過ごしたあと、お金がそろそろ怪しくなって来たので何か細かくできる仕事はないかなぁと&lt;a href=&quot;http://www.jpcanada.com/&quot;&gt;JPCanada&lt;/a&gt;を眺めていたら公文式から採点要員の募集があったので応募、採用、働きだした。そう、公文式はグローバル展開されていることをそのとき知った。こっちでは算数と英語、それに国語が学べて、日本と変わらないかなと。算数と国語の採点要員として働きだした、算数とか結構忘れていたので問題をちらほら解いてみたり、新鮮だった。国語はこっちにいる日本人の子達が生徒だった。算数は8割ネイティブで2割日本人くらいだったかな。英語で算数を教える、これ大変だった。英語もそうだけどまず高校レベルの数学まで行くとちょっとつまるとこがあって恥ずかしさを感じた。ともして可もなく不可もなく働き続けていたら学校の授業が重なるようになって辞めざるを得なくなった。今ならもう少し上手に教えることが出来かもしれない、気のせいかもしれない。&lt;/p&gt;

&lt;p&gt;と、ここまできて座学の期間が終わりに近づいて来たので就活準備に時間を割くようになって来た。やったことといえば主に書いたソースをみてもらえるように単語テストをまるまる作ってGithubに置いた。これが採用に効いたのかは定かでない、聞いてないし聞かれてもいない。多分みられてすらないのかな。それはないかな。レジュメを用意してポートフォリオを用意して、最初に作ったポートフォリオをエージェントに見せたらなんかねぇぇって感じだったので自分のGithub.ioのaboutページをポートフォリオとした。&lt;/p&gt;

&lt;p&gt;実際に企業にアプローチをかけはじめたのが確か2017年の2月ころ、レジュメを送ったのは20社程度、電話面接をしたのが1社、実際に面接したのは今働いているところだけ。運がよかったの一言に尽きる。&lt;/p&gt;

&lt;p&gt;それで3月の半ばから働きだして、3月はまだ授業があったので半分仕事半分学校という暮らしをして晴れて4月からフルタイムで働いて今に至る。まだ幸い首にはなっていない。仕事はバックエンドをRailsで書いている。まだまだ小さいチームなので開発フローとかミーティングの仕方とか探り探り、やっていっている。自社製品を作る系の会社である。卓球台がある。一日に最低は一回はマネージャーと対戦する。キッチンがある。アボガドとバナナが常時ある。プロテインバーもある。コーヒーメーカーもある。居心地がいい。日本で正社員で働いた会社と比べると、うん、居心地がいい。そうそう、金曜日は冷蔵庫にビールが補充され、3時くらいから飲み始める。居心地がいい。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/pingpong.jpg&quot; alt=&quot;pingpong&quot; /&gt;&lt;/p&gt;

&lt;p&gt;ざっとこれでここ1年とちょっとを振り返れたのかなと。&lt;/p&gt;

&lt;p&gt;順調に事は進んでいるのではないかなと、日々の行いがよかったからということにさせていただいて、不満とかないわけではないけれどうちにも外にも。身にしみてわかったことと言えば、1年とちょっとで問題なく英語が話せるようにはならないということ。それでも机に向かって勉強と意識もなかなか働かない。いやそれでもしなきゃなと。&lt;/p&gt;

&lt;p&gt;働きはじめてまだ5ヶ月、やりがいもあるのでもうちょっと英語がスムーズに話せるともっとこうなんかうまくと行くよなぁ、という思いで毎日を過ごしていると。会社のソフトボールチームに参加しはじめたのでもっと人との距離を縮めてみようと思う。&lt;/p&gt;

&lt;p&gt;来年度に向けてワーホリの申請も進めている、とは言えまだ今年も半分以上残っていて来年の事までどうなっているのかは謎です。バンクーバーの夏は暑すぎなく過ごしやすくていいけれど、冬がね、長いしほぼ雨だしと。そろそろ京都も恋しくなって来ているし、どこかで日本に帰れればなと。&lt;/p&gt;

&lt;p&gt;ぐだぐだと日々がただ過ぎていかないようにやりたい事&amp;amp;やらなきゃいけない事をこんな感じに、&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;アメリカを車で横断する&lt;/li&gt;
  &lt;li&gt;Docker, Terraform, AWSに触れる&lt;/li&gt;
  &lt;li&gt;旅行+SNSでアプリ作る&lt;/li&gt;
  &lt;li&gt;スイミングに通う+村上春樹の英語オーディオを聴きながら(英語の向上)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;まとめて、さぁ頑張りましょう！&lt;/p&gt;
</description>
        <pubDate>Tue, 22 Aug 2017 22:36:00 +0000</pubDate>
        <link>https://ikuto0608.github.io//%E3%82%AB%E3%83%8A%E3%83%80/%E3%83%90%E3%83%B3%E3%82%AF%E3%83%BC%E3%83%90%E3%83%BC/%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0/%E7%95%99%E5%AD%A6/%E3%83%AF%E3%83%BC%E3%83%9B%E3%83%AA/2017/08/22/about-one-year-in-canada/</link>
        <guid isPermaLink="true">https://ikuto0608.github.io//%E3%82%AB%E3%83%8A%E3%83%80/%E3%83%90%E3%83%B3%E3%82%AF%E3%83%BC%E3%83%90%E3%83%BC/%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0/%E7%95%99%E5%AD%A6/%E3%83%AF%E3%83%BC%E3%83%9B%E3%83%AA/2017/08/22/about-one-year-in-canada/</guid>
      </item>
    
      <item>
        <title>How I met Kyoto, part 2</title>
        <description>&lt;p&gt;&lt;a href=&quot;http://tarocafe.jp/en&quot;&gt;Tarocafe&lt;/a&gt; is my favourite youth hostel in Kyoto. I met a lot of people who were interesting in there.&lt;/p&gt;

&lt;p&gt;First time I went there, it was when I was a university student. I finished the term of second grade at the time. I took exams and that were really bad scores then I almost couldn’t upgrade my grade by the way. The trip was for forgetting about my university.haha&lt;/p&gt;

&lt;p&gt;There was a so mysterious man who stayed Tarocafe alone for long time, few weeks already. He said his job is film directer in U.S, he is Japanese. He took long off, then he came back to Japan. I was curious about his background so much. He seemed not go around for sightseeing in Kyoto and he was also looking for soccer game in Europe to watch in there. I totally can not understand him, so I was attract in him.&lt;/p&gt;

&lt;p&gt;One of the stuff in Tarocafe was an art student. She is a painter. I remember she believe that ghost is actually soul. But I don’t remember why we reached to talk about that. Anyway, I had the opportunity to see her paints at her atelier. The owner of Tarocafe had another building for his bar and third floor of the building was her atelier. We went up the stairwell to her atelier. Those paints were so unique, I don’t remember much but my taste is like Man Ray’s art. I feel like same taste with her art.&lt;/p&gt;

&lt;p&gt;I still clearly remember the owner who runs Tarocafe, named Taro-san and another girl who stayed there and I went rotated sushi shop for lunch when I stayed Tarocafe first time.
Taro-san taught us, coke is the best drink after you eat sushi. Since I heard the story I follow the way and yeah, that’s matched with sushi for sure.
I currently lives in Vancouver, Canada. I cannot go to the rotated sushi shop. But fortunately there are a lot of sushi place in Vancouver and some of them are really delicious but still I so miss rotated sushi shop. There is no rotated one here.&lt;/p&gt;

&lt;video controls=&quot;controls&quot; width=&quot;100%&quot; name=&quot;tarocafe&quot; src=&quot;https://ikuto0608.github.io/images/tarocafe.mov&quot;&gt;&lt;/video&gt;
</description>
        <pubDate>Mon, 12 Jun 2017 22:16:00 +0000</pubDate>
        <link>https://ikuto0608.github.io//kyoto/tarocafe/hostel/trip/2017/06/12/how-i-met-kyoto/</link>
        <guid isPermaLink="true">https://ikuto0608.github.io//kyoto/tarocafe/hostel/trip/2017/06/12/how-i-met-kyoto/</guid>
      </item>
    
      <item>
        <title>I wanna introduce cafes where You should go in Kyoto.</title>
        <description>&lt;p&gt;Since I went to Kyoto when I was a university student, I often went back Kyoto. I always used &lt;a href=&quot;http://tarocafe.jp/en&quot;&gt;Tarocafe&lt;/a&gt; to stay. But I’m not like that person who likes sightseeing temples and shrines so that Kyoto even has a lot of those beautiful places, I didn’t go there after I’ve gone Kyoto first or second time.&lt;/p&gt;

&lt;p&gt;Why I go to Kyoto is I like people who I met, but not only that also there are many interesting places for me, for example cafes, Kyoto also has developing cafe culture, called “Kissa Bunka”. So a lot of cafe are in Kyoto. I’ve gone to there to go around cafes. I’m wanna show you my favourites cafes here. You already might know them because those are famous cafes I believe!&lt;/p&gt;

&lt;h3 id=&quot;moan---茂庵&quot;&gt;&lt;a href=&quot;https://www.tripadvisor.ca/Restaurant_Review-g298564-d3612328-Reviews-Moan-Kyoto_Kyoto_Prefecture_Kinki.html&quot;&gt;Moan - 茂庵&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This cafe is on the mountain called “Mt. Yoshida (吉田山)” near Kyoto university, so you should climb to go there but don’t worry, it’s really tiny mountain you’ll think it’s not mountain but hill.&lt;/p&gt;

&lt;p&gt;The building is a very old Japanese style house. And it has quite a beautiful viewing. It’s a nice place to hike and take a rest.&lt;/p&gt;

&lt;h3 id=&quot;elephant-factory-coffee&quot;&gt;&lt;a href=&quot;https://www.tripadvisor.ca/Restaurant_Review-g298564-d6614758-Reviews-Elephant_Factory_Coffee-Kyoto_Kyoto_Prefecture_Kinki.html&quot;&gt;Elephant Factory Coffee&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;I often go to this cafe, called Elephant Factory Coffee.
I like this coffee, it tastes better. Funny thing is it’s hard to go there first time because there is it at the innermost place on the load and second floor of the building.&lt;/p&gt;

&lt;p&gt;So I feel here is my secret place, but actually this cafe is so popular and many people there.&lt;/p&gt;

&lt;p&gt;And it’s at centre of Kyoto, near Kiyamachi st(木屋町通). You can use here to wait your friends, or spend your time till having dinner.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/elephant.jpg&quot; alt=&quot;elephant&quot; /&gt;&lt;/p&gt;

&lt;p&gt;It was in the cafe but ohhh I didn’t drink coffee.lol&lt;/p&gt;

&lt;h3 id=&quot;chieria&quot;&gt;&lt;a href=&quot;https://tabelog.com/en/kyoto/A2601/A260302/26022748/&quot;&gt;Chieria&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This cafe is so homely place, you can stay with “Kotatsu” in winter which is a traditional Japanese table with an electric heater underneath and cozzy blanket. And nice to have lunch, it has healthy and asian taste lunch.&lt;/p&gt;

&lt;h3 id=&quot;mizuiro-club---みず色クラブ&quot;&gt;&lt;a href=&quot;https://retty.me/area/PRE26/ARE116/SUB11202/100001176971/&quot;&gt;Mizuiro club - みず色クラブ&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This is the coolest secret neon cafe. You never get there by chance. It’s in residential area of north and east side from centre Kyoto.
It’s actually cafe-bar so you’ll have fun both of time.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ikuto0608.github.io/images/mizuiro.jpg&quot; alt=&quot;mizuiro&quot; /&gt;&lt;/p&gt;

&lt;p&gt;There are more interesting cafes in Kyoto, and let me know if you have your favourite one!&lt;/p&gt;
</description>
        <pubDate>Sun, 11 Jun 2017 16:32:00 +0000</pubDate>
        <link>https://ikuto0608.github.io//kyoto/cafe/coffee/2017/06/11/favourite-cafe-in-kyoto/</link>
        <guid isPermaLink="true">https://ikuto0608.github.io//kyoto/cafe/coffee/2017/06/11/favourite-cafe-in-kyoto/</guid>
      </item>
    
  </channel>
</rss>
