Skip to content

Commit

Permalink
Merge pull request #28 from wiseaidev/colab
Browse files Browse the repository at this point in the history
add support for Colab & Binder Rust env setup
  • Loading branch information
wiseaidev authored Dec 19, 2023
2 parents 10f786b + 74c3097 commit f18ef98
Show file tree
Hide file tree
Showing 8 changed files with 297 additions and 10 deletions.
41 changes: 41 additions & 0 deletions 1-iris-data-analysis-rust.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "f4e8c1d9-c986-44cf-96cf-52328f5af66d",
"metadata": {},
"source": [
"## Google Colab & Binder Rust Setup\n",
"\n",
"The following cell is used to set up a Rust environment on Colab and Binder. Don't execute it locally!\n",
"\n",
"Many thanks to [`mateusvmv`](https://github.com/mateusvmv) for this hack in [`gist.github.com/korakot/ae95315ea6a3a3b33ee26203998a59a3`](https://gist.github.com/korakot/ae95315ea6a3a3b33ee26203998a59a3?permalink_comment_id=4715636#gistcomment-4715636)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bbb265f4-a05b-4e51-8320-adf9b83a78fa",
"metadata": {},
"outputs": [],
"source": [
"!rm -rf /root/.local/share/jupyter/kernels\n",
"\n",
"# Nix install\n",
"!curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm\n",
"!ln -s /root/.nix-profile/bin /opt/bin\n",
"\n",
"# Install evcxr\n",
"!nix-env -f '<nixpkgs>' -iA cargo rustc evcxr sccache\n",
"!evcxr_jupyter --install\n",
"\n",
"# Configure evcxr\n",
"!mkdir -p /root/.config/evcxr\n",
"!printf \":timing\\n:sccache 1\" > /root/.config/evcxr/init.evcxr\n",
"\n",
"# IPC Proxy (https://stackoverflow.com/a/74821762)\n",
"!wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n",
"!python install_ipc_proxy_kernel.py --quiet --kernel=rust --implementation=ipc_proxy_kernel.py > /dev/null\n",
"\n",
"# To avoid confusion between kernel names\n",
"!sed -i 's/\"display_name\": \"Rust\"/\"display_name\": \"Rust-TCP\"/g' /root/.local/share/jupyter/kernels/rust_tcp/kernel.json"
]
},
{
"cell_type": "markdown",
"id": "cc8e31fd",
Expand Down
41 changes: 41 additions & 0 deletions 2-ndarray-tutorial.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "c5b88d62-9e09-466d-9eb9-07f175a03faa",
"metadata": {},
"source": [
"## Google Colab & Binder Rust Setup\n",
"\n",
"The following cell is used to set up a Rust environment on Colab and Binder. Don't execute it locally!\n",
"\n",
"Many thanks to [`mateusvmv`](https://github.com/mateusvmv) for this hack in [`gist.github.com/korakot/ae95315ea6a3a3b33ee26203998a59a3`](https://gist.github.com/korakot/ae95315ea6a3a3b33ee26203998a59a3?permalink_comment_id=4715636#gistcomment-4715636)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8c41f994-6a68-49b0-9b20-cd79f63c104c",
"metadata": {},
"outputs": [],
"source": [
"!rm -rf /root/.local/share/jupyter/kernels\n",
"\n",
"# Nix install\n",
"!curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm\n",
"!ln -s /root/.nix-profile/bin /opt/bin\n",
"\n",
"# Install evcxr\n",
"!nix-env -f '<nixpkgs>' -iA cargo rustc evcxr sccache\n",
"!evcxr_jupyter --install\n",
"\n",
"# Configure evcxr\n",
"!mkdir -p /root/.config/evcxr\n",
"!printf \":timing\\n:sccache 1\" > /root/.config/evcxr/init.evcxr\n",
"\n",
"# IPC Proxy (https://stackoverflow.com/a/74821762)\n",
"!wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n",
"!python install_ipc_proxy_kernel.py --quiet --kernel=rust --implementation=ipc_proxy_kernel.py > /dev/null\n",
"\n",
"# To avoid confusion between kernel names\n",
"!sed -i 's/\"display_name\": \"Rust\"/\"display_name\": \"Rust-TCP\"/g' /root/.local/share/jupyter/kernels/rust_tcp/kernel.json"
]
},
{
"cell_type": "markdown",
"id": "69efca5e",
Expand Down
41 changes: 41 additions & 0 deletions 3-polars-tutorial-part-1.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "3b86ffc2-eefc-493c-9828-727b5b882ed4",
"metadata": {},
"source": [
"## Google Colab & Binder Rust Setup\n",
"\n",
"The following cell is used to set up a Rust environment on Colab and Binder. Don't execute it locally!\n",
"\n",
"Many thanks to [`mateusvmv`](https://github.com/mateusvmv) for this hack in [`gist.github.com/korakot/ae95315ea6a3a3b33ee26203998a59a3`](https://gist.github.com/korakot/ae95315ea6a3a3b33ee26203998a59a3?permalink_comment_id=4715636#gistcomment-4715636)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8572698f-2fb8-461b-8e70-9f4a2b26b423",
"metadata": {},
"outputs": [],
"source": [
"!rm -rf /root/.local/share/jupyter/kernels\n",
"\n",
"# Nix install\n",
"!curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm\n",
"!ln -s /root/.nix-profile/bin /opt/bin\n",
"\n",
"# Install evcxr\n",
"!nix-env -f '<nixpkgs>' -iA cargo rustc evcxr sccache\n",
"!evcxr_jupyter --install\n",
"\n",
"# Configure evcxr\n",
"!mkdir -p /root/.config/evcxr\n",
"!printf \":timing\\n:sccache 1\" > /root/.config/evcxr/init.evcxr\n",
"\n",
"# IPC Proxy (https://stackoverflow.com/a/74821762)\n",
"!wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n",
"!python install_ipc_proxy_kernel.py --quiet --kernel=rust --implementation=ipc_proxy_kernel.py > /dev/null\n",
"\n",
"# To avoid confusion between kernel names\n",
"!sed -i 's/\"display_name\": \"Rust\"/\"display_name\": \"Rust-TCP\"/g' /root/.local/share/jupyter/kernels/rust_tcp/kernel.json"
]
},
{
"cell_type": "markdown",
"id": "1aa30ace",
Expand Down
41 changes: 41 additions & 0 deletions 4-polars-tutorial-part-2.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "3d3de788-4962-4e37-b74c-40d12f939401",
"metadata": {},
"source": [
"## Google Colab & Binder Rust Setup\n",
"\n",
"The following cell is used to set up a Rust environment on Colab and Binder. Don't execute it locally!\n",
"\n",
"Many thanks to [`mateusvmv`](https://github.com/mateusvmv) for this hack in [`gist.github.com/korakot/ae95315ea6a3a3b33ee26203998a59a3`](https://gist.github.com/korakot/ae95315ea6a3a3b33ee26203998a59a3?permalink_comment_id=4715636#gistcomment-4715636)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "72c53213-90b5-496c-92c9-cf2bbedc07e0",
"metadata": {},
"outputs": [],
"source": [
"!rm -rf /root/.local/share/jupyter/kernels\n",
"\n",
"# Nix install\n",
"!curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm\n",
"!ln -s /root/.nix-profile/bin /opt/bin\n",
"\n",
"# Install evcxr\n",
"!nix-env -f '<nixpkgs>' -iA cargo rustc evcxr sccache\n",
"!evcxr_jupyter --install\n",
"\n",
"# Configure evcxr\n",
"!mkdir -p /root/.config/evcxr\n",
"!printf \":timing\\n:sccache 1\" > /root/.config/evcxr/init.evcxr\n",
"\n",
"# IPC Proxy (https://stackoverflow.com/a/74821762)\n",
"!wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n",
"!python install_ipc_proxy_kernel.py --quiet --kernel=rust --implementation=ipc_proxy_kernel.py > /dev/null\n",
"\n",
"# To avoid confusion between kernel names\n",
"!sed -i 's/\"display_name\": \"Rust\"/\"display_name\": \"Rust-TCP\"/g' /root/.local/share/jupyter/kernels/rust_tcp/kernel.json"
]
},
{
"cell_type": "markdown",
"id": "1aa30ace",
Expand Down
43 changes: 42 additions & 1 deletion 5-probability-theory-tutorial.ipynb
Original file line number Diff line number Diff line change
@@ -1,11 +1,52 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "e01fb3ac-9ab7-4723-8cbc-08434c9e158f",
"metadata": {},
"source": [
"## Google Colab & Binder Rust Setup\n",
"\n",
"The following cell is used to set up a Rust environment on Colab and Binder. Don't execute it locally!\n",
"\n",
"Many thanks to [`mateusvmv`](https://github.com/mateusvmv) for this hack in [`gist.github.com/korakot/ae95315ea6a3a3b33ee26203998a59a3`](https://gist.github.com/korakot/ae95315ea6a3a3b33ee26203998a59a3?permalink_comment_id=4715636#gistcomment-4715636)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1d278011-f31a-4e13-890f-1ad8533396b8",
"metadata": {},
"outputs": [],
"source": [
"!rm -rf /root/.local/share/jupyter/kernels\n",
"\n",
"# Nix install\n",
"!curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm\n",
"!ln -s /root/.nix-profile/bin /opt/bin\n",
"\n",
"# Install evcxr\n",
"!nix-env -f '<nixpkgs>' -iA cargo rustc evcxr sccache\n",
"!evcxr_jupyter --install\n",
"\n",
"# Configure evcxr\n",
"!mkdir -p /root/.config/evcxr\n",
"!printf \":timing\\n:sccache 1\" > /root/.config/evcxr/init.evcxr\n",
"\n",
"# IPC Proxy (https://stackoverflow.com/a/74821762)\n",
"!wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n",
"!python install_ipc_proxy_kernel.py --quiet --kernel=rust --implementation=ipc_proxy_kernel.py > /dev/null\n",
"\n",
"# To avoid confusion between kernel names\n",
"!sed -i 's/\"display_name\": \"Rust\"/\"display_name\": \"Rust-TCP\"/g' /root/.local/share/jupyter/kernels/rust_tcp/kernel.json"
]
},
{
"cell_type": "markdown",
"id": "ac5c5759",
"metadata": {},
"source": [
"# Install Dependencies"
"## Install Dependencies"
]
},
{
Expand Down
41 changes: 41 additions & 0 deletions 6-plotters-tutorial-part-1.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "7c29a52e-53d1-48fc-9f9d-b7cccbe16187",
"metadata": {},
"source": [
"## Google Colab & Binder Rust Setup\n",
"\n",
"The following cell is used to set up a Rust environment on Colab and Binder. Don't execute it locally!\n",
"\n",
"Many thanks to [`mateusvmv`](https://github.com/mateusvmv) for this hack in [`gist.github.com/korakot/ae95315ea6a3a3b33ee26203998a59a3`](https://gist.github.com/korakot/ae95315ea6a3a3b33ee26203998a59a3?permalink_comment_id=4715636#gistcomment-4715636)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "eeea5473-d6b5-4f9a-8fc0-8608ee36a2f8",
"metadata": {},
"outputs": [],
"source": [
"!rm -rf /root/.local/share/jupyter/kernels\n",
"\n",
"# Nix install\n",
"!curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm\n",
"!ln -s /root/.nix-profile/bin /opt/bin\n",
"\n",
"# Install evcxr\n",
"!nix-env -f '<nixpkgs>' -iA cargo rustc evcxr sccache\n",
"!evcxr_jupyter --install\n",
"\n",
"# Configure evcxr\n",
"!mkdir -p /root/.config/evcxr\n",
"!printf \":timing\\n:sccache 1\" > /root/.config/evcxr/init.evcxr\n",
"\n",
"# IPC Proxy (https://stackoverflow.com/a/74821762)\n",
"!wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n",
"!python install_ipc_proxy_kernel.py --quiet --kernel=rust --implementation=ipc_proxy_kernel.py > /dev/null\n",
"\n",
"# To avoid confusion between kernel names\n",
"!sed -i 's/\"display_name\": \"Rust\"/\"display_name\": \"Rust-TCP\"/g' /root/.local/share/jupyter/kernels/rust_tcp/kernel.json"
]
},
{
"cell_type": "markdown",
"id": "71294001",
Expand Down
41 changes: 41 additions & 0 deletions 7-calculus-tutorial-part-1.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "0f6d8195-c607-4a0a-babe-00ea6cf6d575",
"metadata": {},
"source": [
"## Google Colab & Binder Rust Setup\n",
"\n",
"The following cell is used to set up a Rust environment on Colab and Binder. Don't execute it locally!\n",
"\n",
"Many thanks to [`mateusvmv`](https://github.com/mateusvmv) for this hack in [`gist.github.com/korakot/ae95315ea6a3a3b33ee26203998a59a3`](https://gist.github.com/korakot/ae95315ea6a3a3b33ee26203998a59a3?permalink_comment_id=4715636#gistcomment-4715636)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5a69893a-9677-4256-9ce2-69a9189931ea",
"metadata": {},
"outputs": [],
"source": [
"!rm -rf /root/.local/share/jupyter/kernels\n",
"\n",
"# Nix install\n",
"!curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm\n",
"!ln -s /root/.nix-profile/bin /opt/bin\n",
"\n",
"# Install evcxr\n",
"!nix-env -f '<nixpkgs>' -iA cargo rustc evcxr sccache\n",
"!evcxr_jupyter --install\n",
"\n",
"# Configure evcxr\n",
"!mkdir -p /root/.config/evcxr\n",
"!printf \":timing\\n:sccache 1\" > /root/.config/evcxr/init.evcxr\n",
"\n",
"# IPC Proxy (https://stackoverflow.com/a/74821762)\n",
"!wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n",
"!python install_ipc_proxy_kernel.py --quiet --kernel=rust --implementation=ipc_proxy_kernel.py > /dev/null\n",
"\n",
"# To avoid confusion between kernel names\n",
"!sed -i 's/\"display_name\": \"Rust\"/\"display_name\": \"Rust-TCP\"/g' /root/.local/share/jupyter/kernels/rust_tcp/kernel.json"
]
},
{
"cell_type": "markdown",
"id": "0ad92c1a",
Expand Down
Loading

0 comments on commit f18ef98

Please sign in to comment.