概要
wsl(wsl2じゃない)でnervesやってみる。
qemu(x86_64エミュレータ、ラズパイじゃない)でやってみた。
生成したnerves_livebook.imgを、ネットワークをテストしてみた。
テスト1
VintageNet.info()
VintageNet 0.13.5
All interfaces: ["eth0", "lo"]
Available interfaces: ["eth0"]
Interface eth0
Type: VintageNetEthernet
Present: true
State: :configured (0:16:12)
Connection: :internet (0:16:07)
Addresses: fec0::5054:ff:fe12:3456/64, fe80::5054:ff:fe12:3456/64, 10.0.2.15/24
MAC Address: "52:54:00:12:34:56"
Configuration:
%{type: VintageNetEthernet, ipv4: %{method: :dhcp}}
テスト2
Toolshed.ifconfig
lo: flags=[:up, :loopback, :running]
inet 127.0.0.1 netmask 255.0.0.0
inet ::1 netmask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
hwaddr 00:00:00:00:00:00
eth0: flags=[:up, :broadcast, :running, :multicast]
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet fec0::5054:ff:fe12:3456 netmask ffff:ffff:ffff:ffff::
inet fe80::5054:ff:fe12:3456 netmask ffff:ffff:ffff:ffff::
hwaddr 52:54:00:12:34:56
テスト3
Req.get!("https://qiita.com/api/v2/users/ohisama@github/items")
%Req.Response{
status: 200,
headers: %{
"cache-control" => ["max-age=0, private, must-revalidate"],
"connection" => ["keep-alive"],
"content-type" => ["application/json; charset=utf-8"],
"date" => ["Sat, 18 Nov 2023 21:19:13 GMT"],
"etag" => ["W/\"6a56392a43aa4dd9eb2222e66a54bd0f\""],
"link" => ["<https://qiita.com/api/v2/users/ohisama@github/items?page=1>; rel=\"first\", <https://qiita.com/api/v2/users/ohisama@github/items?page=2>; rel=\"next\", <https://qiita.com/api/v2/users/ohisama@github/items?page=192>; rel=\"last\""],
"rate-limit" => ["60"],
"rate-remaining" => ["57"],
"rate-reset" => ["1700345923"],
"referrer-policy" => ["strict-origin-when-cross-origin"],
"server" => ["nginx"],
"strict-transport-security" => ["max-age=2592000"],
"total-count" => ["3822"],
"transfer-encoding" => ["chunked"],
"vary" => ["Origin"],
"x-content-type-options" => ["nosniff"],
"x-download-options" => ["noopen"],
"x-frame-options" => ["SAMEORIGIN"],
"x-permitted-cross-domain-policies" => ["none"],
"x-request-id" => ["730b6cb4-f82f-431d-874c-279c3292f040"],
"x-runtime" => ["0.254000"],
"x-xss-protection" => ["1; mode=block"]
},
body: [
%{
"body" => "# 概要\nwsl(wsl2じゃない)で、elixirやってみた。\ngithubに、livebook、アップしてみた。\n\n# 手順\n\n# githubに、リポジトリ作る。\n\n- https://github.com/にSign inする。\n- 右上の「+」から「New repository」を選択する。\n- 「Repository name」にリポジトリ名(ohi_Livebook)を入力する。\n- Description にelixir livebook\n- リポジトリを公開する場合は「Public」をチェックする。\n- 「Initialize this repository with a README」をチェックする。\n- license は、Mit\n- 「Create repository」をクリックする。\n\n# アクセストークンを作る。\n\n- GitHubにログイン\n- 右上の自分のアイコンをクリック\n- 「Settings」をクリック\n- 左メニュー下部の「Developer settings」をクリック\n- 左メニューの「Personal access tokens」をクリック\n- 右上の「Generate new token」をクリックしてアクセストークンを作成\n- ※パスワードが聞かれたらgitのパスワードを入力する\n- Note:任意の名称を入れてください。\n- Expiration:何日の有効にするかを決めてください。(悩むなら30日でいいです)\n- Select scopes:repo チェックを入れる\n- 設定が終わったら「generate token」を押してアクセスコードを発行する。\n- 作成したトークンをコピーする\n\n# wslに、リポジトリ作る。\n\n```\n$ mkdir github\n\n$ cd github\n\n$ git init\nInitialized empty Git repository in /home/ore/github/.git/\n\n$ git clone https://github.com/ohisama/ohi_Livebook.git\nCloning into 'ohi_Livebook'...\nremote: Enumerating objects: 4, done.\nremote: Counting objects: 100% (4/4), done.\nremote: Compressing objects: 100% (3/3), done.\nremote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0\nUnpacking objects: 100% (4/4), 1.24 KiB | 40.00 KiB/s, done.\n\n$ cd ohi_Livebook\n\n```\n\n# ファイルをコピーする。\n\n```\n$ explorer.exe .\n```\n\n# pushする。\n\nパスワードに、アクセストークンを使う。\n\n```\n$ git config --global user.name \"ohisama\"\n\n$ git config --global user.email \"\"\n\n$ git add .\n\n$ git status\nOn branch main\nYour branch is up to date with 'origin/main'.\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n new file: stage1/hello.livemd\n new file: stage1/hello2.livemd\n new file: stage1/map.livemd\n new file: stage1/qiita.livemd\n new file: stage1/ronri.livemd\n new file: stage1/socket.livemd\n new file: stage1/vega.livemd\n\n$ git commit -m \"update2\"\n[main ea576ce] update2\n 7 files changed, 1627 insertions(+)\n create mode 100644 stage1/hello.livemd\n create mode 100644 stage1/hello2.livemd\n create mode 100644 stage1/map.livemd\n create mode 100644 stage1/qiita.livemd\n create mode 100644 stage1/ronri.livemd\n create mode 100644 stage1/socket.livemd\n create mode 100644 stage1/vega.livemd\n\n$ git push\nUsername for 'https://github.com': ohisama\nPassword for 'https://':\nEnumerating objects: 11, done.\nCounting objects: 100% (11/11), done.\nDelta compression using up to 4 threads\nCompressing objects: 100% (10/10), done.\nWriting objects: 100% (10/10), 10.17 KiB | 1.02 MiB/s, done.\nTotal 10 (delta 0), reused 0 (delta 0)\nTo https://github.com/ohisama/ohi_Livebook.git\n 57e4c10..ea576ce main -> main\n\n```\n\n# 成果物\n\nhttps://github.com/ohisama/ohi_Livebook\n\n以上。\n\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-18T17:30:19+09:00",
"group" => nil,
"id" => "c50a596a1d2a679924e8",
"likes_count" => 0,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-3:47\">wsl(wsl2じゃない)で、elixirやってみた。<br>\ngithubに、livebook、アップしてみた。</p>\n<h1 data-sourcepos=\"5:1-5:8\">\n<span id=\"手順\" class=\"fragment\"></span><a href=\"#%E6%89%8B%E9%A0%86\"><i class=\"fa fa-link\"></i></a>手順</h1>\n<h1 data-sourcepos=\"7:1-7:38\">\n<span id=\"githubにリポジトリ作る\" class=\"fragment\"></span><a href=\"#github%E3%81%AB%E3%83%AA%E3%83%9D%E3%82%B8%E3%83%88%E3%83%AA%E4%BD%9C%E3%82%8B\"><i class=\"fa fa-link\"></i></a>githubに、リポジトリ作る。</h1>\n<ul data-sourcepos=\"9:1-17:0\">\n<li data-sourcepos=\"9:1-9:40\">\n<a href=\"https://github.com/%E3%81%ABSign\" class=\"autolink\" rel=\"nofollow noopener\" target=\"_blank\">https://github.com/にSign</a> inする。</li>\n<li data-sourcepos=\"10:1-10:62\">右上の「+」から「New repository」を選択する。</li>\n<li data-sourcepos=\"11:1-11:76\">「Repository name」にリポジトリ名(ohi_Livebook)を入力する。</li>\n<li data-sourcepos=\"12:1-12:32\">Description にelixir livebook</li>\n<li data-sourcepos=\"13:1-13:77\">リポジトリを公開する場合は「Public」をチェックする。</li>\n<li data-sourcepos=\"14:1-14:72\">「Initialize this repository with a README」をチェックする。</li>\n<li data-sourcepos=\"15:1-15:19\">license は、Mit</li>\n<li data-sourcepos=\"16:1-17:0\">「Create repository」をクリックする。</li>\n</ul>\n<h1 data-sourcepos=\"18:1-18:38\">\n<span id=\"アクセストークンを作る\" class=\"fragment\"></span><a href=\"#%E3%82%A2%E3%82%AF%E3%82%BB%E3%82%B9%E3%83%88%E3%83%BC%E3%82%AF%E3%83%B3%E3%82%92%E4%BD%9C%E3%82%8B\"><i class=\"fa fa-link\"></i></a>アクセストークンを作る。</h1>\n<ul data-sourcepos=\"20:1-32:0\">\n<li data-sourcepos=\"20:1-20:23\">GitHubにログイン</li>\n<li data-sourcepos=\"21:1-21:47\">右上の自分のアイコンをクリック</li>\n<li data-sourcepos=\"22:1-22:31\">「Settings」をクリック</li>\n<li data-sourcepos=\"23:1-23:65\">左メニュー下部の「Developer settings」をクリック</li>\n<li data-sourcepos=\"24:1-24:63\">左メニューの「Personal access tokens」をクリック</li>\n<li data-sourcepos=\"25:1-25:89\">右上の「Generate new token」をクリックしてアクセストークンを作成</li>\n<li data-sourcepos=\"26:1-26:74\">※パスワードが聞かれたらgitのパスワードを入力する</li>\n<li data-sourcepos=\"27:1-27:51\">Note:任意の名称を入れてください。</li>\n<li data-sourcepos=\"28:1-28:107\">Expiration:何日の有効にするかを決めてください。(悩むなら30日でいいです)</li>\n<li data-sourcepos=\"29:1-29:47\">Select scopes:repo チェックを入れる</li>\n<li data-sourcepos=\"30:1-30:97\">設定が終わったら「generate token」を押してアクセスコードを発行する。</li>\n<li data-sourcepos=\"31:1-32:0\">作成したトークンをコピーする</li>\n</ul>\n<h1 data-sourcepos=\"33:1-33:35\">\n<span id=\"wslにリポジトリ作る\" class=\"fragment\"></span><a href=\"#wsl%E3%81%AB%E3%83%AA%E3%83%9D%E3%82%B8%E3%83%88%E3%83%AA%E4%BD%9C%E3%82%8B\"><i class=\"fa fa-link\"></i></a>wslに、リポジトリ作る。</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"35:1-53:3\"><div class=\"highlight\"><pre><code>$ mkdir github\n\n$ cd github\n\n$ git init\nInitialized empty Git repository in /home/ore/github/.git/\n\n$ git clone https://github.com/ohisama/ohi_Livebook.git\nCloning into 'ohi_Livebook'...\nremote: Enumerating objects: 4, done.\nremote: Counting objects: 100% (4/4), done.\nremote: Compressing objects: 100% (3/3), done.\nremote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0\nUnpacking objects: 100% (4/4), 1.24 KiB | 40.00 KiB/s, done.\n\n$ cd ohi_Livebook\n\n</code></pre></div></div>\n<h1 data-sourcepos=\"55:1-55:35\">\n<span id=\"ファイルをコピーする\" class=\"fragment\"></span><a href=\"#%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%92%E3%82%B3%E3%83%94%E3%83%BC%E3%81%99%E3%82%8B\"><i class=\"fa fa-link\"></i></a>ファイルをコピーする。</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"57:1-59:3\"><div class=\"highlight\"><pre><code>$ explorer.exe .\n</code></pre></div></div>\n<h1 data-sourcepos=\"61:1-61:15\">\n<span id=\"pushする\" class=\"fragment\"></span><a href=\"#push%E3%81%99%E3%82%8B\"><i class=\"fa fa-link\"></i></a>pushする。</h1>\n<p data-sourcepos=\"63:1-63:57\">パスワードに、アクセストークンを使う。</p>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"65:1-109:3\"><div class=\"highlight\"><pre><code>$ git config --global user.name \"ohisama\"\n\n$ git config --global user.email \"\"\n\n$ git add .\n\n$ git status\nOn branch main\nYour branch is up to date with 'origin/main'.\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n new file: stage1/" <> ...,
"slide" => false,
"stocks_count" => 0,
"tags" => [
%{"name" => "GitHub", "versions" => []},
%{"name" => "Elixir", "versions" => []},
%{"name" => "WSL", "versions" => []},
%{"name" => "Livebook", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでelixir その105",
"updated_at" => "2023-11-18T18:24:43+09:00",
"url" => "https://qiita.com/ohisama@github/items/c50a596a1d2a679924e8",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
"profile_image_url" => "https://secure.gravatar.com/avatar/2e0bb506fbe90e6572bf92fa05db88d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"team_only" => false,
"twitter_screen_name" => nil,
"website_url" => nil
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)でnervesやってみる。\nasdfが魔法なので、コマンドをメモる。\n\n# 起動する。\n\n```\n$ . \"$HOME/.asdf/asdf.sh\"\n```\n\n# インストールできるバージョン\n\n```\n$ asdf list-all erixir\n```\n\n# インストールされているバージョン\n\n```\n$ asdf list elixir\n```\n\n# インストールする\n\n```\n$ asdf install elixir 1.15.7-otp-26\n```\n\n\n# 現在の設定\n\n```\n$ asdf current\n```\n\n\n# カレントバージョンを変更する。\n\n\n```\n$ asdf local elixir 1.15.6-otp-26\n```\n\n# カレントバージョンを設定する。\n\n```\n$ asdf global elixir 1.15.7-otp-26\n```\n\n# どこに、インストールされるの\n\n```\n/home/root/.asdf/installs/elixir/1.15.6-otp-26/.mix/archives/hex-2.0.6\n```\n\n# からくりは\n\n- asdf は、 $PATH の前に、 shims のディレクトリを挿入することで動作します。\n\n\n以上。\n\n\n\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-17T15:44:29+09:00",
"group" => nil,
"id" => "f28f3e3e43d2174e2df7",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-3:52\">wsl(wsl2じゃない)でnervesやってみる。<br>\nasdfが魔法なので、コマンドをメモる。</p>\n<h1 data-sourcepos=\"5:1-5:17\">\n<span id=\"起動する\" class=\"fragment\"></span><a href=\"#%E8%B5%B7%E5%8B%95%E3%81%99%E3%82%8B\"><i class=\"fa fa-link\"></i></a>起動する。</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"7:1-9:3\"><div class=\"highlight\"><pre><code>$ . \"$HOME/.asdf/asdf.sh\"\n</code></pre></div></div>\n<h1 data-sourcepos=\"11:1-11:44\">\n<span id=\"インストールできるバージョン\" class=\"fragment\"></span><a href=\"#%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%A7%E3%81%8D%E3%82%8B%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3\"><i class=\"fa fa-link\"></i></a>インストールできるバージョン</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"13:1-15:3\"><div class=\"highlight\"><pre><code>$ asdf list-all erixir\n</code></pre></div></div>\n<h1 data-sourcepos=\"17:1-17:51\">\n<span id=\"インストールされているバージョン\" class=\"fragment\"></span><a href=\"#%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3\"><i class=\"fa fa-link\"></i></a>インストールされているバージョン</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"19:1-21:3\"><div class=\"highlight\"><pre><code>$ asdf list elixir\n</code></pre></div></div>\n<h1 data-sourcepos=\"23:1-23:26\">\n<span id=\"インストールする\" class=\"fragment\"></span><a href=\"#%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B\"><i class=\"fa fa-link\"></i></a>インストールする</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"25:1-27:3\"><div class=\"highlight\"><pre><code>$ asdf install elixir 1.15.7-otp-26\n</code></pre></div></div>\n<h1 data-sourcepos=\"30:1-30:17\">\n<span id=\"現在の設定\" class=\"fragment\"></span><a href=\"#%E7%8F%BE%E5%9C%A8%E3%81%AE%E8%A8%AD%E5%AE%9A\"><i class=\"fa fa-link\"></i></a>現在の設定</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"32:1-34:3\"><div class=\"highlight\"><pre><code>$ asdf current\n</code></pre></div></div>\n<h1 data-sourcepos=\"37:1-37:47\">\n<span id=\"カレントバージョンを変更する\" class=\"fragment\"></span><a href=\"#%E3%82%AB%E3%83%AC%E3%83%B3%E3%83%88%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3%E3%82%92%E5%A4%89%E6%9B%B4%E3%81%99%E3%82%8B\"><i class=\"fa fa-link\"></i></a>カレントバージョンを変更する。</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"40:1-42:3\"><div class=\"highlight\"><pre><code>$ asdf local elixir 1.15.6-otp-26\n</code></pre></div></div>\n<h1 data-sourcepos=\"44:1-44:47\">\n<span id=\"カレントバージョンを設定する\" class=\"fragment\"></span><a href=\"#%E3%82%AB%E3%83%AC%E3%83%B3%E3%83%88%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%99%E3%82%8B\"><i class=\"fa fa-link\"></i></a>カレントバージョンを設定する。</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"46:1-48:3\"><div class=\"highlight\"><pre><code>$ asdf global elixir 1.15.7-otp-26\n</code></pre></div></div>\n<h1 data-sourcepos=\"50:1-50:44\">\n<span id=\"どこにインストールされるの\" class=\"fragment\"></span><a href=\"#%E3%81%A9%E3%81%93%E3%81%AB%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%95%E3%82%8C%E3%82%8B%E3%81%AE\"><i class=\"fa fa-link\"></i></a>どこに、インストールされるの</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"52:1-54:3\"><div class=\"highlight\"><pre><code>/home/root/.asdf/installs/elixir/1.15.6-otp-26/.mix/archives/hex-2.0.6\n</code></pre></div></div>\n<h1 data-sourcepos=\"56:1-56:17\">\n<span id=\"からくりは\" class=\"fragment\"></span><a href=\"#%E3%81%8B%E3%82%89%E3%81%8F%E3%82%8A%E3%81%AF\"><i class=\"fa fa-link\"></i></a>からくりは</h1>\n<ul data-sourcepos=\"58:1-60:0\">\n<li data-sourcepos=\"58:1-60:0\">asdf は、 $PATH の前に、 shims のディレクトリを挿入することで動作します。</li>\n</ul>\n<p data-sourcepos=\"61:1-61:9\">以上。</p>\n",
"slide" => false,
"stocks_count" => 0,
"tags" => [
%{"name" => "Elixir", "versions" => []},
%{"name" => "asdf", "versions" => []},
%{"name" => "Nerves", "versions" => []},
%{"name" => "WSL", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでnerves その21",
"updated_at" => "2023-11-17T15:58:46+09:00",
"url" => "https://qiita.com/ohisama@github/items/f28f3e3e43d2174e2df7",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
"profile_image_url" => "https://secure.gravatar.com/avatar/2e0bb506fbe90e6572bf92fa05db88d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"team_only" => false,
"twitter_screen_name" => nil,
"website_url" => nil
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)でnervesやってみる。\nqemu(x86_64エミュレータ、ラズパイじゃない)でやってみた。\n生成したnerves_livebook.imgを、qemuで起動してみた。\n\n# 写真\n\n![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/5ea5b466-a081-75ab-1f7e-0bdd0c7710b2.png)\n\n# 起動スクリプト\n\n```\n\n\"C:\\Program Files\\qemu\\qemu-system-x86_64.exe\" -drive file=\"nerves_livebook.img\",if=virtio,format=raw -m 4098 -net nic,model=virtio -net usa,hostfwd=tcp::10022-:22,hostfwd=tcp::80-:80 -serial stdio\n\n\n```\n\n# ブラウザで、Livebook起動。\n\n# アドレス\n\n```\nhttp://localhost\n```\n\n# 写真\n\n![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/07fe2dfa-8b7b-9166-c498-302cf11cba86.png)\n\n# パスワード\n\n```\nnerves\n```\n\n# 写真\n\n![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/9aeece2c-ff82-a12c-38e0-e92ae3b08970.png)\n\n\n以上。\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-17T06:20:38+09:00",
"group" => nil,
"id" => "3d724f6079e3517ffee1",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-4:65\">wsl(wsl2じゃない)でnervesやってみる。<br>\nqemu(x86_64エミュレータ、ラズパイじゃない)でやってみた。<br>\n生成したnerves_livebook.imgを、qemuで起動してみた。</p>\n<h1 data-sourcepos=\"6:1-6:8\">\n<span id=\"写真\" class=\"fragment\"></span><a href=\"#%E5%86%99%E7%9C%9F\"><i class=\"fa fa-link\"></i></a>写真</h1>\n<p data-sourcepos=\"8:1-8:120\"><a href=\"https://camo.qiitausercontent.com/dcecfc5a9cbb0c9cd3f807ec9e5896a0cebdc5fc/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f31383130342f35656135623436362d613038312d373561622d316637652d3062646430633737313062322e706e67\" target=\"_blank\" rel=\"nofollow noopener\"><img src=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2F5ea5b466-a081-75ab-1f7e-0bdd0c7710b2.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=becd2e2595f5aebc8f6e37604d1f7bd6\" alt=\"image.png\" data-canonical-src=\"https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/5ea5b466-a081-75ab-1f7e-0bdd0c7710b2.png\" srcset=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2F5ea5b466-a081-75ab-1f7e-0bdd0c7710b2.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&w=1400&fit=max&s=0459f7f97e1136918d073b9adc7a6d07 1x\" loading=\"lazy\"></a></p>\n<h1 data-sourcepos=\"10:1-10:23\">\n<span id=\"起動スクリプト\" class=\"fragment\"></span><a href=\"#%E8%B5%B7%E5%8B%95%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88\"><i class=\"fa fa-link\"></i></a>起動スクリプト</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"12:1-17:3\"><div class=\"highlight\"><pre><code>\n\"C:\\Program Files\\qemu\\qemu-system-x86_64.exe\" -drive file=\"nerves_livebook.img\",if=virtio,format=raw -m 4098 -net nic,model=virtio -net usa,hostfwd=tcp::10022-:22,hostfwd=tcp::80-:80 -serial stdio\n\n\n</code></pre></div></div>\n<h1 data-sourcepos=\"19:1-19:37\">\n<span id=\"ブラウザでlivebook起動\" class=\"fragment\"></span><a href=\"#%E3%83%96%E3%83%A9%E3%82%A6%E3%82%B6%E3%81%A7livebook%E8%B5%B7%E5%8B%95\"><i class=\"fa fa-link\"></i></a>ブラウザで、Livebook起動。</h1>\n<h1 data-sourcepos=\"21:1-21:14\">\n<span id=\"アドレス\" class=\"fragment\"></span><a href=\"#%E3%82%A2%E3%83%89%E3%83%AC%E3%82%B9\"><i class=\"fa fa-link\"></i></a>アドレス</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"23:1-25:3\"><div class=\"highlight\"><pre><code>http://localhost\n</code></pre></div></div>\n<h1 data-sourcepos=\"27:1-27:8\">\n<span id=\"写真-1\" class=\"fragment\"></span><a href=\"#%E5%86%99%E7%9C%9F-1\"><i class=\"fa fa-link\"></i></a>写真</h1>\n<p data-sourcepos=\"29:1-29:120\"><a href=\"https://camo.qiitausercontent.com/7b17af8bc9bc776c41cc5e18ba743951aab14d6b/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f31383130342f30376665326466612d386237622d393136362d633439382d3330326366313163626138362e706e67\" target=\"_blank\" rel=\"nofollow noopener\"><img src=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2F07fe2dfa-8b7b-9166-c498-302cf11cba86.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=4ed32dd2d77d5cc18bb103928845792c\" alt=\"image.png\" data-canonical-src=\"https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/07fe2dfa-8b7b-9166-c498-302cf11cba86.png\" srcset=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2F07fe2dfa-8b7b-9166-c498-302cf11cba86.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&w=1400&fit=max&s=9df6f757e0397ff5291dac9125765df2 1x\" loading=\"lazy\"></a></p>\n<h1 data-sourcepos=\"31:1-31:17\">\n<span id=\"パスワード\" class=\"fragment\"></span><a href=\"#%E3%83%91%E3%82%B9%E3%83%AF%E3%83%BC%E3%83%89\"><i class=\"fa fa-link\"></i></a>パスワード</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"33:1-35:3\"><div class=\"highlight\"><pre><code>nerves\n</code></pre></div></div>\n<h1 data-sourcepos=\"37:" <> ...,
"slide" => false,
"stocks_count" => 0,
"tags" => [
%{"name" => "Elixir", "versions" => []},
%{"name" => "x86_64", "versions" => []},
%{"name" => "QEMU", "versions" => []},
%{"name" => "Nerves", "versions" => []},
%{"name" => "WSL", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでnerves その20",
"updated_at" => "2023-11-17T06:30:21+09:00",
"url" => "https://qiita.com/ohisama@github/items/3d724f6079e3517ffee1",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
"profile_image_url" => "https://secure.gravatar.com/avatar/2e0bb506fbe90e6572bf92fa05db88d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"team_only" => false,
"twitter_screen_name" => nil,
"website_url" => nil
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)でnervesやってみる。\nqemu(x86_64エミュレータ、ラズパイじゃない)でやってみた。\nnerves_livebookに、手出してみた。\n\n# 環境\nwindows 10\nubuntu 20.04LTS(WSL)\n\n# 手順\n\n```\n$ git clone https://github.com/nerves-livebook/nerves_livebook.git\n$ cd nerves_livebook\n\n```\n\n# エラー発生\n\n```\n$ mix deps.get\nNo preset version installed for command mix\nPlease install a version by running one of the following:\n\nasdf install elixir 1.15.6-otp-26\n\nor add one of the following versions in your config file at /home/ore/elixir/nerves_livebook/.tool-versions\nelixir 1.15.7-otp-26\n\n```\n\n# 対処\n\n```\n$ asdf install elixir 1.15.6-otp-26\n==> Checking whether specified Elixir release exists...\n==> Downloading 1.15.6-otp-26 to /home/ore/.asdf/downloads/elixir/1.15.6-otp-26/elixir-precompiled-1.15.6-otp-26.zip\n % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n100 6645k 100 6645k 0 0 4757k 0 0:00:01 0:00:01 --:--:-- 4757k\n==> Copying release into place\n\n$ elixir -v\nNo preset version installed for command erl\nPlease install a version by running one of the following:\n\nasdf install erlang 26.1.1\n\nor add one of the following versions in your config file at /home/ore/elixir/nerves_livebook/.tool-versions\nerlang 26.1.2\n\n$ asdf install erlang 26.1.1\nasdf_26.1.1 is not a kerl-managed Erlang/OTP installation\nNo build named asdf_26.1.1\nDownloading 26.1.1 to /home/ore/.asdf/downloads/erlang/26.1.1...\n % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\n100 102M 100 102M 0 0 7929k 0 0:00:13 0:00:13 --:--:-- 7873k\nExtracting source code\nBuilding Erlang/OTP 26.1.1 (asdf_26.1.1), please wait...\nAPPLICATIONS DISABLED (See: /home/ore/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.1/otp_build_26.1.1.log)\n * jinterface : No Java compiler found\n * odbc : ODBC library - link check failed\n\nAPPLICATIONS INFORMATION (See: /home/ore/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.1/otp_build_26.1.1.log)\n * wx : No OpenGL headers found, wx will NOT be usable\n * No GLU headers found, wx will NOT be usable\n * wxWidgets was not compiled with --enable-webview or wxWebView developer package is not installed, wxWebView will NOT be available\n * wxWidgets must be installed on your system.\n * Please check that wx-config is in path, the directory\n * where wxWidgets libraries are installed (returned by\n * 'wx-config --libs' or 'wx-config --static --libs' command)\n * is in LD_LIBRARY_PATH or equivalent variable and\n * wxWidgets version is 3.0.2 or above.\n\nDOCUMENTATION INFORMATION (See: /home/ore/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.1/otp_build_26.1.1.log)\n * documentation :\n * xsltproc is missing.\n * fop is missing.\n * xmllint is missing.\n * The documentation cannot be built.\n\nErlang/OTP 26.1.1 (asdf_26.1.1) has been successfully built\nCleaning up compilation products for 26.1.1\nCleaned up compilation products for 26.1.1 under /home/ore/.asdf/plugins/erlang/kerl-home/builds\n\n$ elixir -v\nErlang/OTP 26 [erts-14.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]\n\nElixir 1.15.6 (compiled with Erlang/OTP 26)\n\n$ mix deps.get\n** (Mix) Archive \"nerves_bootstrap\" could not be found. Please make sure the archive is installed locally.\n\n$ mix local.hex\nAre you sure you want to install \"https://builds.hex.pm/installs/1.14.0/hex-2.0.6.ez\"? [Yn] y\n* creating /home/ore/.asdf/installs/elixir/1.15.6-otp-26/.mix/archives/hex-2.0.6\n\n$ mix local.rebar\n* creating /home/ore/.asdf/installs/elixir/1.15.6-otp-26/.mix/elixir/1-15/rebar3\nore@DESKTOP-PGIJSCM:~/elixir/nerves_livebook$ mix archive.install hex nerves_bootstrap\nResolving Hex dependencies...\nResolution completed in 0.026s\nNew:\n nerves_bootstrap 1.12.1\n* Getting nerves_bootstrap (Hex package)\nAll dep" <> ...,
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-16T17:51:14+09:00",
"group" => nil,
"id" => "3abb3fda6397a560085b",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-4:42\">wsl(wsl2じゃない)でnervesやってみる。<br>\nqemu(x86_64エミュレータ、ラズパイじゃない)でやってみた。<br>\nnerves_livebookに、手出してみた。</p>\n<h1 data-sourcepos=\"6:1-6:8\">\n<span id=\"環境\" class=\"fragment\"></span><a href=\"#%E7%92%B0%E5%A2%83\"><i class=\"fa fa-link\"></i></a>環境</h1>\n<p data-sourcepos=\"7:1-8:20\">windows 10<br>\nubuntu 20.04LTS(WSL)</p>\n<h1 data-sourcepos=\"10:1-10:8\">\n<span id=\"手順\" class=\"fragment\"></span><a href=\"#%E6%89%8B%E9%A0%86\"><i class=\"fa fa-link\"></i></a>手順</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"12:1-16:3\"><div class=\"highlight\"><pre><code>$ git clone https://github.com/nerves-livebook/nerves_livebook.git\n$ cd nerves_livebook\n\n</code></pre></div></div>\n<h1 data-sourcepos=\"18:1-18:17\">\n<span id=\"エラー発生\" class=\"fragment\"></span><a href=\"#%E3%82%A8%E3%83%A9%E3%83%BC%E7%99%BA%E7%94%9F\"><i class=\"fa fa-link\"></i></a>エラー発生</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"20:1-30:3\"><div class=\"highlight\"><pre><code>$ mix deps.get\nNo preset version installed for command mix\nPlease install a version by running one of the following:\n\nasdf install elixir 1.15.6-otp-26\n\nor add one of the following versions in your config file at /home/ore/elixir/nerves_livebook/.tool-versions\nelixir 1.15.7-otp-26\n\n</code></pre></div></div>\n<h1 data-sourcepos=\"32:1-32:8\">\n<span id=\"対処\" class=\"fragment\"></span><a href=\"#%E5%AF%BE%E5%87%A6\"><i class=\"fa fa-link\"></i></a>対処</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"34:1-416:3\"><div class=\"highlight\"><pre><code>$ asdf install elixir 1.15.6-otp-26\n==> Checking whether specified Elixir release exists...\n==> Downloading 1.15.6-otp-26 to /home/ore/.asdf/downloads/elixir/1.15.6-otp-26/elixir-precompiled-1.15.6-otp-26.zip\n % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n100 6645k 100 6645k 0 0 4757k 0 0:00:01 0:00:01 --:--:-- 4757k\n==> Copying release into place\n\n$ elixir -v\nNo preset version installed for command erl\nPlease install a version by running one of the following:\n\nasdf install erlang 26.1.1\n\nor add one of the following versions in your config file at /home/ore/elixir/nerves_livebook/.tool-versions\nerlang 26.1.2\n\n$ asdf install erlang 26.1.1\nasdf_26.1.1 is not a kerl-managed Erlang/OTP installation\nNo build named asdf_26.1.1\nDownloading 26.1.1 to /home/ore/.asdf/downloads/erlang/26.1.1...\n % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\n100 102M 100 102M 0 0 7929k 0 0:00:13 0:00:13 --:--:-- 7873k\nExtracting source code\nBuilding Erlang/OTP 26.1.1 (asdf_26.1.1), please wait...\nAPPLICATIONS DISABLED (See: /home/ore/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.1/otp_build_26.1.1.log)\n * jinterface : No Java compiler found\n * odbc : ODBC library - link check failed\n\nAPPLICATIONS INFORMATION (See: /home/ore/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.1/otp_build_26.1.1.log)\n * wx : No OpenGL headers found, wx will NOT be usable\n * No GLU headers found, wx will NOT be usable\n * wxWidgets was not compiled with --enable-webview or wxWebView developer package is not installed, wxWebView will NOT be available\n * wxWidgets must be installed on your system.\n * Please check that wx-config is in path, the directory\n * where wxWidgets libraries are installed (returned by\n * 'wx-config --libs' or 'wx-config --static --libs' command)\n * is in LD_LIBRARY_PATH or equivalent variable and\n * wxWidgets version is 3.0.2 or above.\n\nDOCUMENTATION INFORMATION (See: /home/ore/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.1/otp_build_26.1.1.log)\n * documentation :\n * xsltproc is missing.\n * " <> ...,
"slide" => false,
"stocks_count" => 0,
"tags" => [
%{"name" => "Elixir", "versions" => []},
%{"name" => "x86_64", "versions" => []},
%{"name" => "QEMU", "versions" => []},
%{"name" => "Nerves", "versions" => []},
%{"name" => "WSL", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでnerves その19",
"updated_at" => "2023-11-18T05:34:28+09:00",
"url" => "https://qiita.com/ohisama@github/items/3abb3fda6397a560085b",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
"profile_image_url" => "https://secure.gravatar.com/avatar/2e0bb506fbe90e6572bf92fa05db88d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"team_only" => false,
"twitter_screen_name" => nil,
"website_url" => nil
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)でnervesやってみる。\nqemu(x86_64エミュレータ、ラズパイじゃない)でやってみた。\n環境を作り直した。\nqemuで起動した。\n\n# 環境\nwindows 10\nubuntu 20.04LTS(WSL)\n\n# 手順\n\n\n# qemuをインストール\n\n```\nqemu-w64-setup-20220831.exe\n```\n\n# imageを作る。\n\n```\n\n\n\n$ mix local.hex\nAre you sure you want to install \"https://builds.hex.pm/installs/1.14.0/hex-2.0.6.ez\"? [Yn] y\n* creating /home/ore/.asdf/installs/elixir/1.15.7-otp-26/.mix/archives/hex-2.0.6\n\n$ mix local.rebar\n* creating /home/ore/.asdf/installs/elixir/1.15.7-otp-26/.mix/elixir/1-15/rebar3\n\n\n$ mix archive.install hex nerves_bootstrap\nResolving Hex dependencies...\nResolution completed in 0.032s\nNew:\n nerves_bootstrap 1.12.1\n* Getting nerves_bootstrap (Hex package)\nAll dependencies are up to date\nCompiling 5 files (.ex)\nGenerated nerves_bootstrap app\nGenerated archive \"nerves_bootstrap-1.12.1.ez\" with MIX_ENV=prod\nAre you sure you want to install \"nerves_bootstrap-1.12.1.ez\"? [Yn] y\n* creating /home/ore/.asdf/installs/elixir/1.15.7-otp-26/.mix/archives/nerves_bootstrap-1.12.1\n\n$ mix help | grep nerves\nmix local.nerves # Checks for updates to nerves_bootstrap\nmix nerves.new # Creates a new Nerves application\n\n$ mix nerves.new hello_nerves\n* creating hello_nerves/config/config.exs\n* creating hello_nerves/config/host.exs\n* creating hello_nerves/config/target.exs\n* creating hello_nerves/lib/hello_nerves.ex\n* creating hello_nerves/lib/hello_nerves/application.ex\n* creating hello_nerves/test/test_helper.exs\n* creating hello_nerves/test/hello_nerves_test.exs\n* creating hello_nerves/rel/vm.args.eex\n* creating hello_nerves/rootfs_overlay/etc/iex.exs\n* creating hello_nerves/.gitignore\n* creating hello_nerves/.formatter.exs\n* creating hello_nerves/mix.exs\n* creating hello_nerves/README.md\n\nFetch and install dependencies? [Yn] y\n* running mix deps.get\n* running mix format\nYour Nerves project was created successfully.\n\nYou should now pick a target. See https://hexdocs.pm/nerves/targets.html#content\nfor supported targets. If your target is on the list, set `MIX_TARGET`\nto its tag name:\n\nFor example, for the Raspberry Pi 3 you can either\n $ export MIX_TARGET=rpi3\nOr prefix `mix` commands like the following:\n $ MIX_TARGET=rpi3 mix firmware\n\nIf you will be using a custom system, update the `mix.exs`\ndependencies to point to desired system's package.\n\nNow download the dependencies and build a firmware archive:\n $ cd hello_nerves\n $ mix deps.get\n $ mix firmware\n\nIf your target boots up using an SDCard (like the Raspberry Pi 3),\nthen insert an SDCard into a reader on your computer and run:\n $ mix burn\n\nPlug the SDCard into the target and power it up. See target documentation\nabove for more information and other targets.\n\n$ cd hello_nerves\n\n$ export MIX_TARGET=x86_64\n\n$ mix deps.get\nResolving Hex dependencies...\nResolution completed in 0.206s\nUnchanged:\n beam_notify 1.1.0\n castore 1.0.4\n circular_buffer 0.4.1\n elixir_make 0.7.7\n gen_state_machine 3.0.0\n jason 1.4.1\n mdns_lite 0.8.8\n muontrap 1.3.2\n nerves 1.10.4\n nerves_logging 0.2.2\n nerves_motd 0.1.13\n nerves_pack 0.7.0\n nerves_runtime 0.13.6\n nerves_ssh 0.4.3\n nerves_system_bbb 2.19.1\n nerves_system_br 1.24.1\n nerves_system_grisp2 0.8.1\n nerves_system_mangopi_mq_pro 0.6.1\n nerves_system_osd32mp1 0.15.1\n nerves_system_rpi 1.24.1\n nerves_system_rpi0 1.24.1\n nerves_system_rpi2 1.24.1\n nerves_system_rpi3 1.24.1\n nerves_system_rpi3a 1.24.1\n nerves_system_rpi4 1.24.1\n nerves_system_x86_64 1.24.1\n nerves_time 0.4.6\n nerves_toolchain_aarch64_nerves_linux_gnu 1.8.0\n nerves_toolchain_armv6_nerves_linux_gnueabihf 1.8.0\n nerves_toolchain_armv7_nerves_linux_gnueabihf 1.8.0\n nerves_toolchain_ctng 1.9.3\n nerves_toolchain_riscv64_nerves_linux_gnu 1.8.0\n nerves_toolchain_x86_64_nerves_linux_musl 1.8.0\n nerves_uevent 0.1.0\n one_dhcpd 2.0.2\n property_table 0.2.4\n ring_logger 0.10.5\n shoehorn 0.9.1\n ssh_subsystem_fwup 0.6.1\n toolshed 0.3.1\n uboot_env 1.0.1\n vintage_net 0.13.5\n vintage_net_direct 0.10.7\n vintage_net_ethernet 0.11.2\n vintage_net_wifi 0.11.7\nAll dependencies are up to date\n==> jason\nCompiling 10 files (.ex)\nGenerated jason app\n==> " <> ...,
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-15T17:18:32+09:00",
"group" => nil,
"id" => "9c12242a156117b65afd",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-5:22\">wsl(wsl2じゃない)でnervesやってみる。<br>\nqemu(x86_64エミュレータ、ラズパイじゃない)でやってみた。<br>\n環境を作り直した。<br>\nqemuで起動した。</p>\n<h1 data-sourcepos=\"7:1-7:8\">\n<span id=\"環境\" class=\"fragment\"></span><a href=\"#%E7%92%B0%E5%A2%83\"><i class=\"fa fa-link\"></i></a>環境</h1>\n<p data-sourcepos=\"8:1-9:20\">windows 10<br>\nubuntu 20.04LTS(WSL)</p>\n<h1 data-sourcepos=\"11:1-11:8\">\n<span id=\"手順\" class=\"fragment\"></span><a href=\"#%E6%89%8B%E9%A0%86\"><i class=\"fa fa-link\"></i></a>手順</h1>\n<h1 data-sourcepos=\"14:1-14:27\">\n<span id=\"qemuをインストール\" class=\"fragment\"></span><a href=\"#qemu%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB\"><i class=\"fa fa-link\"></i></a>qemuをインストール</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"16:1-18:3\"><div class=\"highlight\"><pre><code>qemu-w64-setup-20220831.exe\n</code></pre></div></div>\n<h1 data-sourcepos=\"20:1-20:19\">\n<span id=\"imageを作る\" class=\"fragment\"></span><a href=\"#image%E3%82%92%E4%BD%9C%E3%82%8B\"><i class=\"fa fa-link\"></i></a>imageを作る。</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"22:1-306:3\"><div class=\"highlight\"><pre><code>\n\n\n$ mix local.hex\nAre you sure you want to install \"https://builds.hex.pm/installs/1.14.0/hex-2.0.6.ez\"? [Yn] y\n* creating /home/ore/.asdf/installs/elixir/1.15.7-otp-26/.mix/archives/hex-2.0.6\n\n$ mix local.rebar\n* creating /home/ore/.asdf/installs/elixir/1.15.7-otp-26/.mix/elixir/1-15/rebar3\n\n\n$ mix archive.install hex nerves_bootstrap\nResolving Hex dependencies...\nResolution completed in 0.032s\nNew:\n nerves_bootstrap 1.12.1\n* Getting nerves_bootstrap (Hex package)\nAll dependencies are up to date\nCompiling 5 files (.ex)\nGenerated nerves_bootstrap app\nGenerated archive \"nerves_bootstrap-1.12.1.ez\" with MIX_ENV=prod\nAre you sure you want to install \"nerves_bootstrap-1.12.1.ez\"? [Yn] y\n* creating /home/ore/.asdf/installs/elixir/1.15.7-otp-26/.mix/archives/nerves_bootstrap-1.12.1\n\n$ mix help | grep nerves\nmix local.nerves # Checks for updates to nerves_bootstrap\nmix nerves.new # Creates a new Nerves application\n\n$ mix nerves.new hello_nerves\n* creating hello_nerves/config/config.exs\n* creating hello_nerves/config/host.exs\n* creating hello_nerves/config/target.exs\n* creating hello_nerves/lib/hello_nerves.ex\n* creating hello_nerves/lib/hello_nerves/application.ex\n* creating hello_nerves/test/test_helper.exs\n* creating hello_nerves/test/hello_nerves_test.exs\n* creating hello_nerves/rel/vm.args.eex\n* creating hello_nerves/rootfs_overlay/etc/iex.exs\n* creating hello_nerves/.gitignore\n* creating hello_nerves/.formatter.exs\n* creating hello_nerves/mix.exs\n* creating hello_nerves/README.md\n\nFetch and install dependencies? [Yn] y\n* running mix deps.get\n* running mix format\nYour Nerves project was created successfully.\n\nYou should now pick a target. See https://hexdocs.pm/nerves/targets.html#content\nfor supported targets. If your target is on the list, set `MIX_TARGET`\nto its tag name:\n\nFor example, for the Raspberry Pi 3 you can either\n $ export MIX_TARGET=rpi3\nOr prefix `mix` commands like the following:\n $ MIX_TARGET=rpi3 mix firmware\n\nIf you will be using a custom system, update the `mix.exs`\ndependencies to point to desired system's package.\n\nNow download the dependencies and build a firmware archive:\n $ cd hello_nerves\n $ mix deps.get\n $ mix firmware\n\nIf your target boots up using an SDCard (like the Raspberry Pi 3),\nthen insert an SDCard into a reader on your computer and run:\n $ mix burn\n\nPlug the SDCard into the target and power it up. See target documentation\nabove for more information and other targets.\n\n$ cd hello_nerves\n\n$ export MIX_TARGET=x86_64\n\n$ mix deps.get\nResolving Hex dependencies...\nResolution completed in 0.206s\nUnchanged:\n beam_notify 1.1.0\n castore 1.0.4\n circular_buffer 0.4.1\n elixir_make 0.7.7\n gen_state_machine 3.0.0\n jason 1.4.1\n mdns_lite 0.8.8\n muontrap 1.3.2\n nerves 1.10.4\n nerves_logging 0.2.2\n nerves_motd 0.1.13\n nerves_pack 0.7.0\n nerves_runtime 0.13.6\n" <> ...,
"slide" => false,
"stocks_count" => 0,
"tags" => [
%{"name" => "Elixir", "versions" => []},
%{"name" => "x86_64", "versions" => []},
%{"name" => "QEMU", "versions" => []},
%{"name" => "Nerves", "versions" => []},
%{"name" => "WSL", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでnerves その18",
"updated_at" => "2023-11-15T17:30:03+09:00",
"url" => "https://qiita.com/ohisama@github/items/9c12242a156117b65afd",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
"profile_image_url" => "https://secure.gravatar.com/avatar/2e0bb506fbe90e6572bf92fa05db88d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"team_only" => false,
"twitter_screen_name" => nil,
"website_url" => nil
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)でnervesやってみる。\nqemu(x86_64エミュレータ、ラズパイじゃない)でやってみた。\n環境を作り直した。\nasdfを導入する。\n\n# 環境\nwindows 10\nubuntu 20.04LTS(WSL)\n\n# 手順\n\n```\n$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.13.1\nCloning into '/home/ore/.asdf'...\nremote: Enumerating objects: 8636, done.\nremote: Counting objects: 100% (549/549), done.\nremote: Compressing objects: 100% (344/344), done.\nremote: Total 8636 (delta 249), reused 441 (delta 194), pack-reused 8087\nReceiving objects: 100% (8636/8636), 2.86 MiB | 9.29 MiB/s, done.\nResolving deltas: 100% (5091/5091), done.\nNote: switching to '0586b37d03031ae8c3110ea2b51cacaad46c7cdc'.\n\nYou are in 'detached HEAD' state. You can look around, make experimental\nchanges and commit them, and you can discard any commits you make in this\nstate without impacting any branches by switching back to a branch.\n\nIf you want to create a new branch to retain commits you create, you may\ndo so (now or later) by using -c with the switch command. Example:\n\n git switch -c <new-branch-name>\n\nOr undo this operation with:\n\n git switch -\n\nTurn off this advice by setting config variable advice.detachedHead to false\n\n$ . \"$HOME/.asdf/asdf.sh\"\n$ asdf plugin add erlang\ninitializing plugin repository...Cloning into '/home/ore/.asdf/repository'...\nremote: Enumerating objects: 5553, done.\nremote: Counting objects: 100% (144/144), done.\nremote: Compressing objects: 100% (66/66), done.\nremote: Total 5553 (delta 80), reused 139 (delta 78), pack-reused 5409\nReceiving objects: 100% (5553/5553), 1.30 MiB | 14.33 MiB/s, done.\nResolving deltas: 100% (3003/3003), done.\n\n$ asdf list-all erlang\nR13B03\nR13B04\nR14A\nR14B\nR14B01\nR14B02\nR14B03\nR14B04\nR15A\nR15B\nR15B01\nR15B02\nR15B03\nR15B03-1\nR16A_RELEASE_CANDIDATE\nR16B\nR16B01\nR16B01_RC1\nR16B02\nR16B03\nR16B03-1\nR16B03_yielding_binary_to_term\n17.0-rc1\n17.0-rc2\n17.0\n17.0.1\n17.0.2\n17.1\n17.1.1\n17.1.2\n17.2\n17.2.1\n17.2.2\n17.3\n17.3.1\n17.3.2\n17.3.3\n17.3.4\n17.4\n17.4.1\n17.5\n17.5.1\n17.5.2\n17.5.3\n17.5.4\n17.5.5\n17.5.6\n17.5.6.1\n17.5.6.2\n17.5.6.3\n17.5.6.4\n17.5.6.5\n17.5.6.6\n17.5.6.7\n17.5.6.8\n17.5.6.9\n17.5.6.10\n18.0-rc1\n18.0-rc2\n18.0\n18.0.1\n18.0.2\n18.0.3\n18.1\n18.1.1\n18.1.2\n18.1.3\n18.1.4\n18.1.5\n18.2\n18.2.1\n18.2.2\n18.2.3\n18.2.4.0.1\n18.2.4\n18.2.4.1\n18.3\n18.3.1\n18.3.2\n18.3.3\n18.3.4\n18.3.4.1\n18.3.4.1.1\n18.3.4.2\n18.3.4.3\n18.3.4.4\n18.3.4.5\n18.3.4.6\n18.3.4.7\n18.3.4.8\n18.3.4.9\n18.3.4.10\n18.3.4.11\n19.0-rc1\n19.0-rc2\n19.0\n19.0.1\n19.0.2\n19.0.3\n19.0.4\n19.0.5\n19.0.6\n19.0.7\n19.1\n19.1.1\n19.1.2\n19.1.3\n19.1.4\n19.1.5\n19.1.6\n19.1.6.1\n19.2\n19.2.1\n19.2.2\n19.2.3\n19.2.3.1\n19.3\n19.3.1\n19.3.2\n19.3.3\n19.3.4\n19.3.5\n19.3.6\n19.3.6.1\n19.3.6.2\n19.3.6.3\n19.3.6.4\n19.3.6.5\n19.3.6.6\n19.3.6.7\n19.3.6.8\n19.3.6.9\n19.3.6.10\n19.3.6.11\n19.3.6.12\n19.3.6.13\n20.0-rc1\n20.0-rc2\n20.0\n20.0.1\n20.0.2\n20.0.3\n20.0.4\n20.0.5\n20.1\n20.1.1\n20.1.2\n20.1.3\n20.1.4\n20.1.5\n20.1.6\n20.1.7\n20.1.7.1\n20.2.0.1\n20.2\n20.2.1\n20.2.2\n20.2.3\n20.2.4\n20.3\n20.3.1\n20.3.2\n20.3.2.1\n20.3.3\n20.3.4\n20.3.5\n20.3.6\n20.3.7\n20.3.8\n20.3.8.1\n20.3.8.2\n20.3.8.3\n20.3.8.4\n20.3.8.5\n20.3.8.6\n20.3.8.7\n20.3.8.8\n20.3.8.9\n20.3.8.10\n20.3.8.11\n20.3.8.12\n20.3.8.13\n20.3.8.14\n20.3.8.15\n20.3.8.16\n20.3.8.17\n20.3.8.18\n20.3.8.19\n20.3.8.20\n20.3.8.21\n20.3.8.22\n20.3.8.23\n20.3.8.24\n20.3.8.25\n20.3.8.26\n21.0-rc1\n21.0-rc2\n21.0\n21.0.1\n21.0.2\n21.0.3\n21.0.4\n21.0.5\n21.0.6\n21.0.7\n21.0.8\n21.0.9\n21.1\n21.1.1\n21.1.2\n21.1.3\n21.1.4\n21.2\n21.2.1\n21.2.2\n21.2.3\n21.2.4\n21.2.5\n21.2.6\n21.2.7\n21.3\n21.3.1\n21.3.2\n21.3.3\n21.3.4\n21.3.5\n21.3.6\n21.3.7\n21.3.7.1\n21.3.8\n21.3.8.1\n21.3.8.2\n21.3.8.3\n21.3.8.4\n21.3.8.5\n21.3.8.6\n21.3.8.7\n21.3.8.8\n21.3.8.9\n21.3.8.10\n21.3.8.11\n21.3.8.12\n21.3.8.13\n21.3.8.14\n21.3.8.15\n21.3.8.16\n21.3.8.17\n21.3.8.18\n21.3.8.19\n21.3.8.20\n21.3.8.21\n21.3.8.22\n21.3.8.23\n21.3.8.24\n22.0-rc1\n22.0-rc2\n22.0-rc3\n22.0\n22.0.1\n22.0.2\n22.0.3\n22.0.4\n22.0.5\n22.0.6\n22.0.7\n22.1\n22.1.1\n22.1.2\n22.1.3\n22.1.4\n22.1.5\n22.1.6\n22.1.7\n22.1.8\n22.1.8.1\n22.2\n22.2.1\n22.2.2\n22.2.3\n22.2.4\n22.2.5\n22.2.6\n22.2.7\n22.2.8\n22.3\n22.3.1\n22.3.2\n22.3.3\n22.3.4\n22.3.4.1\n22.3.4.2\n22.3.4.3\n22.3.4.4\n22.3.4.5\n22.3.4.6\n22.3.4.7\n22.3.4.8\n22.3.4.9\n22.3.4.10\n22.3.4.11\n22.3.4.12\n22.3.4.12.1\n22.3.4.13\n22.3.4.14\n22.3.4.15\n22.3.4.16\n22.3.4.17\n22.3.4.18\n22.3.4.19\n22.3.4.20\n22.3.4.21\n2" <> ...,
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-15T08:29:49+09:00",
"group" => nil,
"id" => "7ed00d0fe4203afc9a4f",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-5:22\">wsl(wsl2じゃない)でnervesやってみる。<br>\nqemu(x86_64エミュレータ、ラズパイじゃない)でやってみた。<br>\n環境を作り直した。<br>\nasdfを導入する。</p>\n<h1 data-sourcepos=\"7:1-7:8\">\n<span id=\"環境\" class=\"fragment\"></span><a href=\"#%E7%92%B0%E5%A2%83\"><i class=\"fa fa-link\"></i></a>環境</h1>\n<p data-sourcepos=\"8:1-9:20\">windows 10<br>\nubuntu 20.04LTS(WSL)</p>\n<h1 data-sourcepos=\"11:1-11:8\">\n<span id=\"手順\" class=\"fragment\"></span><a href=\"#%E6%89%8B%E9%A0%86\"><i class=\"fa fa-link\"></i></a>手順</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"13:1-940:3\"><div class=\"highlight\"><pre><code>$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.13.1\nCloning into '/home/ore/.asdf'...\nremote: Enumerating objects: 8636, done.\nremote: Counting objects: 100% (549/549), done.\nremote: Compressing objects: 100% (344/344), done.\nremote: Total 8636 (delta 249), reused 441 (delta 194), pack-reused 8087\nReceiving objects: 100% (8636/8636), 2.86 MiB | 9.29 MiB/s, done.\nResolving deltas: 100% (5091/5091), done.\nNote: switching to '0586b37d03031ae8c3110ea2b51cacaad46c7cdc'.\n\nYou are in 'detached HEAD' state. You can look around, make experimental\nchanges and commit them, and you can discard any commits you make in this\nstate without impacting any branches by switching back to a branch.\n\nIf you want to create a new branch to retain commits you create, you may\ndo so (now or later) by using -c with the switch command. Example:\n\n git switch -c <new-branch-name>\n\nOr undo this operation with:\n\n git switch -\n\nTurn off this advice by setting config variable advice.detachedHead to false\n\n$ . \"$HOME/.asdf/asdf.sh\"\n$ asdf plugin add erlang\ninitializing plugin repository...Cloning into '/home/ore/.asdf/repository'...\nremote: Enumerating objects: 5553, done.\nremote: Counting objects: 100% (144/144), done.\nremote: Compressing objects: 100% (66/66), done.\nremote: Total 5553 (delta 80), reused 139 (delta 78), pack-reused 5409\nReceiving objects: 100% (5553/5553), 1.30 MiB | 14.33 MiB/s, done.\nResolving deltas: 100% (3003/3003), done.\n\n$ asdf list-all erlang\nR13B03\nR13B04\nR14A\nR14B\nR14B01\nR14B02\nR14B03\nR14B04\nR15A\nR15B\nR15B01\nR15B02\nR15B03\nR15B03-1\nR16A_RELEASE_CANDIDATE\nR16B\nR16B01\nR16B01_RC1\nR16B02\nR16B03\nR16B03-1\nR16B03_yielding_binary_to_term\n17.0-rc1\n17.0-rc2\n17.0\n17.0.1\n17.0.2\n17.1\n17.1.1\n17.1.2\n17.2\n17.2.1\n17.2.2\n17.3\n17.3.1\n17.3.2\n17.3.3\n17.3.4\n17.4\n17.4.1\n17.5\n17.5.1\n17.5.2\n17.5.3\n17.5.4\n17.5.5\n17.5.6\n17.5.6.1\n17.5.6.2\n17.5.6.3\n17.5.6.4\n17.5.6.5\n17.5.6.6\n17.5.6.7\n17.5.6.8\n17.5.6.9\n17.5.6.10\n18.0-rc1\n18.0-rc2\n18.0\n18.0.1\n18.0.2\n18.0.3\n18.1\n18.1.1\n18.1.2\n18.1.3\n18.1.4\n18.1.5\n18.2\n18.2.1\n18.2.2\n18.2.3\n18.2.4.0.1\n18.2.4\n18.2.4.1\n18.3\n18.3.1\n18.3.2\n18.3.3\n18.3.4\n18.3.4.1\n18.3.4.1.1\n18.3.4.2\n18.3.4.3\n18.3.4.4\n18.3.4.5\n18.3.4.6\n18.3.4.7\n18.3.4.8\n18.3.4.9\n18.3.4.10\n18.3.4.11\n19.0-rc1\n19.0-rc2\n19.0\n19.0.1\n19.0.2\n19.0.3\n19.0.4\n19.0.5\n19.0.6\n19.0.7\n19.1\n19.1.1\n19.1.2\n19.1.3\n19.1.4\n19.1.5\n19.1.6\n19.1.6.1\n19.2\n19.2.1\n19.2.2\n19.2.3\n19.2.3.1\n19.3\n19.3.1\n19.3.2\n19.3.3\n19.3.4\n19.3.5\n19.3.6\n19.3.6.1\n19.3.6.2\n19.3.6.3\n19.3.6.4\n19.3.6.5\n19.3.6.6\n19.3.6.7\n19.3.6.8\n19.3.6.9\n19.3.6.10\n19.3.6.11\n19.3.6.12\n19.3.6.13\n20.0-rc1\n20.0-rc2\n20.0\n20.0.1\n20.0.2\n20.0.3\n20.0.4\n20.0.5\n20.1\n20.1.1\n20.1.2\n20.1.3\n20.1.4\n20.1.5\n20.1.6\n20.1.7\n20.1.7.1\n20.2.0.1\n20.2\n20.2.1\n20.2.2\n20.2.3\n20.2.4\n20.3\n20.3.1\n20.3.2\n20.3.2.1\n20.3.3\n20.3.4\n20.3.5\n20.3.6\n20.3.7\n20.3.8\n20.3.8.1\n20.3.8.2\n20.3.8.3\n20.3.8.4\n20.3.8.5\n20.3.8.6\n20.3.8.7\n20.3.8.8\n20.3.8.9\n20.3.8.10\n20.3.8.11\n20.3.8.12\n20.3.8.13\n20.3.8.14\n20.3.8.15\n20.3.8.16\n20.3.8.17\n20.3.8.18\n20.3.8.19\n20.3.8.20\n20.3.8.21\n20.3.8.22\n20.3.8.23\n20.3.8.24\n20.3.8.25\n20.3.8.26\n21.0-rc1\n21.0-rc2\n21.0\n21.0.1\n21.0.2\n21.0.3\n21.0.4\n21.0.5\n21.0.6\n21.0.7\n21.0.8\n21.0.9\n21.1\n21.1.1\n21.1.2\n21.1.3\n21.1.4\n21.2\n21.2.1\n21.2.2\n21.2.3\n21.2.4\n21.2.5\n21.2.6\n21.2.7\n21.3\n21.3.1\n21.3.2\n21.3.3\n21.3.4\n21.3.5\n21.3.6\n21.3.7\n21.3.7.1\n21.3.8\n21.3.8.1\n21.3.8.2\n21.3.8.3\n21.3.8.4\n21.3.8.5\n21.3.8.6\n21.3.8.7\n21.3.8.8\n21.3.8.9\n21.3.8.10\n21.3.8.11\n21.3.8.12\n" <> ...,
"slide" => false,
"stocks_count" => 1,
"tags" => [
%{"name" => "Elixir", "versions" => []},
%{"name" => "x86_64", "versions" => []},
%{"name" => "QEMU", "versions" => []},
%{"name" => "Nerves", "versions" => []},
%{"name" => "WSL", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでnerves その17",
"updated_at" => "2023-11-15T08:35:13+09:00",
"url" => "https://qiita.com/ohisama@github/items/7ed00d0fe4203afc9a4f",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
"profile_image_url" => "https://secure.gravatar.com/avatar/2e0bb506fbe90e6572bf92fa05db88d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"team_only" => false,
"twitter_screen_name" => nil,
"website_url" => nil
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)でnervesやってみる。\nqemu(x86_64エミュレータ、ラズパイじゃない)でやってみた。\n環境を作り直した。\n失敗編\n\n# 環境\nwindows 10\nubuntu 20.04LTS(WSL)\n\n# elixir -v\n```\nErlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]\n\nElixir 1.14.5 (compiled with Erlang/OTP 25)\n```\n\n# 手順 aptできるものインストール\n\n```\n$ sudo apt update\n$ sudo apt install build-essential automake autoconf git squashfs-tools ssh-askpass pkg-config curl libmnl-dev\n```\n# 手順 mixできるものインストール\n\n```\n$ mix local.hex\nFound existing entry: /home/ore/.mix/archives/hex-2.0.6\nAre you sure you want to replace it with \"https://repo.hex.pm/installs/1.14.0/hex-2.0.6.ez\"? [Yn] y\n* creating .mix/archives/hex-2.0.6\n\n$ mix local.rebar\n.mix/elixir/1-14/rebar3 already exists, overwrite? [Yn] y\n* creating .mix/elixir/1-14/rebar3\n\n$ mix archive.install hex nerves_bootstrap\nResolving Hex dependencies...\nResolution completed in 0.041s\nNew:\n nerves_bootstrap 1.12.1\n* Getting nerves_bootstrap (Hex package)\nAll dependencies are up to date\nCompiling 5 files (.ex)\nGenerated nerves_bootstrap app\nGenerated archive \"nerves_bootstrap-1.12.1.ez\" with MIX_ENV=prod\nAre you sure you want to install \"nerves_bootstrap-1.12.1.ez\"? [Yn] y\n* creating /home/ore/.mix/archives/nerves_bootstrap-1.12.1\n\n\n$ mix help | grep nerves\nmix local.nerves # Checks for updates to nerves_bootstrap\nmix nerves.new # Creates a new Nerves application\n\n\n$ export MIX_TARGET=x86_64\n$ mix nerves.new hello_nerves\n* creating hello_nerves/config/config.exs\n* creating hello_nerves/config/host.exs\n* creating hello_nerves/config/target.exs\n* creating hello_nerves/lib/hello_nerves.ex\n* creating hello_nerves/lib/hello_nerves/application.ex\n* creating hello_nerves/test/test_helper.exs\n* creating hello_nerves/test/hello_nerves_test.exs\n* creating hello_nerves/rel/vm.args.eex\n* creating hello_nerves/rootfs_overlay/etc/iex.exs\n* creating hello_nerves/.gitignore\n* creating hello_nerves/.formatter.exs\n* creating hello_nerves/mix.exs\n* creating hello_nerves/README.md\n\nFetch and install dependencies? [Yn] y\n* running mix deps.get\n* running mix format\nYour Nerves project was created successfully.\n\nYou should now pick a target. See https://hexdocs.pm/nerves/targets.html#content\nfor supported targets. If your target is on the list, set `MIX_TARGET`\nto its tag name:\n\nFor example, for the Raspberry Pi 3 you can either\n $ export MIX_TARGET=rpi3\nOr prefix `mix` commands like the following:\n $ MIX_TARGET=rpi3 mix firmware\n\nIf you will be using a custom system, update the `mix.exs`\ndependencies to point to desired system's package.\n\nNow download the dependencies and build a firmware archive:\n $ cd hello_nerves\n $ mix deps.get\n $ mix firmware\n\nIf your target boots up using an SDCard (like the Raspberry Pi 3),\nthen insert an SDCard into a reader on your computer and run:\n $ mix burn\n\nPlug the SDCard into the target and power it up. See target documentation\nabove for more information and other targets.\n$ cd hello_nerves\n$ mix deps.get\nResolving Hex dependencies...\nResolution completed in 0.287s\nUnchanged:\n beam_notify 1.1.0\n castore 1.0.4\n circular_buffer 0.4.1\n elixir_make 0.7.7\n gen_state_machine 3.0.0\n jason 1.4.1\n mdns_lite 0.8.8\n muontrap 1.3.2\n nerves 1.10.4\n nerves_logging 0.2.2\n nerves_motd 0.1.13\n nerves_pack 0.7.0\n nerves_runtime 0.13.6\n nerves_ssh 0.4.3\n nerves_system_bbb 2.19.1\n nerves_system_br 1.24.1\n nerves_system_grisp2 0.8.1\n nerves_system_mangopi_mq_pro 0.6.1\n nerves_system_osd32mp1 0.15.1\n nerves_system_rpi 1.24.1\n nerves_system_rpi0 1.24.1\n nerves_system_rpi2 1.24.1\n nerves_system_rpi3 1.24.1\n nerves_system_rpi3a 1.24.1\n nerves_system_rpi4 1.24.1\n nerves_system_x86_64 1.24.1\n nerves_time 0.4.6\n nerves_toolchain_aarch64_nerves_linux_gnu 1.8.0\n nerves_toolchain_armv6_nerves_linux_gnueabihf 1.8.0\n nerves_toolchain_armv7_nerves_linux_gnueabihf 1.8.0\n nerves_toolchain_ctng 1.9.3\n nerves_toolchain_riscv64_nerves_linux_gnu 1.8.0\n nerves_toolchain_x86_64_nerves_linux_musl 1.8.0\n nerves_uevent 0.1.0\n one_dhcpd 2.0.2\n property_table 0.2.4\n ring_logger 0.10.5\n shoehorn 0.9.1\n ssh_subs" <> ...,
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-15T08:12:12+09:00",
"group" => nil,
"id" => "087842b206f61ddccc57",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-5:9\">wsl(wsl2じゃない)でnervesやってみる。<br>\nqemu(x86_64エミュレータ、ラズパイじゃない)でやってみた。<br>\n環境を作り直した。<br>\n失敗編</p>\n<h1 data-sourcepos=\"7:1-7:8\">\n<span id=\"環境\" class=\"fragment\"></span><a href=\"#%E7%92%B0%E5%A2%83\"><i class=\"fa fa-link\"></i></a>環境</h1>\n<p data-sourcepos=\"8:1-9:20\">windows 10<br>\nubuntu 20.04LTS(WSL)</p>\n<h1 data-sourcepos=\"11:1-11:11\">\n<span id=\"elixir--v\" class=\"fragment\"></span><a href=\"#elixir--v\"><i class=\"fa fa-link\"></i></a>elixir -v</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"12:1-16:3\"><div class=\"highlight\"><pre><code>Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]\n\nElixir 1.14.5 (compiled with Erlang/OTP 25)\n</code></pre></div></div>\n<h1 data-sourcepos=\"18:1-18:45\">\n<span id=\"手順-aptできるものインストール\" class=\"fragment\"></span><a href=\"#%E6%89%8B%E9%A0%86-apt%E3%81%A7%E3%81%8D%E3%82%8B%E3%82%82%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB\"><i class=\"fa fa-link\"></i></a>手順 aptできるものインストール</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"20:1-23:3\"><div class=\"highlight\"><pre><code>$ sudo apt update\n$ sudo apt install build-essential automake autoconf git squashfs-tools ssh-askpass pkg-config curl libmnl-dev\n</code></pre></div></div>\n<h1 data-sourcepos=\"24:1-24:45\">\n<span id=\"手順-mixできるものインストール\" class=\"fragment\"></span><a href=\"#%E6%89%8B%E9%A0%86-mix%E3%81%A7%E3%81%8D%E3%82%8B%E3%82%82%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB\"><i class=\"fa fa-link\"></i></a>手順 mixできるものインストール</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"26:1-179:3\"><div class=\"highlight\"><pre><code>$ mix local.hex\nFound existing entry: /home/ore/.mix/archives/hex-2.0.6\nAre you sure you want to replace it with \"https://repo.hex.pm/installs/1.14.0/hex-2.0.6.ez\"? [Yn] y\n* creating .mix/archives/hex-2.0.6\n\n$ mix local.rebar\n.mix/elixir/1-14/rebar3 already exists, overwrite? [Yn] y\n* creating .mix/elixir/1-14/rebar3\n\n$ mix archive.install hex nerves_bootstrap\nResolving Hex dependencies...\nResolution completed in 0.041s\nNew:\n nerves_bootstrap 1.12.1\n* Getting nerves_bootstrap (Hex package)\nAll dependencies are up to date\nCompiling 5 files (.ex)\nGenerated nerves_bootstrap app\nGenerated archive \"nerves_bootstrap-1.12.1.ez\" with MIX_ENV=prod\nAre you sure you want to install \"nerves_bootstrap-1.12.1.ez\"? [Yn] y\n* creating /home/ore/.mix/archives/nerves_bootstrap-1.12.1\n\n\n$ mix help | grep nerves\nmix local.nerves # Checks for updates to nerves_bootstrap\nmix nerves.new # Creates a new Nerves application\n\n\n$ export MIX_TARGET=x86_64\n$ mix nerves.new hello_nerves\n* creating hello_nerves/config/config.exs\n* creating hello_nerves/config/host.exs\n* creating hello_nerves/config/target.exs\n* creating hello_nerves/lib/hello_nerves.ex\n* creating hello_nerves/lib/hello_nerves/application.ex\n* creating hello_nerves/test/test_helper.exs\n* creating hello_nerves/test/hello_nerves_test.exs\n* creating hello_nerves/rel/vm.args.eex\n* creating hello_nerves/rootfs_overlay/etc/iex.exs\n* creating hello_nerves/.gitignore\n* creating hello_nerves/.formatter.exs\n* creating hello_nerves/mix.exs\n* creating hello_nerves/README.md\n\nFetch and install dependencies? [Yn] y\n* running mix deps.get\n* running mix format\nYour Nerves project was created successfully.\n\nYou should now pick a target. See https://hexdocs.pm/nerves/targets.html#content\nfor supported targets. If your target is on the list, set `MIX_TARGET`\nto its tag name:\n\nFor example, for the Raspberry Pi 3 you can either\n $ export MIX_TARGET=rpi3\nOr prefix `mix` commands like the following:\n $ MIX_TARGET=rpi3 mix firmware\n\nIf you will be using a custom system, update the `mix.exs`\ndependencies to point to desired system's package.\n\nNow download the dependencies and build a firmware archive:\n $ cd hello_nerves\n $ mix deps.get\n $ mix firmware\n\nIf your target boots up using an SDCard (like the Raspberry Pi 3),\nthen insert an SDCard into a reade" <> ...,
"slide" => false,
"stocks_count" => 0,
"tags" => [
%{"name" => "Elixir", "versions" => []},
%{"name" => "x86_64", "versions" => []},
%{"name" => "QEMU", "versions" => []},
%{"name" => "Nerves", "versions" => []},
%{"name" => "WSL", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでnerves その16",
"updated_at" => "2023-11-15T08:16:14+09:00",
"url" => "https://qiita.com/ohisama@github/items/087842b206f61ddccc57",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
"profile_image_url" => "https://secure.gravatar.com/avatar/2e0bb506fbe90e6572bf92fa05db88d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"team_only" => false,
"twitter_screen_name" => nil,
"website_url" => nil
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)で、elixirやってみた。\n練習問題、やってみた。\n\n# 練習問題\nqiita api叩いて、smart data transformで表示せよ。\n\n# 写真\n\n![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/a69cc79d-9302-953b-0f60-e5727efed351.png)\n\n\n# サンプルコード\n\n```\nmy_data = Req.get!(\"https://qiita.com/api/v2/users/ohisama@github/items\")\n |> Map.get(:body)\n |> Enum.map(& Map.take(&1, [\"title\", \"url\"]))\n\n```\n\n以上。\n\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-14T11:16:31+09:00",
"group" => nil,
"id" => "fd5cc203170991fbc9b6",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-3:33\">wsl(wsl2じゃない)で、elixirやってみた。<br>\n練習問題、やってみた。</p>\n<h1 data-sourcepos=\"5:1-5:14\">\n<span id=\"練習問題\" class=\"fragment\"></span><a href=\"#%E7%B7%B4%E7%BF%92%E5%95%8F%E9%A1%8C\"><i class=\"fa fa-link\"></i></a>練習問題</h1>\n<p data-sourcepos=\"6:1-6:59\">qiita api叩いて、smart data transformで表示せよ。</p>\n<h1 data-sourcepos=\"8:1-8:8\">\n<span id=\"写真\" class=\"fragment\"></span><a href=\"#%E5%86%99%E7%9C%9F\"><i class=\"fa fa-link\"></i></a>写真</h1>\n<p data-sourcepos=\"10:1-10:120\"><a href=\"https://camo.qiitausercontent.com/3d672befa803dc2df49f10266aa475ae6394f598/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f31383130342f61363963633739642d393330322d393533622d306636302d6535373237656665643335312e706e67\" target=\"_blank\" rel=\"nofollow noopener\"><img src=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2Fa69cc79d-9302-953b-0f60-e5727efed351.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=4b66df3220d5b49fa064c833f9f1f9fb\" alt=\"image.png\" data-canonical-src=\"https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/a69cc79d-9302-953b-0f60-e5727efed351.png\" srcset=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2Fa69cc79d-9302-953b-0f60-e5727efed351.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&w=1400&fit=max&s=c5d9a60d9d5b7406a6318848fa92c470 1x\" loading=\"lazy\"></a></p>\n<h1 data-sourcepos=\"13:1-13:23\">\n<span id=\"サンプルコード\" class=\"fragment\"></span><a href=\"#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%B3%E3%83%BC%E3%83%89\"><i class=\"fa fa-link\"></i></a>サンプルコード</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"15:1-20:3\"><div class=\"highlight\"><pre><code>my_data = Req.get!(\"https://qiita.com/api/v2/users/ohisama@github/items\")\n |> Map.get(:body)\n |> Enum.map(& Map.take(&1, [\"title\", \"url\"]))\n\n</code></pre></div></div>\n<p data-sourcepos=\"22:1-22:9\">以上。</p>\n",
"slide" => false,
"stocks_count" => 1,
"tags" => [
%{"name" => "QiitaAPI", "versions" => []},
%{"name" => "Elixir", "versions" => []},
%{"name" => "WSL", "versions" => []},
%{"name" => "Livebook", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでelixir その104",
"updated_at" => "2023-11-14T11:16:31+09:00",
"url" => "https://qiita.com/ohisama@github/items/fd5cc203170991fbc9b6",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
"profile_image_url" => "https://secure.gravatar.com/avatar/2e0bb506fbe90e6572bf92fa05db88d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"team_only" => false,
"twitter_screen_name" => nil,
"website_url" => nil
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)で、elixirやってみた。\n練習問題、やってみた。\n\n# 練習問題\nqiita api叩いて、dataframeで表示せよ。\n\n# 写真\n\n![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/63bb4dc0-6a8a-b9fb-9895-5aa43bf5c093.png)\n\n\n# サンプルコード\n\n```\nReq.get!(\"https://qiita.com/api/v2/users/ohisama@github/items\")\n|> Map.get(:body)\n|> Enum.map(& Map.take(&1, [\"title\", \"url\"]))\n|> Explorer.DataFrame.new()\n\n```\n\n\n以上。\n\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-14T10:45:11+09:00",
"group" => nil,
"id" => "704dea4b53ba1e54bf62",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-3:33\">wsl(wsl2じゃない)で、elixirやってみた。<br>\n練習問題、やってみた。</p>\n<h1 data-sourcepos=\"5:1-5:14\">\n<span id=\"練習問題\" class=\"fragment\"></span><a href=\"#%E7%B7%B4%E7%BF%92%E5%95%8F%E9%A1%8C\"><i class=\"fa fa-link\"></i></a>練習問題</h1>\n<p data-sourcepos=\"6:1-6:48\">qiita api叩いて、dataframeで表示せよ。</p>\n<h1 data-sourcepos=\"8:1-8:8\">\n<span id=\"写真\" class=\"fragment\"></span><a href=\"#%E5%86%99%E7%9C%9F\"><i class=\"fa fa-link\"></i></a>写真</h1>\n<p data-sourcepos=\"10:1-10:120\"><a href=\"https://camo.qiitausercontent.com/594e89f1ddd699e2d47c6c784bacd6a642c143f6/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f31383130342f36336262346463302d366138612d623966622d393839352d3561613433626635633039332e706e67\" target=\"_blank\" rel=\"nofollow noopener\"><img src=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2F63bb4dc0-6a8a-b9fb-9895-5aa43bf5c093.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=8c67741c9e2536d6d1b5e13d2f0f477a\" alt=\"image.png\" data-canonical-src=\"https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/63bb4dc0-6a8a-b9fb-9895-5aa43bf5c093.png\" srcset=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2F63bb4dc0-6a8a-b9fb-9895-5aa43bf5c093.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&w=1400&fit=max&s=846b5c48a16432cacd2615aea17f0e06 1x\" loading=\"lazy\"></a></p>\n<h1 data-sourcepos=\"13:1-13:23\">\n<span id=\"サンプルコード\" class=\"fragment\"></span><a href=\"#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%B3%E3%83%BC%E3%83%89\"><i class=\"fa fa-link\"></i></a>サンプルコード</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"15:1-21:3\"><div class=\"highlight\"><pre><code>Req.get!(\"https://qiita.com/api/v2/users/ohisama@github/items\")\n|> Map.get(:body)\n|> Enum.map(& Map.take(&1, [\"title\", \"url\"]))\n|> Explorer.DataFrame.new()\n\n</code></pre></div></div>\n<p data-sourcepos=\"24:1-24:9\">以上。</p>\n",
"slide" => false,
"stocks_count" => 0,
"tags" => [
%{"name" => "QiitaAPI", "versions" => []},
%{"name" => "Elixir", "versions" => []},
%{"name" => "WSL", "versions" => []},
%{"name" => "Livebook", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでelixir その103",
"updated_at" => "2023-11-14T10:46:04+09:00",
"url" => "https://qiita.com/ohisama@github/items/704dea4b53ba1e54bf62",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
"profile_image_url" => "https://secure.gravatar.com/avatar/2e0bb506fbe90e6572bf92fa05db88d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"team_only" => false,
"twitter_screen_name" => nil,
"website_url" => nil
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)で、elixirやってみた。\n練習問題、やってみた。\n\n# 練習問題\nグローバルIPアドレスを求めよ。\n\n# 方針\n- req使う。\n- checkip使う。\n\n\n# サンプルコード\n\n```\nReq.get!(\"https://checkip.amazonaws.com\")\n|> Map.get(:body)\n\n```\n\n以上。\n\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-14T10:15:21+09:00",
"group" => nil,
"id" => "78d7b0f86cdb690dfb62",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-3:33\">wsl(wsl2じゃない)で、elixirやってみた。<br>\n練習問題、やってみた。</p>\n<h1 data-sourcepos=\"5:1-5:14\">\n<span id=\"練習問題\" class=\"fragment\"></span><a href=\"#%E7%B7%B4%E7%BF%92%E5%95%8F%E9%A1%8C\"><i class=\"fa fa-link\"></i></a>練習問題</h1>\n<p data-sourcepos=\"6:1-6:44\">グローバルIPアドレスを求めよ。</p>\n<h1 data-sourcepos=\"8:1-8:8\">\n<span id=\"方針\" class=\"fragment\"></span><a href=\"#%E6%96%B9%E9%87%9D\"><i class=\"fa fa-link\"></i></a>方針</h1>\n<ul data-sourcepos=\"9:1-12:0\">\n<li data-sourcepos=\"9:1-9:14\">req使う。</li>\n<li data-sourcepos=\"10:1-12:0\">checkip使う。</li>\n</ul>\n<h1 data-sourcepos=\"13:1-13:23\">\n<span id=\"サンプルコード\" class=\"fragment\"></span><a href=\"#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%B3%E3%83%BC%E3%83%89\"><i class=\"fa fa-link\"></i></a>サンプルコード</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"15:1-19:3\"><div class=\"highlight\"><pre><code>Req.get!(\"https://checkip.amazonaws.com\")\n|> Map.get(:body)\n\n</code></pre></div></div>\n<p data-sourcepos=\"21:1-21:9\">以上。</p>\n",
"slide" => false,
"stocks_count" => 0,
"tags" => [
%{"name" => "Elixir", "versions" => []},
%{"name" => "WSL", "versions" => []},
%{"name" => "Livebook", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでelixir その102",
"updated_at" => "2023-11-14T10:32:59+09:00",
"url" => "https://qiita.com/ohisama@github/items/78d7b0f86cdb690dfb62",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
"profile_image_url" => "https://secure.gravatar.com/avatar/2e0bb506fbe90e6572bf92fa05db88d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"team_only" => false,
"twitter_screen_name" => nil,
"website_url" => nil
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)で、elixirやってみた。\n練習問題、やってみた。\n\n# 練習問題\nLivebookで、smart chartを使え。\n\n# 写真\n\n![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/c705ef0a-b51a-5218-3e7c-29e97cdc7db6.png)\n\n# サンプルコード\n\n```\ny =\n 1..100\n |> Enum.map(fn x ->\n :math.sin(x / 5)\n end)\n\nx =\n 1..100\n |> Enum.map(fn x ->\n x\n end)\n\nmy_data = %{x: x, y: y}\n\n```\n\n\n以上。\n\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-13T18:59:32+09:00",
"group" => nil,
"id" => "bb60e3e5748dd7165b4a",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-3:33\">wsl(wsl2じゃない)で、elixirやってみた。<br>\n練習問題、やってみた。</p>\n<h1 data-sourcepos=\"5:1-5:14\">\n<span id=\"練習問題\" class=\"fragment\"></span><a href=\"#%E7%B7%B4%E7%BF%92%E5%95%8F%E9%A1%8C\"><i class=\"fa fa-link\"></i></a>練習問題</h1>\n<p data-sourcepos=\"6:1-6:37\">Livebookで、smart chartを使え。</p>\n<h1 data-sourcepos=\"8:1-8:8\">\n<span id=\"写真\" class=\"fragment\"></span><a href=\"#%E5%86%99%E7%9C%9F\"><i class=\"fa fa-link\"></i></a>写真</h1>\n<p data-sourcepos=\"10:1-10:120\"><a href=\"https://camo.qiitausercontent.com/dd1290dbccb6b3596e0bef59bc95b8c7f19fae03/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f31383130342f63373035656630612d623531612d353231382d336537632d3239653937636463376462362e706e67\" target=\"_blank\" rel=\"nofollow noopener\"><img src=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2Fc705ef0a-b51a-5218-3e7c-29e97cdc7db6.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=e04b2791526036bc6d869f6fdb9c2881\" alt=\"image.png\" data-canonical-src=\"https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/c705ef0a-b51a-5218-3e7c-29e97cdc7db6.png\" srcset=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2Fc705ef0a-b51a-5218-3e7c-29e97cdc7db6.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&w=1400&fit=max&s=1ecdc864e6ec3bfa0d6d6512b6ce11f0 1x\" loading=\"lazy\"></a></p>\n<h1 data-sourcepos=\"12:1-12:23\">\n<span id=\"サンプルコード\" class=\"fragment\"></span><a href=\"#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%B3%E3%83%BC%E3%83%89\"><i class=\"fa fa-link\"></i></a>サンプルコード</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"14:1-29:3\"><div class=\"highlight\"><pre><code>y =\n 1..100\n |> Enum.map(fn x ->\n :math.sin(x / 5)\n end)\n\nx =\n 1..100\n |> Enum.map(fn x ->\n x\n end)\n\nmy_data = %{x: x, y: y}\n\n</code></pre></div></div>\n<p data-sourcepos=\"32:1-32:9\">以上。</p>\n",
"slide" => false,
"stocks_count" => 1,
"tags" => [
%{"name" => "Elixir", "versions" => []},
%{"name" => "WSL", "versions" => []},
%{"name" => "Livebook", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでelixir その101",
"updated_at" => "2023-11-13T19:15:27+09:00",
"url" => "https://qiita.com/ohisama@github/items/bb60e3e5748dd7165b4a",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
"profile_image_url" => "https://secure.gravatar.com/avatar/2e0bb506fbe90e6572bf92fa05db88d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"team_only" => false,
"twitter_screen_name" => nil,
"website_url" => nil
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)で、elixirやってみた。\nnxやってみた。\n練習問題、やってみた。\n\n# 練習問題\nnxだけで、xorを学習して推定せよ。\n\n# 写真\n\n![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/b7bafb6b-09f7-d470-c877-a6edf61ea718.png)\n\n\n# サンプルコード\n\n```\ndefmodule Xor do\n import Nx.Defn\n\n defn init_random_params do\n key = Nx.Random.key(42)\n {w1, new_key} = Nx.Random.normal(key, 0.0, 0.1, shape: {2, 8}, names: [:input, :layer])\n {b1, new_key} = Nx.Random.normal(new_key, 0.0, 0.1, shape: {8}, names: [:layer])\n {w2, new_key} = Nx.Random.normal(new_key, 0.0, 0.1, shape: {8, 1}, names: [:layer, :output])\n {b2, _new_key} = Nx.Random.normal(new_key, 0.0, 0.1, shape: {1}, names: [:output])\n {w1, b1, w2, b2}\n end\n\n defn predict({w1, b1, w2, b2}, x) do\n x\n |> Nx.dot(w1)\n |> Nx.add(b1)\n |> Nx.tanh()\n |> Nx.dot(w2)\n |> Nx.add(b2)\n |> Nx.sigmoid()\n end\n\n defn loss({w1, b1, w2, b2}, x, y) do\n preds = predict({w1, b1, w2, b2}, x)\n Nx.mean(Nx.power(y - preds, 2))\n end\n\n defn update({w1, b1, w2, b2} = params, x, y, step) do\n {grad_w1, grad_b1, grad_w2, grad_b2} = grad(params, &loss(&1, x, y))\n {w1 - grad_w1 * step, b1 - grad_b1 * step, w2 - grad_w2 * step, b2 - grad_b2 * step}\n end\n\n def train(params, x, y) do\n for i <- 0..31, reduce: params do\n acc ->\n update(acc, x[i], y[i], 0.1)\n end \n end\nend\n\nz0 = for _ <- 0..31, do: Enum.random(0..1)\nz1 = for _ <- 0..31, do: Enum.random(0..1)\nx0 = Nx.tensor(z0)\nx1 = Nx.tensor(z1)\ny = Nx.logical_xor(x0, x1)\nx = Nx.concatenate([Nx.reshape(x0, {32, 1}), Nx.reshape(x1, {32, 1})], axis: 1)\n\nparams = Xor.init_random_params()\nXor.loss(params, x[0], y[0])\n|> IO.inspect()\nparams = for i <- 0..310, reduce: params do\n acc ->\n for i <- 0..31, reduce: acc do\n bcc ->\n Xor.update(bcc, x[i], y[i], 0.1)\n end \nend\nXor.loss(params, x[0], y[0])\n|> IO.inspect()\nIO.puts(\"0 1\")\nXor.predict(params, Nx.tensor([0, 1]))\n|> IO.inspect()\nIO.puts(\"0 0\")\nXor.predict(params, Nx.tensor([0, 0]))\n|> IO.inspect()\nIO.puts(\"1 1\")\nXor.predict(params, Nx.tensor([1, 1]))\n|> IO.inspect()\nIO.puts(\"1 0\")\nXor.predict(params, Nx.tensor([1, 0]))\n|> IO.inspect()\n\n```\n\n# 実行結果\n\n\n```\nwarning: variable \"i\" is unused (if the variable is not meant to be used, prefix it with an underscore)\n elixir/nx.livemd#cell:47fqo64rcwq6xj5l4abtmv4qkodbwts5:51\n\n#Nx.Tensor<\n f32\n 0.2594543695449829\n>\n#Nx.Tensor<\n f32\n 7.133321487344801e-4\n>\n0 1\n#Nx.Tensor<\n f32[output: 1]\n [0.9460618495941162]\n>\n0 0\n#Nx.Tensor<\n f32[output: 1]\n [0.02670827880501747]\n>\n1 1\n#Nx.Tensor<\n f32[output: 1]\n [0.03551710769534111]\n>\n1 0\n#Nx.Tensor<\n f32[output: 1]\n [0.9710957407951355]\n>\n```\n\n以上。\n\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-11T18:59:31+09:00",
"group" => nil,
"id" => "be1c18bac9115aad5883",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-4:33\">wsl(wsl2じゃない)で、elixirやってみた。<br>\nnxやってみた。<br>\n練習問題、やってみた。</p>\n<h1 data-sourcepos=\"6:1-6:14\">\n<span id=\"練習問題\" class=\"fragment\"></span><a href=\"#%E7%B7%B4%E7%BF%92%E5%95%8F%E9%A1%8C\"><i class=\"fa fa-link\"></i></a>練習問題</h1>\n<p data-sourcepos=\"7:1-7:47\">nxだけで、xorを学習して推定せよ。</p>\n<h1 data-sourcepos=\"9:1-9:8\">\n<span id=\"写真\" class=\"fragment\"></span><a href=\"#%E5%86%99%E7%9C%9F\"><i class=\"fa fa-link\"></i></a>写真</h1>\n<p data-sourcepos=\"11:1-11:120\"><a href=\"https://camo.qiitausercontent.com/6d32860b0e71821c168a0cc0b89825bd61d63af2/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f31383130342f62376261666236622d303966372d643437302d633837372d6136656466363165613731382e706e67\" target=\"_blank\" rel=\"nofollow noopener\"><img src=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2Fb7bafb6b-09f7-d470-c877-a6edf61ea718.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=ce9f57bf5ddef34179cbcb1ea677b707\" alt=\"image.png\" data-canonical-src=\"https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/b7bafb6b-09f7-d470-c877-a6edf61ea718.png\" srcset=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2Fb7bafb6b-09f7-d470-c877-a6edf61ea718.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&w=1400&fit=max&s=d294d0295ba591580e10e673fa426a51 1x\" loading=\"lazy\"></a></p>\n<h1 data-sourcepos=\"14:1-14:23\">\n<span id=\"サンプルコード\" class=\"fragment\"></span><a href=\"#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%B3%E3%83%BC%E3%83%89\"><i class=\"fa fa-link\"></i></a>サンプルコード</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"16:1-89:3\"><div class=\"highlight\"><pre><code>defmodule Xor do\n import Nx.Defn\n\n defn init_random_params do\n key = Nx.Random.key(42)\n {w1, new_key} = Nx.Random.normal(key, 0.0, 0.1, shape: {2, 8}, names: [:input, :layer])\n {b1, new_key} = Nx.Random.normal(new_key, 0.0, 0.1, shape: {8}, names: [:layer])\n {w2, new_key} = Nx.Random.normal(new_key, 0.0, 0.1, shape: {8, 1}, names: [:layer, :output])\n {b2, _new_key} = Nx.Random.normal(new_key, 0.0, 0.1, shape: {1}, names: [:output])\n {w1, b1, w2, b2}\n end\n\n defn predict({w1, b1, w2, b2}, x) do\n x\n |> Nx.dot(w1)\n |> Nx.add(b1)\n |> Nx.tanh()\n |> Nx.dot(w2)\n |> Nx.add(b2)\n |> Nx.sigmoid()\n end\n\n defn loss({w1, b1, w2, b2}, x, y) do\n preds = predict({w1, b1, w2, b2}, x)\n Nx.mean(Nx.power(y - preds, 2))\n end\n\n defn update({w1, b1, w2, b2} = params, x, y, step) do\n {grad_w1, grad_b1, grad_w2, grad_b2} = grad(params, &loss(&1, x, y))\n {w1 - grad_w1 * step, b1 - grad_b1 * step, w2 - grad_w2 * step, b2 - grad_b2 * step}\n end\n\n def train(params, x, y) do\n for i <- 0..31, reduce: params do\n acc ->\n update(acc, x[i], y[i], 0.1)\n end \n end\nend\n\nz0 = for _ <- 0..31, do: Enum.random(0..1)\nz1 = for _ <- 0..31, do: Enum.random(0..1)\nx0 = Nx.tensor(z0)\nx1 = Nx.tensor(z1)\ny = Nx.logical_xor(x0, x1)\nx = Nx.concatenate([Nx.reshape(x0, {32, 1}), Nx.reshape(x1, {32, 1})], axis: 1)\n\nparams = Xor.init_random_params()\nXor.loss(params, x[0], y[0])\n|> IO.inspect()\nparams = for i <- 0..310, reduce: params do\n acc ->\n for i <- 0..31, reduce: acc do\n bcc ->\n Xor.update(bcc, x[i], y[i], 0.1)\n end \nend\nXor.loss(params, x[0], y[0])\n|> IO.inspect()\nIO.puts(\"0 1\")\nXor.predict(params, Nx.tensor([0, 1]))\n|> IO.inspect()\nIO.puts(\"0 0\")\nXor.predict(params, Nx.tensor([0, 0]))\n|> IO.inspect()\nIO.puts(\"1 1\")\nXor.predict(params, Nx.tensor([1, 1]))\n|> IO.inspect()\nIO.puts(\"1 0\")\nXor.predict(params, Nx.tensor([1, 0]))\n|> IO.inspect()\n\n</code></pre></div></div>\n<h1 data-sourcepos=\"91:1-91:14\">\n<span id=\"実行結果\" class=\"fragment\"></span><a href=\"#%E5%AE%9F%E8%A1%8C%E7%B5%90%E6%9E%9C" <> ...,
"slide" => false,
"stocks_count" => 0,
"tags" => [
%{"name" => "Elixir", "versions" => []},
%{"name" => "XOR", "versions" => []},
%{"name" => "WSL", "versions" => []},
%{"name" => "nx", "versions" => []},
%{"name" => "Livebook", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでelixir その100",
"updated_at" => "2023-11-11T19:02:47+09:00",
"url" => "https://qiita.com/ohisama@github/items/be1c18bac9115aad5883",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
"profile_image_url" => "https://secure.gravatar.com/avatar/2e0bb506fbe90e6572bf92fa05db88d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"team_only" => false,
"twitter_screen_name" => nil,
...
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)で、elixirやってみた。\nnx、やってみた。\n\n# 参考にしたページ\n\nhttps://qiita.com/sand/items/1ad04bafd4ef3d91a675\n\n\n# 写真\n\n![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/72f49fb0-5d97-86f3-ced4-a98365212023.png)\n\n# サンプルコード\n\n```\nx0 = -5\nx9 = 5\nxl = [x0, x9]\n\nyl = [\n Nx.to_number(LinearRegression.pred({w, b}, x0)),\n Nx.to_number(LinearRegression.pred({w, b}, x9))\n]\n\nVl.new(width: 600, height: 400, title: \"散布図と相関直線(加工後)\")\n|> Vl.layers([\n Vl.new()\n |> Vl.data_from_values(x: xl, y: yl)\n |> Vl.mark(:line)\n |> Vl.encode_field(:x, \"x\", type: :quantitative, title: \"身長\", scale: [zero: false])\n |> Vl.encode_field(:y, \"y\", type: :quantitative, title: \"体重\", scale: [zero: false]),\n Vl.new()\n |> Vl.data_from_values(height: Nx.to_flat_list(x), weight: Nx.to_flat_list(y))\n |> Vl.mark(:point)\n |> Vl.encode_field(:x, \"height\", type: :quantitative)\n |> Vl.encode_field(:y, \"weight\", type: :quantitative)\n |> Vl.encode(:color, value: \"#db646f\")\n])\n```\n\n以上。\n\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-11T10:13:38+09:00",
"group" => nil,
"id" => "f5562ea2662e307cafd5",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-3:23\">wsl(wsl2じゃない)で、elixirやってみた。<br>\nnx、やってみた。</p>\n<h1 data-sourcepos=\"5:1-5:26\">\n<span id=\"参考にしたページ\" class=\"fragment\"></span><a href=\"#%E5%8F%82%E8%80%83%E3%81%AB%E3%81%97%E3%81%9F%E3%83%9A%E3%83%BC%E3%82%B8\"><i class=\"fa fa-link\"></i></a>参考にしたページ</h1>\n<p data-sourcepos=\"7:1-7:49\"><iframe id=\"qiita-embed-content__b3571fcf1f8c2c7777b2d373cc1d9a6a\" src=\"https://qiita.com/embed-contents/link-card#qiita-embed-content__b3571fcf1f8c2c7777b2d373cc1d9a6a\" data-content=\"https%3A%2F%2Fqiita.com%2Fsand%2Fitems%2F1ad04bafd4ef3d91a675\" frameborder=\"0\" scrolling=\"no\" loading=\"lazy\" style=\"width:100%;\" height=\"29\">\n</iframe>\n</p>\n<h1 data-sourcepos=\"10:1-10:8\">\n<span id=\"写真\" class=\"fragment\"></span><a href=\"#%E5%86%99%E7%9C%9F\"><i class=\"fa fa-link\"></i></a>写真</h1>\n<p data-sourcepos=\"12:1-12:120\"><a href=\"https://camo.qiitausercontent.com/85499c3b60ca1fcaf2a13f189385f56e74538c04/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f31383130342f37326634396662302d356439372d383666332d636564342d6139383336353231323032332e706e67\" target=\"_blank\" rel=\"nofollow noopener\"><img src=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2F72f49fb0-5d97-86f3-ced4-a98365212023.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=6cbca69f26b2bd5289e2a13211139e47\" alt=\"image.png\" data-canonical-src=\"https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/72f49fb0-5d97-86f3-ced4-a98365212023.png\" srcset=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2F72f49fb0-5d97-86f3-ced4-a98365212023.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&w=1400&fit=max&s=6add98abb830e1ea2814d7da401c976e 1x\" loading=\"lazy\"></a></p>\n<h1 data-sourcepos=\"14:1-14:23\">\n<span id=\"サンプルコード\" class=\"fragment\"></span><a href=\"#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%B3%E3%83%BC%E3%83%89\"><i class=\"fa fa-link\"></i></a>サンプルコード</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"16:1-40:3\"><div class=\"highlight\"><pre><code>x0 = -5\nx9 = 5\nxl = [x0, x9]\n\nyl = [\n Nx.to_number(LinearRegression.pred({w, b}, x0)),\n Nx.to_number(LinearRegression.pred({w, b}, x9))\n]\n\nVl.new(width: 600, height: 400, title: \"散布図と相関直線(加工後)\")\n|> Vl.layers([\n Vl.new()\n |> Vl.data_from_values(x: xl, y: yl)\n |> Vl.mark(:line)\n |> Vl.encode_field(:x, \"x\", type: :quantitative, title: \"身長\", scale: [zero: false])\n |> Vl.encode_field(:y, \"y\", type: :quantitative, title: \"体重\", scale: [zero: false]),\n Vl.new()\n |> Vl.data_from_values(height: Nx.to_flat_list(x), weight: Nx.to_flat_list(y))\n |> Vl.mark(:point)\n |> Vl.encode_field(:x, \"height\", type: :quantitative)\n |> Vl.encode_field(:y, \"weight\", type: :quantitative)\n |> Vl.encode(:color, value: \"#db646f\")\n])\n</code></pre></div></div>\n<p data-sourcepos=\"42:1-42:9\">以上。</p>\n",
"slide" => false,
"stocks_count" => 1,
"tags" => [
%{"name" => "Elixir", "versions" => []},
%{"name" => "WSL", "versions" => []},
%{"name" => "nx", "versions" => []},
%{"name" => "Livebook", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでelixir その99",
"updated_at" => "2023-11-11T10:13:38+09:00",
"url" => "https://qiita.com/ohisama@github/items/f5562ea2662e307cafd5",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
"profile_image_url" => "https://secure.gravatar.com/avatar/2e0bb506fbe90e6572bf92fa05db88d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"team_only" => false,
...
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)で、elixirやってみた。\n練習問題、やってみた。\n\n# 練習問題\nLivebookでtensorflow.jsでsinを学習せよ。\n\n# 写真\n\n![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/0325e0c4-c067-7eb3-24f1-efe0eb5e61d4.png)\n\n# サンプルコード\n\n```\ndefmodule KinoTF.Sin do\n\tuse Kino.JS\n\tdef new(html) do\n\tKino.JS.new(__MODULE__, html)\n\tend\n\tasset \"main.js\" do\n\t\"\"\"\n\timport \"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs/dist/tf.min.js\";\n\tfunction draw(ctx, data, n) {\n\t\tvar hc = n * 20 + 100;\n\t\tctx.strokeStyle = \"#f00\";\n\t\tctx.lineWidth = 1;\n\t\tctx.moveTo(0, hc);\n\t\tfor (var i = 1; i < 200; i++)\n\t\t{\n\t\t\tctx.lineTo(i, hc - data[i] * 30);\n\t\t}\n\t\tctx.stroke();\n\t}\n\texport function init(ctx, html) {\n\t\tconst canvas = document.createElement(\"canvas\");\n\t\tcanvas.style.width = \"400px\";\n\t\tcanvas.style.height = \"400px\";\n\t\tctx.root.appendChild(canvas);\n\t\tconst ctx2 = canvas.getContext('2d');\n\t\tctx2.clearRect(0, 0, canvas.width, canvas.height);\n\t\tctx2.beginPath();\n\t\ttf.setBackend('cpu');\n\t\tconst buffer = tf.buffer([200, 1]);\n\t\tconst buffer2 = tf.buffer([200, 1]);\n\t\tvar b = [];\n\t\tfor (var i = 0; i < 200; i++)\n\t\t{\n\t\t\tvar x = i / 30.0;\n\t\t\tvar y = Math.sin(x);\n\t\t\tb.push(y);\n\t\t\tbuffer.set(x, i, 0);\n\t\t\tbuffer2.set(y, i, 0);\n\t\t}\n\t\t\n\t\tconst model = tf.sequential();\n\t\teval(html);\n\t\tconst xs = buffer.toTensor();\n\t\tconst ys = buffer2.toTensor();\n\t\tmodel.fit(xs, ys, {\n\t\t\tbatchSize: 200,\n\t\t\tepochs: 6000\n\t\t}).then((d) => {\n\t\t\tvar str = \"loss = \";\n\t\t\tstr += d.history.loss[0];\n\t\t\talert(str);\n\t\t\tvar p = [];\n\t\t\tfor (i = 0; i < 200; i++)\n\t\t\t{\n\t\t\t\tvar x = i / 30.0;\n\t\t\t\tvar pre = model.predict(tf.tensor2d([[x]], [1, 1]));\n\t\t\t\tvar f = pre.dataSync();\n\t\t\t\tp.push(f);\n\t\t\t}\n\t\t\tdraw(ctx2, p, 1);\n\t\t});\n draw(ctx2, b, 0);\n\t}\n\t\"\"\"\n\tend\nend\n\nKinoTF.Sin.new(\"\"\"\nmodel.add(tf.layers.dense({\n\tunits: 40,\n\tactivation: 'tanh',\n\tinputShape: [1]\n}));\nmodel.add(tf.layers.dense({\n\tunits: 1,\n\tactivation: 'tanh'\n}));\nmodel.compile({\n\toptimizer: 'adam',\n\tloss: 'meanSquaredError'\n});\n\"\"\")\n\n```\n\n\n以上。\n\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-10T18:25:40+09:00",
"group" => nil,
"id" => "d8ffd408c9423ce2ab03",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-3:33\">wsl(wsl2じゃない)で、elixirやってみた。<br>\n練習問題、やってみた。</p>\n<h1 data-sourcepos=\"5:1-5:14\">\n<span id=\"練習問題\" class=\"fragment\"></span><a href=\"#%E7%B7%B4%E7%BF%92%E5%95%8F%E9%A1%8C\"><i class=\"fa fa-link\"></i></a>練習問題</h1>\n<p data-sourcepos=\"6:1-6:48\">Livebookでtensorflow.jsでsinを学習せよ。</p>\n<h1 data-sourcepos=\"8:1-8:8\">\n<span id=\"写真\" class=\"fragment\"></span><a href=\"#%E5%86%99%E7%9C%9F\"><i class=\"fa fa-link\"></i></a>写真</h1>\n<p data-sourcepos=\"10:1-10:120\"><a href=\"https://camo.qiitausercontent.com/38bf2578746ea842ea275c76653355a77c04138a/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f31383130342f30333235653063342d633036372d376562332d323466312d6566653065623565363164342e706e67\" target=\"_blank\" rel=\"nofollow noopener\"><img src=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2F0325e0c4-c067-7eb3-24f1-efe0eb5e61d4.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=7cf592fec92e6e6a1ed03705b00669cb\" alt=\"image.png\" data-canonical-src=\"https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/0325e0c4-c067-7eb3-24f1-efe0eb5e61d4.png\" srcset=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2F0325e0c4-c067-7eb3-24f1-efe0eb5e61d4.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&w=1400&fit=max&s=266db9fe5a77bda75eb3ea18eeeb0c31 1x\" loading=\"lazy\"></a></p>\n<h1 data-sourcepos=\"12:1-12:23\">\n<span id=\"サンプルコード\" class=\"fragment\"></span><a href=\"#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%B3%E3%83%BC%E3%83%89\"><i class=\"fa fa-link\"></i></a>サンプルコード</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"14:1-98:3\"><div class=\"highlight\"><pre><code>defmodule KinoTF.Sin do\n\tuse Kino.JS\n\tdef new(html) do\n\tKino.JS.new(__MODULE__, html)\n\tend\n\tasset \"main.js\" do\n\t\"\"\"\n\timport \"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs/dist/tf.min.js\";\n\tfunction draw(ctx, data, n) {\n\t\tvar hc = n * 20 + 100;\n\t\tctx.strokeStyle = \"#f00\";\n\t\tctx.lineWidth = 1;\n\t\tctx.moveTo(0, hc);\n\t\tfor (var i = 1; i < 200; i++)\n\t\t{\n\t\t\tctx.lineTo(i, hc - data[i] * 30);\n\t\t}\n\t\tctx.stroke();\n\t}\n\texport function init(ctx, html) {\n\t\tconst canvas = document.createElement(\"canvas\");\n\t\tcanvas.style.width = \"400px\";\n\t\tcanvas.style.height = \"400px\";\n\t\tctx.root.appendChild(canvas);\n\t\tconst ctx2 = canvas.getContext('2d');\n\t\tctx2.clearRect(0, 0, canvas.width, canvas.height);\n\t\tctx2.beginPath();\n\t\ttf.setBackend('cpu');\n\t\tconst buffer = tf.buffer([200, 1]);\n\t\tconst buffer2 = tf.buffer([200, 1]);\n\t\tvar b = [];\n\t\tfor (var i = 0; i < 200; i++)\n\t\t{\n\t\t\tvar x = i / 30.0;\n\t\t\tvar y = Math.sin(x);\n\t\t\tb.push(y);\n\t\t\tbuffer.set(x, i, 0);\n\t\t\tbuffer2.set(y, i, 0);\n\t\t}\n\t\t\n\t\tconst model = tf.sequential();\n\t\teval(html);\n\t\tconst xs = buffer.toTensor();\n\t\tconst ys = buffer2.toTensor();\n\t\tmodel.fit(xs, ys, {\n\t\t\tbatchSize: 200,\n\t\t\tepochs: 6000\n\t\t}).then((d) => {\n\t\t\tvar str = \"loss = \";\n\t\t\tstr += d.history.loss[0];\n\t\t\talert(str);\n\t\t\tvar p = [];\n\t\t\tfor (i = 0; i < 200; i++)\n\t\t\t{\n\t\t\t\tvar x = i / 30.0;\n\t\t\t\tvar pre = model.predict(tf.tensor2d([[x]], [1, 1]));\n\t\t\t\tvar f = pre.dataSync();\n\t\t\t\tp.push(f);\n\t\t\t}\n\t\t\tdraw(ctx2, p, 1);\n\t\t});\n draw(ctx2, b, 0);\n\t}\n\t\"\"\"\n\tend\nend\n\nKinoTF.Sin.new(\"\"\"\nmodel.add(tf.layers.dense({\n\tunits: 40,\n\tactivation: 'tanh',\n\tinputShape: [1]\n}));\nmodel.add(tf.layers.dense({\n\tunits: 1,\n\tactivation: 'tanh'\n}));\nmodel.compile({\n\toptimizer: 'adam',\n\tloss: 'meanSquaredError'\n});\n\"\"\")\n\n</code></pre></div></div>\n<p data-sourcepos=\"101:1-101:9\">以上。</p>\n",
"slide" => false,
"stocks_count" => 1,
"tags" => [
%{"name" => "JavaScript", "versions" => []},
%{"name" => "Elixir", "versions" => []},
%{"name" => "WSL", "versions" => []},
%{"name" => "TensorFlow.js", "versions" => []},
%{"name" => "Livebook", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでelixir その98",
"updated_at" => "2023-11-10T18:25:40+09:00",
"url" => "https://qiita.com/ohisama@github/items/d8ffd408c9423ce2ab03",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
"profile_image_url" => "https://secure.gravatar.com/avatar/2e0bb506fbe90e6572bf92fa05db88d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
...
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)で、elixirやってみた。\nlivebookでMix.installがエラー吐く件。\n\n# 環境\nErlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns] [x86_64-pc-linux-gnu]\nElixir\n1.14.5\nPhoenix\n1.7.5\nLivebook\n0.10.0\n\n# サンプルコード\n\n\n```\nMix.install(\n [\n {:exla, \"~> 0.2\"}\n ],\n config: [\n nx: [default_backend: EXLA.Backend]\n ]\n)\n```\n\n# エラー\n\n```\n==> exla\nUnpacking /home/ore/.cache/xla/0.5.1/cache/download/xla_extension-x86_64-linux-gnu-cpu.tar.gz into /home/ore/.cache/mix/installs/elixir-1.14.5-erts-13.0.4/85d4d181377848a871d5de1451b1a2d0/deps/exla/cache\ncould not compile dependency :exla, \"mix compile\" failed. Errors may have been logged above. You can recompile this dependency with \"mix deps.compile exla\", update it with \"mix deps.update exla\" or clean it with \"mix deps.clean exla\"\n\n```\n\n\n以上。\n\n\n\n\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-10T11:30:07+09:00",
"group" => nil,
"id" => "521614fd5b1ebfc5c70a",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-3:46\">wsl(wsl2じゃない)で、elixirやってみた。<br>\nlivebookでMix.installがエラー吐く件。</p>\n<h1 data-sourcepos=\"5:1-5:8\">\n<span id=\"環境\" class=\"fragment\"></span><a href=\"#%E7%92%B0%E5%A2%83\"><i class=\"fa fa-link\"></i></a>環境</h1>\n<p data-sourcepos=\"6:1-12:6\">Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns] [x86_64-pc-linux-gnu]<br>\nElixir<br>\n1.14.5<br>\nPhoenix<br>\n1.7.5<br>\nLivebook<br>\n0.10.0</p>\n<h1 data-sourcepos=\"14:1-14:23\">\n<span id=\"サンプルコード\" class=\"fragment\"></span><a href=\"#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%B3%E3%83%BC%E3%83%89\"><i class=\"fa fa-link\"></i></a>サンプルコード</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"17:1-26:3\"><div class=\"highlight\"><pre><code>Mix.install(\n [\n {:exla, \"~> 0.2\"}\n ],\n config: [\n nx: [default_backend: EXLA.Backend]\n ]\n)\n</code></pre></div></div>\n<h1 data-sourcepos=\"28:1-28:11\">\n<span id=\"エラー\" class=\"fragment\"></span><a href=\"#%E3%82%A8%E3%83%A9%E3%83%BC\"><i class=\"fa fa-link\"></i></a>エラー</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"30:1-35:3\"><div class=\"highlight\"><pre><code>==> exla\nUnpacking /home/ore/.cache/xla/0.5.1/cache/download/xla_extension-x86_64-linux-gnu-cpu.tar.gz into /home/ore/.cache/mix/installs/elixir-1.14.5-erts-13.0.4/85d4d181377848a871d5de1451b1a2d0/deps/exla/cache\ncould not compile dependency :exla, \"mix compile\" failed. Errors may have been logged above. You can recompile this dependency with \"mix deps.compile exla\", update it with \"mix deps.update exla\" or clean it with \"mix deps.clean exla\"\n\n</code></pre></div></div>\n<p data-sourcepos=\"38:1-38:9\">以上。</p>\n",
"slide" => false,
"stocks_count" => 0,
"tags" => [
%{"name" => "Elixir", "versions" => []},
%{"name" => "WSL", "versions" => []},
%{"name" => "Livebook", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでelixir その97",
"updated_at" => "2023-11-10T11:30:07+09:00",
"url" => "https://qiita.com/ohisama@github/items/521614fd5b1ebfc5c70a",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
"permanent_id" => 18104,
...
}
},
%{
"body" => "# 概要\n自動運転シミュレーションを開発している。\nキャプチャーしてみた。\n\n# 動画\n\nゴール、しちゃった。\n\n<iframe width=\"560\" height=\"500\" src=\"https://www.youtube.com/embed/fp8gBz_XVBQ\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" loading=\"lazy\" allowfullscreen></iframe>\n\n\n# 説明\n\n- livebookでserverを起動する。\n- websocketでポート50002で、待つ。\n- plunkerで環境を動かす。\n- websocketに接続して、センサーの値をjsonで送る。\n- agentがセンサーのデータを見て、actionを返す。\n- 環境がハンドルをきる。\n- の繰り返し。\n\n\n以上。\n\n\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-10T07:28:23+09:00",
"group" => nil,
"id" => "f91122aaa7b56b9e23d9",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-3:33\">自動運転シミュレーションを開発している。<br>\nキャプチャーしてみた。</p>\n<h1 data-sourcepos=\"5:1-5:8\">\n<span id=\"動画\" class=\"fragment\"></span><a href=\"#%E5%8B%95%E7%94%BB\"><i class=\"fa fa-link\"></i></a>動画</h1>\n<p data-sourcepos=\"7:1-7:30\">ゴール、しちゃった。</p>\n<iframe width=\"100%\" height=\"500\" src=\"https://www.youtube.com/embed/fp8gBz_XVBQ\" frameborder=\"0\" loading=\"lazy\" allowfullscreen></iframe>\n<h1 data-sourcepos=\"12:1-12:8\">\n<span id=\"説明\" class=\"fragment\"></span><a href=\"#%E8%AA%AC%E6%98%8E\"><i class=\"fa fa-link\"></i></a>説明</h1>\n<ul data-sourcepos=\"14:1-22:0\">\n<li data-sourcepos=\"14:1-14:37\">livebookでserverを起動する。</li>\n<li data-sourcepos=\"15:1-15:43\">websocketでポート50002で、待つ。</li>\n<li data-sourcepos=\"16:1-16:33\">plunkerで環境を動かす。</li>\n<li data-sourcepos=\"17:1-17:66\">websocketに接続して、センサーの値をjsonで送る。</li>\n<li data-sourcepos=\"18:1-18:64\">agentがセンサーのデータを見て、actionを返す。</li>\n<li data-sourcepos=\"19:1-19:35\">環境がハンドルをきる。</li>\n<li data-sourcepos=\"20:1-22:0\">の繰り返し。</li>\n</ul>\n<p data-sourcepos=\"23:1-23:9\">以上。</p>\n",
"slide" => false,
"stocks_count" => 1,
"tags" => [
%{"name" => "JavaScript", "versions" => []},
%{"name" => "Elixir", "versions" => []},
%{"name" => "Plunker", "versions" => []},
%{"name" => "自動運転シミュレーション", "versions" => []},
%{"name" => "Livebook", "versions" => []}
],
"team_membership" => nil,
"title" => "自動運転シミュレーション その7",
"updated_at" => "2023-11-10T07:49:36+09:00",
"url" => "https://qiita.com/ohisama@github/items/f91122aaa7b56b9e23d9",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
"organization" => nil,
...
}
},
%{
"body" => "# 概要\nplunkerでlzmaやってみた。\nplunkerで圧縮してダウンロードして、アップロードして解凍してみた。\n\n# 写真\n\n![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/a25e9e73-6c80-6b86-7ae5-bb12e77a7b73.png)\n\n\n# サンプルコード\n\n```\n\nvar compression_mode = 7,\n my_lzma = LZMA;\nvar file = document.getElementById('file');\nvar out = document.getElementById('out');\nfunction loadLocalFile(e) {\n\tvar fileData = e.target.files[0];\n\tvar reader = new FileReader(); \n\treader.onload = function() {\n var asArray = new Uint8Array(reader.result);\n\t\talert(asArray);\n\t\tmy_lzma.decompress(asArray, function on_decompress_complete(result) {\n //alert(\"Decompressed: \" + result);\n out.value = result;\n }, function on_decompress_progress_update(percent) { \n });\n\t}\n reader.readAsArrayBuffer(fileData);\n}\nfile.addEventListener('change', loadLocalFile, false);\n\ndocument.getElementById(\"go\").onclick = function() {\n my_lzma.compress(document.getElementById(\"compression_el\").value, compression_mode, function on_compress_complete(result) {\n alert(\"Compressed: \" + result);\n my_lzma.decompress(result, function on_decompress_complete(result) {\n alert(\"Decompressed: \" + result);\n }, function on_decompress_progress_update(percent) {\n document.title = \"Decompressing: \" + (percent * 100) + \"%\";\n });\n }, function on_compress_progress_update(percent) {\n document.title = \"Compressing: \" + (percent * 100) + \"%\";\n });\n}\n\ndocument.getElementById(\"go2\").onclick = function() {\n my_lzma.compress(document.getElementById(\"compression_el\").value, compression_mode, function on_compress_complete(result) {\n alert(result);\n var asArray = new Uint8Array(result);\t\n\t var blob = new Blob([asArray], {\n\t\t type: \"application/zip\"\n\t });\t \n\t var linkText = document.createTextNode(\"down load link\");\n\t var a = document.createElement('a');\n\t a.appendChild(linkText);\n a.download = \"hello2.txt.lzma\";\n\t a.href = URL.createObjectURL(blob);\n\t document.body.appendChild(a);\n }, function on_compress_progress_update(percent) {\n });\n}\n\n\n```\n\n# 成果物\n\nhttps://embed.plnkr.co/plunk/jZzTPPK812ryJWq4\n\n以上。\n\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-08T17:08:57+09:00",
"group" => nil,
"id" => "ea2fa0fe56d843a89e93",
"likes_count" => 0,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-3:94\">plunkerでlzmaやってみた。<br>\nplunkerで圧縮してダウンロードして、アップロードして解凍してみた。</p>\n<h1 data-sourcepos=\"5:1-5:8\">\n<span id=\"写真\" class=\"fragment\"></span><a href=\"#%E5%86%99%E7%9C%9F\"><i class=\"fa fa-link\"></i></a>写真</h1>\n<p data-sourcepos=\"7:1-7:120\"><a href=\"https://camo.qiitausercontent.com/423b1ccd248b2ac6f76d3327c524caf4ccef6911/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f31383130342f61323565396537332d366338302d366238362d376165352d6262313265373761376237332e706e67\" target=\"_blank\" rel=\"nofollow noopener\"><img src=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2Fa25e9e73-6c80-6b86-7ae5-bb12e77a7b73.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=e9fff71fa9999243b9fffb0a4694302f\" alt=\"image.png\" data-canonical-src=\"https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/a25e9e73-6c80-6b86-7ae5-bb12e77a7b73.png\" srcset=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2Fa25e9e73-6c80-6b86-7ae5-bb12e77a7b73.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&w=1400&fit=max&s=e810924f16e9b5a65f4d048b4386c4d2 1x\" loading=\"lazy\"></a></p>\n<h1 data-sourcepos=\"10:1-10:23\">\n<span id=\"サンプルコード\" class=\"fragment\"></span><a href=\"#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%B3%E3%83%BC%E3%83%89\"><i class=\"fa fa-link\"></i></a>サンプルコード</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"12:1-65:3\"><div class=\"highlight\"><pre><code>\nvar compression_mode = 7,\n my_lzma = LZMA;\nvar file = document.getElementById('file');\nvar out = document.getElementById('out');\nfunction loadLocalFile(e) {\n\tvar fileData = e.target.files[0];\n\tvar reader = new FileReader(); \n\treader.onload = function() {\n var asArray = new Uint8Array(reader.result);\n\t\talert(asArray);\n\t\tmy_lzma.decompress(asArray, function on_decompress_complete(result) {\n //alert(\"Decompressed: \" + result);\n out.value = result;\n }, function on_decompress_progress_update(percent) { \n });\n\t}\n reader.readAsArrayBuffer(fileData);\n}\nfile.addEventListener('change', loadLocalFile, false);\n\ndocument.getElementById(\"go\").onclick = function() {\n my_lzma.compress(document.getElementById(\"compression_el\").value, compression_mode, function on_compress_complete(result) {\n alert(\"Compressed: \" + result);\n my_lzma.decompress(result, function on_decompress_complete(result) {\n alert(\"Decompressed: \" + result);\n }, function on_decompress_progress_update(percent) {\n document.title = \"Decompressing: \" + (percent * 100) + \"%\";\n });\n }, function on_compress_progress_update(percent) {\n document.title = \"Compressing: \" + (percent * 100) + \"%\";\n });\n}\n\ndocument.getElementById(\"go2\").onclick = function() {\n my_lzma.compress(document.getElementById(\"compression_el\").value, compression_mode, function on_compress_complete(result) {\n alert(result);\n var asArray = new Uint8Array(result);\t\n\t var blob = new Blob([asArray], {\n\t\t type: \"application/zip\"\n\t });\t \n\t var linkText = document.createTextNode(\"down load link\");\n\t var a = document.createElement('a');\n\t a.appendChild(linkText);\n a.download = \"hello2.txt.lzma\";\n\t a.href = URL.createObjectURL(blob);\n\t document.body.appendChild(a);\n }, function on_compress_progress_update(percent) {\n });\n}\n\n\n</code></pre></div></div>\n<h1 data-sourcepos=\"67:1-67:11\">\n<span id=\"成果物\" class=\"fragment\"></span><a href=\"#%E6%88%90%E6%9E%9C%E7%89%A9\"><i class=\"fa fa-link\"></i></a>成果物</h1>\n<p data-sourcepos=\"69:1-69:45\"><iframe id=\"qiita-embed-content__7d2e0f1b1d7348bdd8792630b5af092e\" src=\"https://qiita.com/embed-contents/link-card#qiita-embed-content__7d2e0f1b1d7348bdd8792630b5af092e\" data-content=\"https%3A%2F%" <> ...,
"slide" => false,
"stocks_count" => 0,
"tags" => [
%{"name" => "JavaScript", "versions" => []},
%{"name" => "Plunker", "versions" => []},
%{"name" => "lzma", "versions" => []}
],
"team_membership" => nil,
"title" => "plunkerでlzma",
"updated_at" => "2023-11-08T17:08:57+09:00",
"url" => "https://qiita.com/ohisama@github/items/ea2fa0fe56d843a89e93",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
"name" => "",
...
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)で、elixirやってみた。\n練習問題、やってみた。\n\n# 練習問題\nKino.Control.buttonで、じゃんけんを書け。\n\n# 写真\n\n![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/4510ba53-aefd-c6ee-493e-747967a3613b.png)\n\n\n# サンプルコード\n\n```\nbutton0 = Kino.Control.button(\"gu\")\n```\n\n```\nbutton1 = Kino.Control.button(\"choki\")\n```\n\n```\nbutton2 = Kino.Control.button(\"par\")\n```\n\n```\nKino.Control.subscribe(button0, :gu)\nKino.Control.subscribe(button1, :choki)\nKino.Control.subscribe(button2, :par)\n```\n\n```\nwidget = Kino.Frame.new()\n```\n\n```\nloop = fn f ->\n\treceive do\n\t\t{:gu, _} ->\n res = Janken.pon(\"0\")\n\t\t\tKino.Frame.append(widget, res)\n\t\t{:choki, _} ->\n res = Janken.pon(\"1\")\n\t\t\tKino.Frame.append(widget, res)\n\t\t{:par, _} ->\n res = Janken.pon(\"2\")\n\t\t\tKino.Frame.append(widget, res)\n\t\t_ -> \n\t\t\t:ok\n\tend\nend\n\nloop.(loop)\n\n```\n\n以上。\n\n\n\n\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-07T07:44:04+09:00",
"group" => nil,
"id" => "1f5e1305d09b7c0b9f3f",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-3:33\">wsl(wsl2じゃない)で、elixirやってみた。<br>\n練習問題、やってみた。</p>\n<h1 data-sourcepos=\"5:1-5:14\">\n<span id=\"練習問題\" class=\"fragment\"></span><a href=\"#%E7%B7%B4%E7%BF%92%E5%95%8F%E9%A1%8C\"><i class=\"fa fa-link\"></i></a>練習問題</h1>\n<p data-sourcepos=\"6:1-6:52\">Kino.Control.buttonで、じゃんけんを書け。</p>\n<h1 data-sourcepos=\"8:1-8:8\">\n<span id=\"写真\" class=\"fragment\"></span><a href=\"#%E5%86%99%E7%9C%9F\"><i class=\"fa fa-link\"></i></a>写真</h1>\n<p data-sourcepos=\"10:1-10:120\"><a href=\"https://camo.qiitausercontent.com/b29eb1082057008e2d72725a46bc1bdf1eb23acd/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f31383130342f34353130626135332d616566642d633665652d343933652d3734373936376133363133622e706e67\" target=\"_blank\" rel=\"nofollow noopener\"><img src=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2F4510ba53-aefd-c6ee-493e-747967a3613b.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=a7a0b1c3028ff6b334cfef9946b6242e\" alt=\"image.png\" data-canonical-src=\"https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/4510ba53-aefd-c6ee-493e-747967a3613b.png\" srcset=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2F4510ba53-aefd-c6ee-493e-747967a3613b.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&w=1400&fit=max&s=b9aedef9c2e63354dbf435d1f60eae9c 1x\" loading=\"lazy\"></a></p>\n<h1 data-sourcepos=\"13:1-13:23\">\n<span id=\"サンプルコード\" class=\"fragment\"></span><a href=\"#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%B3%E3%83%BC%E3%83%89\"><i class=\"fa fa-link\"></i></a>サンプルコード</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"15:1-17:3\"><div class=\"highlight\"><pre><code>button0 = Kino.Control.button(\"gu\")\n</code></pre></div></div>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"19:1-21:3\"><div class=\"highlight\"><pre><code>button1 = Kino.Control.button(\"choki\")\n</code></pre></div></div>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"23:1-25:3\"><div class=\"highlight\"><pre><code>button2 = Kino.Control.button(\"par\")\n</code></pre></div></div>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"27:1-31:3\"><div class=\"highlight\"><pre><code>Kino.Control.subscribe(button0, :gu)\nKino.Control.subscribe(button1, :choki)\nKino.Control.subscribe(button2, :par)\n</code></pre></div></div>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"33:1-35:3\"><div class=\"highlight\"><pre><code>widget = Kino.Frame.new()\n</code></pre></div></div>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"37:1-56:3\"><div class=\"highlight\"><pre><code>loop = fn f ->\n\treceive do\n\t\t{:gu, _} ->\n res = Janken.pon(\"0\")\n\t\t\tKino.Frame.append(widget, res)\n\t\t{:choki, _} ->\n res = Janken.pon(\"1\")\n\t\t\tKino.Frame.append(widget, res)\n\t\t{:par, _} ->\n res = Janken.pon(\"2\")\n\t\t\tKino.Frame.append(widget, res)\n\t\t_ -> \n\t\t\t:ok\n\tend\nend\n\nloop.(loop)\n\n</code></pre></div></div>\n<p data-sourcepos=\"58:1-58:9\">以上。</p>\n",
"slide" => false,
"stocks_count" => 0,
"tags" => [
%{"name" => "Elixir", "versions" => []},
%{"name" => "WSL", "versions" => []},
%{"name" => "じゃんけん", "versions" => []},
%{"name" => "Livebook", "versions" => []},
%{"name" => "Kino", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでelixir その96",
"updated_at" => "2023-11-07T07:44:04+09:00",
"url" => "https://qiita.com/ohisama@github/items/1f5e1305d09b7c0b9f3f",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
"location" => nil,
...
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)で、elixirやってみた。\n練習問題、やってみた。\n\n# 練習問題\nkinoで、じゃんけんを書け。\n\n# 写真\n\n![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/964048cb-fcc7-aeb3-9f6a-134926fa16bf.png)\n\n# サンプルコード\n\n```\nframe2 = Kino.Frame.new()\n```\n\n```\ninputs2 = [\tte: Kino.Input.text(\"Anata\")]\nform2 = Kino.Control.form(inputs2, submit: \"Send\", reset_on_submit: [:te])\n\n```\n\n```\ndefmodule Janken do\n\tdef hand(c) do\n\t\tcond do\n\t\tc == 0 ->\n\t\t\t\"グー\"\n\t\tc == 1 ->\n\t\t\t\"チョキ\"\n\t\tc == 2 ->\n\t\t\t\"パー\"\n\t\t:else ->\n\t\t\t\"うそ\"\n\t\tend\n\tend\n\tdef judge(a, b) do\n\t\tcond do\n\t\ta == b ->\n\t\t\t\"あいこ\"\n\t\ta == 0 && b == 1 ->\n\t\t\t\"あなたの勝ち\"\n\t\ta == 1 && b == 2 ->\n\t\t\t\"あなたの勝ち\"\n\t\ta == 2 && b == 0 ->\n\t\t\t\"あなたの勝ち\"\n\t\ta == 0 && b == 2 ->\n\t\t\t\"あなたの負け\"\n\t\ta == 1 && b == 0 ->\n\t\t\t\"あなたの負け\"\n\t\ta == 2 && b == 1 ->\n\t\t\t\"あなたの負け\"\n\t\tend\n\tend\n\tdef pon(a) do\n\t\tres = \"\"\n\t\t{a, _} = a\n\t\t\t|> Integer.parse()\n\t\tres = res <> hand(a) <> \"と\"\n\t\tb = 0..2 \n\t\t\t|> Enum.random\n\t\tres = res <> hand(b) <> \"で、\"\n\t\tres = res <> judge(a, b)\n\t\tres\n\tend\nend\n\nKino.listen(form2, fn %{data: %{te: te}, origin: origin} ->\n res = Janken.pon(te)\n\tcontent = Kino.Markdown.new(res)\n\tKino.Frame.append(frame2, content) \nend)\n\n```\n\n\n以上。\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-07T06:51:31+09:00",
"group" => nil,
"id" => "9533f76725f14ecc06f5",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-3:33\">wsl(wsl2じゃない)で、elixirやってみた。<br>\n練習問題、やってみた。</p>\n<h1 data-sourcepos=\"5:1-5:14\">\n<span id=\"練習問題\" class=\"fragment\"></span><a href=\"#%E7%B7%B4%E7%BF%92%E5%95%8F%E9%A1%8C\"><i class=\"fa fa-link\"></i></a>練習問題</h1>\n<p data-sourcepos=\"6:1-6:37\">kinoで、じゃんけんを書け。</p>\n<h1 data-sourcepos=\"8:1-8:8\">\n<span id=\"写真\" class=\"fragment\"></span><a href=\"#%E5%86%99%E7%9C%9F\"><i class=\"fa fa-link\"></i></a>写真</h1>\n<p data-sourcepos=\"10:1-10:120\"><a href=\"https://camo.qiitausercontent.com/1ae89d5bb52f9a28fbba26990f4d8d391b4ea466/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f31383130342f39363430343863622d666363372d616562332d396636612d3133343932366661313662662e706e67\" target=\"_blank\" rel=\"nofollow noopener\"><img src=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2F964048cb-fcc7-aeb3-9f6a-134926fa16bf.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=66d253281292836ac15aae8bdfbf9a9a\" alt=\"image.png\" data-canonical-src=\"https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/964048cb-fcc7-aeb3-9f6a-134926fa16bf.png\" srcset=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2F964048cb-fcc7-aeb3-9f6a-134926fa16bf.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&w=1400&fit=max&s=678edeaec9036a61298e69e9e2cdfa5d 1x\" loading=\"lazy\"></a></p>\n<h1 data-sourcepos=\"12:1-12:23\">\n<span id=\"サンプルコード\" class=\"fragment\"></span><a href=\"#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%B3%E3%83%BC%E3%83%89\"><i class=\"fa fa-link\"></i></a>サンプルコード</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"14:1-16:3\"><div class=\"highlight\"><pre><code>frame2 = Kino.Frame.new()\n</code></pre></div></div>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"18:1-22:3\"><div class=\"highlight\"><pre><code>inputs2 = [\tte: Kino.Input.text(\"Anata\")]\nform2 = Kino.Control.form(inputs2, submit: \"Send\", reset_on_submit: [:te])\n\n</code></pre></div></div>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"24:1-75:3\"><div class=\"highlight\"><pre><code>defmodule Janken do\n\tdef hand(c) do\n\t\tcond do\n\t\tc == 0 ->\n\t\t\t\"グー\"\n\t\tc == 1 ->\n\t\t\t\"チョキ\"\n\t\tc == 2 ->\n\t\t\t\"パー\"\n\t\t:else ->\n\t\t\t\"うそ\"\n\t\tend\n\tend\n\tdef judge(a, b) do\n\t\tcond do\n\t\ta == b ->\n\t\t\t\"あいこ\"\n\t\ta == 0 && b == 1 ->\n\t\t\t\"あなたの勝ち\"\n\t\ta == 1 && b == 2 ->\n\t\t\t\"あなたの勝ち\"\n\t\ta == 2 && b == 0 ->\n\t\t\t\"あなたの勝ち\"\n\t\ta == 0 && b == 2 ->\n\t\t\t\"あなたの負け\"\n\t\ta == 1 && b == 0 ->\n\t\t\t\"あなたの負け\"\n\t\ta == 2 && b == 1 ->\n\t\t\t\"あなたの負け\"\n\t\tend\n\tend\n\tdef pon(a) do\n\t\tres = \"\"\n\t\t{a, _} = a\n\t\t\t|> Integer.parse()\n\t\tres = res <> hand(a) <> \"と\"\n\t\tb = 0..2 \n\t\t\t|> Enum.random\n\t\tres = res <> hand(b) <> \"で、\"\n\t\tres = res <> judge(a, b)\n\t\tres\n\tend\nend\n\nKino.listen(form2, fn %{data: %{te: te}, origin: origin} ->\n res = Janken.pon(te)\n\tcontent = Kino.Markdown.new(res)\n\tKino.Frame.append(frame2, content) \nend)\n\n</code></pre></div></div>\n<p data-sourcepos=\"78:1-78:9\">以上。</p>\n",
"slide" => false,
"stocks_count" => 0,
"tags" => [
%{"name" => "Elixir", "versions" => []},
%{"name" => "WSL", "versions" => []},
%{"name" => "じゃんけん", "versions" => []},
%{"name" => "Livebook", "versions" => []},
%{"name" => "Kino", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでelixir その95 ",
"updated_at" => "2023-11-07T06:52:18+09:00",
"url" => "https://qiita.com/ohisama@github/items/9533f76725f14ecc06f5",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
"linkedin_id" => nil,
...
}
},
%{
"body" => "# 概要\nwsl(wsl2じゃない)で、elixirやってみた。\n練習問題、やってみた。\n\n# 練習問題\nタイミングチャートを表示せよ。\n\n# 写真\n\n![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/e947617d-5184-794b-8434-583551fa0ce4.png)\n\n\n# サンプルコード\n\n```\ndefmodule KinoHTML.Tchart do\n use Kino.JS\n\n def new(html) do\n Kino.JS.new(__MODULE__, html)\n end\n\n asset \"main.js\" do\n \"\"\"\n function draw(ctx, row, w) {\n const WIDTH = 400;\n const HEIGHT = 400;\n const ROW_HEIGHT = 20;\n const LOGIC_HEIGHT = 15;\n const NAME_LEFT = 5;\n const SIG_LEFT = 50;\n const SIG_RIGHT = 380;\n const SIG_WIDTH = (SIG_RIGHT - SIG_LEFT);\n const TICK_START = 0;\n const CLK_OFSET = 5;\n const TICK_COUNT = 9; \n const TICK_WIDTH = SIG_WIDTH / TICK_COUNT;\n\t const Y_BASE = ROW_HEIGHT * (row + 1);\n\t ctx.fillStyle = \"red\";\n\t ctx.fillText(row, NAME_LEFT, Y_BASE, SIG_LEFT);\n\t ctx.fillStyle = \"rgb(240, 240, 240)\";\n\t ctx.lineWidth = 1;\n\t for (var i = 0; i < TICK_COUNT; i += 2)\n\t {\n\t\t var x = i * TICK_WIDTH + SIG_LEFT + CLK_OFSET;\n\t\t var yh = Y_BASE - LOGIC_HEIGHT;\n\t\t ctx.fillRect(x, yh, TICK_WIDTH, HEIGHT - 5 - yh);\n\t }\n\t ctx.moveTo(SIG_LEFT, Y_BASE);\n\t ctx.lineTo(SIG_LEFT + CLK_OFSET, Y_BASE);\n\t for (var i = 0; i < TICK_COUNT; i++)\n\t {\n\t\t var x = i * TICK_WIDTH + SIG_LEFT + CLK_OFSET;\n\t\t if (w[i] == 0)\n\t\t {\n\t\t\t ctx.lineTo(x + TICK_WIDTH, Y_BASE);\n\t\t }\n\t\t else\n\t\t {\n\t\t\t if (w[i] != w[i - 1]) \n\t\t\t\t ctx.lineTo(x, Y_BASE - LOGIC_HEIGHT);\n\t\t\t ctx.lineTo(x + TICK_WIDTH, Y_BASE - LOGIC_HEIGHT);\n\t\t\t if (w[i] != w[i + 1]) \n\t\t\t\t ctx.lineTo(x + TICK_WIDTH, Y_BASE);\n\t\t }\n\t }\n\t ctx.stroke();\n }\n export function init(ctx, html) {\n \t\tconst canvas = document.createElement(\"canvas\");\n canvas.Width = 400;\n canvas.Height = 400;\n \t\tctx.root.appendChild(canvas);\n const ctx2 = canvas.getContext('2d');\n\t ctx2.clearRect(0, 0, canvas.width, canvas.height);\n\t ctx2.beginPath();\n \tvar tim = JSON.parse(html);\n\t draw(ctx2, 0, tim.s);\n\t draw(ctx2, 1, tim.t);\n\t draw(ctx2, 2, tim.u);\n\t draw(ctx2, 3, tim.v); \t\n }\n \"\"\"\n end\nend\n\nKinoHTML.Tchart.new(\"\"\"\n{\n \"s\": [0, 1, 0, 1, 0, 0, 0, 1, 0], \n \"t\": [0, 0, 1, 1, 0, 1, 0, 0, 0], \n \"u\": [0, 1, 0, 1, 0, 0, 0, 1, 0], \n \"v\": [0, 0, 1, 1, 0, 1, 0, 0, 0]\n}\n\"\"\")\n\n```\n\n\n以上。\n\n",
"coediting" => false,
"comments_count" => 0,
"created_at" => "2023-11-06T16:48:54+09:00",
"group" => nil,
"id" => "4a93eaf2b1bc8907c52f",
"likes_count" => 1,
"organization_url_name" => nil,
"page_views_count" => nil,
"private" => false,
"reactions_count" => 0,
"rendered_body" => "<h1 data-sourcepos=\"1:1-1:8\">\n<span id=\"概要\" class=\"fragment\"></span><a href=\"#%E6%A6%82%E8%A6%81\"><i class=\"fa fa-link\"></i></a>概要</h1>\n<p data-sourcepos=\"2:1-3:33\">wsl(wsl2じゃない)で、elixirやってみた。<br>\n練習問題、やってみた。</p>\n<h1 data-sourcepos=\"5:1-5:14\">\n<span id=\"練習問題\" class=\"fragment\"></span><a href=\"#%E7%B7%B4%E7%BF%92%E5%95%8F%E9%A1%8C\"><i class=\"fa fa-link\"></i></a>練習問題</h1>\n<p data-sourcepos=\"6:1-6:45\">タイミングチャートを表示せよ。</p>\n<h1 data-sourcepos=\"8:1-8:8\">\n<span id=\"写真\" class=\"fragment\"></span><a href=\"#%E5%86%99%E7%9C%9F\"><i class=\"fa fa-link\"></i></a>写真</h1>\n<p data-sourcepos=\"10:1-10:120\"><a href=\"https://camo.qiitausercontent.com/91e179619416c792792fdd1217544b8445e66680/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f31383130342f65393437363137642d353138342d373934622d383433342d3538333535316661306365342e706e67\" target=\"_blank\" rel=\"nofollow noopener\"><img src=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2Fe947617d-5184-794b-8434-583551fa0ce4.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=cbe7a2b15cb7872acf6073438439fe43\" alt=\"image.png\" data-canonical-src=\"https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/e947617d-5184-794b-8434-583551fa0ce4.png\" srcset=\"https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F18104%2Fe947617d-5184-794b-8434-583551fa0ce4.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&w=1400&fit=max&s=e921833bd1fbb5ee927d2d944009db03 1x\" loading=\"lazy\"></a></p>\n<h1 data-sourcepos=\"13:1-13:23\">\n<span id=\"サンプルコード\" class=\"fragment\"></span><a href=\"#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%B3%E3%83%BC%E3%83%89\"><i class=\"fa fa-link\"></i></a>サンプルコード</h1>\n<div class=\"code-frame\" data-lang=\"text\" data-sourcepos=\"15:1-96:3\"><div class=\"highlight\"><pre><code>defmodule KinoHTML.Tchart do\n use Kino.JS\n\n def new(html) do\n Kino.JS.new(__MODULE__, html)\n end\n\n asset \"main.js\" do\n \"\"\"\n function draw(ctx, row, w) {\n const WIDTH = 400;\n const HEIGHT = 400;\n const ROW_HEIGHT = 20;\n const LOGIC_HEIGHT = 15;\n const NAME_LEFT = 5;\n const SIG_LEFT = 50;\n const SIG_RIGHT = 380;\n const SIG_WIDTH = (SIG_RIGHT - SIG_LEFT);\n const TICK_START = 0;\n const CLK_OFSET = 5;\n const TICK_COUNT = 9; \n const TICK_WIDTH = SIG_WIDTH / TICK_COUNT;\n\t const Y_BASE = ROW_HEIGHT * (row + 1);\n\t ctx.fillStyle = \"red\";\n\t ctx.fillText(row, NAME_LEFT, Y_BASE, SIG_LEFT);\n\t ctx.fillStyle = \"rgb(240, 240, 240)\";\n\t ctx.lineWidth = 1;\n\t for (var i = 0; i < TICK_COUNT; i += 2)\n\t {\n\t\t var x = i * TICK_WIDTH + SIG_LEFT + CLK_OFSET;\n\t\t var yh = Y_BASE - LOGIC_HEIGHT;\n\t\t ctx.fillRect(x, yh, TICK_WIDTH, HEIGHT - 5 - yh);\n\t }\n\t ctx.moveTo(SIG_LEFT, Y_BASE);\n\t ctx.lineTo(SIG_LEFT + CLK_OFSET, Y_BASE);\n\t for (var i = 0; i < TICK_COUNT; i++)\n\t {\n\t\t var x = i * TICK_WIDTH + SIG_LEFT + CLK_OFSET;\n\t\t if (w[i] == 0)\n\t\t {\n\t\t\t ctx.lineTo(x + TICK_WIDTH, Y_BASE);\n\t\t }\n\t\t else\n\t\t {\n\t\t\t if (w[i] != w[i - 1]) \n\t\t\t\t ctx.lineTo(x, Y_BASE - LOGIC_HEIGHT);\n\t\t\t ctx.lineTo(x + TICK_WIDTH, Y_BASE - LOGIC_HEIGHT);\n\t\t\t if (w[i] != w[i + 1]) \n\t\t\t\t ctx.lineTo(x + TICK_WIDTH, Y_BASE);\n\t\t }\n\t }\n\t ctx.stroke();\n }\n export function init(ctx, html) {\n \t\tconst canvas = document.createElement(\"canvas\");\n canvas.Width = 400;\n canvas.Height = 400;\n \t\tctx.root.appendChild(canvas);\n const ctx2 = canvas.getContext('2d');\n\t ctx2.clearRect(0, 0, canvas.width, canvas.height);\n\t ctx2.beginPath();\n \tvar tim = JSON.parse(html);\n\t draw(ctx2, 0, tim.s);\n\t draw(ctx2, 1, tim.t);\n\t draw(ctx2, 2, tim.u);\n\t draw(ctx2, 3, tim.v); \t\n }\n \"\"\"\n end\nend\n\nKinoHTML.Tchart.new(\"\"\"\n{\n \"s\": [0, 1, 0, 1, 0, 0, 0, 1, 0], \n \"t\": [0, 0, 1, 1, 0, 1, 0, 0, 0], \n \"u\": [0, 1, 0, 1, 0, 0, 0, 1, 0], \n \"v\": [0, 0, 1, 1, 0, 1, 0, 0, 0]\n}\n\"\"\")\n\n</code></pre></div></div>\n<p " <> ...,
"slide" => false,
"stocks_count" => 1,
"tags" => [
%{"name" => "Elixir", "versions" => []},
%{"name" => "WSL", "versions" => []},
%{"name" => "Livebook", "versions" => []},
%{"name" => "タイミングチャート", "versions" => []},
%{"name" => "Kino", "versions" => []}
],
"team_membership" => nil,
"title" => "wslでelixir その94",
"updated_at" => "2023-11-06T16:52:25+09:00",
"url" => "https://qiita.com/ohisama@github/items/4a93eaf2b1bc8907c52f",
"user" => %{
"description" => nil,
"facebook_id" => nil,
"followees_count" => 0,
"followers_count" => 70,
"github_login_name" => "ohisama",
"id" => "ohisama@github",
"items_count" => 3822,
...
}
}
],
trailers: %{},
private: %{}
}
以上。