Skip to content

Commit 74c3097

Browse files
committed
add support for Colab & Binder Rust env setup
1 parent 10f786b commit 74c3097

8 files changed

+297
-10
lines changed

1-iris-data-analysis-rust.ipynb

+41
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "f4e8c1d9-c986-44cf-96cf-52328f5af66d",
6+
"metadata": {},
7+
"source": [
8+
"## Google Colab & Binder Rust Setup\n",
9+
"\n",
10+
"The following cell is used to set up a Rust environment on Colab and Binder. Don't execute it locally!\n",
11+
"\n",
12+
"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)."
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": null,
18+
"id": "bbb265f4-a05b-4e51-8320-adf9b83a78fa",
19+
"metadata": {},
20+
"outputs": [],
21+
"source": [
22+
"!rm -rf /root/.local/share/jupyter/kernels\n",
23+
"\n",
24+
"# Nix install\n",
25+
"!curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm\n",
26+
"!ln -s /root/.nix-profile/bin /opt/bin\n",
27+
"\n",
28+
"# Install evcxr\n",
29+
"!nix-env -f '<nixpkgs>' -iA cargo rustc evcxr sccache\n",
30+
"!evcxr_jupyter --install\n",
31+
"\n",
32+
"# Configure evcxr\n",
33+
"!mkdir -p /root/.config/evcxr\n",
34+
"!printf \":timing\\n:sccache 1\" > /root/.config/evcxr/init.evcxr\n",
35+
"\n",
36+
"# IPC Proxy (https://stackoverflow.com/a/74821762)\n",
37+
"!wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n",
38+
"!python install_ipc_proxy_kernel.py --quiet --kernel=rust --implementation=ipc_proxy_kernel.py > /dev/null\n",
39+
"\n",
40+
"# To avoid confusion between kernel names\n",
41+
"!sed -i 's/\"display_name\": \"Rust\"/\"display_name\": \"Rust-TCP\"/g' /root/.local/share/jupyter/kernels/rust_tcp/kernel.json"
42+
]
43+
},
344
{
445
"cell_type": "markdown",
546
"id": "cc8e31fd",

2-ndarray-tutorial.ipynb

+41
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "c5b88d62-9e09-466d-9eb9-07f175a03faa",
6+
"metadata": {},
7+
"source": [
8+
"## Google Colab & Binder Rust Setup\n",
9+
"\n",
10+
"The following cell is used to set up a Rust environment on Colab and Binder. Don't execute it locally!\n",
11+
"\n",
12+
"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)."
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": null,
18+
"id": "8c41f994-6a68-49b0-9b20-cd79f63c104c",
19+
"metadata": {},
20+
"outputs": [],
21+
"source": [
22+
"!rm -rf /root/.local/share/jupyter/kernels\n",
23+
"\n",
24+
"# Nix install\n",
25+
"!curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm\n",
26+
"!ln -s /root/.nix-profile/bin /opt/bin\n",
27+
"\n",
28+
"# Install evcxr\n",
29+
"!nix-env -f '<nixpkgs>' -iA cargo rustc evcxr sccache\n",
30+
"!evcxr_jupyter --install\n",
31+
"\n",
32+
"# Configure evcxr\n",
33+
"!mkdir -p /root/.config/evcxr\n",
34+
"!printf \":timing\\n:sccache 1\" > /root/.config/evcxr/init.evcxr\n",
35+
"\n",
36+
"# IPC Proxy (https://stackoverflow.com/a/74821762)\n",
37+
"!wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n",
38+
"!python install_ipc_proxy_kernel.py --quiet --kernel=rust --implementation=ipc_proxy_kernel.py > /dev/null\n",
39+
"\n",
40+
"# To avoid confusion between kernel names\n",
41+
"!sed -i 's/\"display_name\": \"Rust\"/\"display_name\": \"Rust-TCP\"/g' /root/.local/share/jupyter/kernels/rust_tcp/kernel.json"
42+
]
43+
},
344
{
445
"cell_type": "markdown",
546
"id": "69efca5e",

3-polars-tutorial-part-1.ipynb

+41
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "3b86ffc2-eefc-493c-9828-727b5b882ed4",
6+
"metadata": {},
7+
"source": [
8+
"## Google Colab & Binder Rust Setup\n",
9+
"\n",
10+
"The following cell is used to set up a Rust environment on Colab and Binder. Don't execute it locally!\n",
11+
"\n",
12+
"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)."
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": null,
18+
"id": "8572698f-2fb8-461b-8e70-9f4a2b26b423",
19+
"metadata": {},
20+
"outputs": [],
21+
"source": [
22+
"!rm -rf /root/.local/share/jupyter/kernels\n",
23+
"\n",
24+
"# Nix install\n",
25+
"!curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm\n",
26+
"!ln -s /root/.nix-profile/bin /opt/bin\n",
27+
"\n",
28+
"# Install evcxr\n",
29+
"!nix-env -f '<nixpkgs>' -iA cargo rustc evcxr sccache\n",
30+
"!evcxr_jupyter --install\n",
31+
"\n",
32+
"# Configure evcxr\n",
33+
"!mkdir -p /root/.config/evcxr\n",
34+
"!printf \":timing\\n:sccache 1\" > /root/.config/evcxr/init.evcxr\n",
35+
"\n",
36+
"# IPC Proxy (https://stackoverflow.com/a/74821762)\n",
37+
"!wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n",
38+
"!python install_ipc_proxy_kernel.py --quiet --kernel=rust --implementation=ipc_proxy_kernel.py > /dev/null\n",
39+
"\n",
40+
"# To avoid confusion between kernel names\n",
41+
"!sed -i 's/\"display_name\": \"Rust\"/\"display_name\": \"Rust-TCP\"/g' /root/.local/share/jupyter/kernels/rust_tcp/kernel.json"
42+
]
43+
},
344
{
445
"cell_type": "markdown",
546
"id": "1aa30ace",

4-polars-tutorial-part-2.ipynb

+41
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "3d3de788-4962-4e37-b74c-40d12f939401",
6+
"metadata": {},
7+
"source": [
8+
"## Google Colab & Binder Rust Setup\n",
9+
"\n",
10+
"The following cell is used to set up a Rust environment on Colab and Binder. Don't execute it locally!\n",
11+
"\n",
12+
"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)."
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": null,
18+
"id": "72c53213-90b5-496c-92c9-cf2bbedc07e0",
19+
"metadata": {},
20+
"outputs": [],
21+
"source": [
22+
"!rm -rf /root/.local/share/jupyter/kernels\n",
23+
"\n",
24+
"# Nix install\n",
25+
"!curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm\n",
26+
"!ln -s /root/.nix-profile/bin /opt/bin\n",
27+
"\n",
28+
"# Install evcxr\n",
29+
"!nix-env -f '<nixpkgs>' -iA cargo rustc evcxr sccache\n",
30+
"!evcxr_jupyter --install\n",
31+
"\n",
32+
"# Configure evcxr\n",
33+
"!mkdir -p /root/.config/evcxr\n",
34+
"!printf \":timing\\n:sccache 1\" > /root/.config/evcxr/init.evcxr\n",
35+
"\n",
36+
"# IPC Proxy (https://stackoverflow.com/a/74821762)\n",
37+
"!wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n",
38+
"!python install_ipc_proxy_kernel.py --quiet --kernel=rust --implementation=ipc_proxy_kernel.py > /dev/null\n",
39+
"\n",
40+
"# To avoid confusion between kernel names\n",
41+
"!sed -i 's/\"display_name\": \"Rust\"/\"display_name\": \"Rust-TCP\"/g' /root/.local/share/jupyter/kernels/rust_tcp/kernel.json"
42+
]
43+
},
344
{
445
"cell_type": "markdown",
546
"id": "1aa30ace",

5-probability-theory-tutorial.ipynb

+42-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,52 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "e01fb3ac-9ab7-4723-8cbc-08434c9e158f",
6+
"metadata": {},
7+
"source": [
8+
"## Google Colab & Binder Rust Setup\n",
9+
"\n",
10+
"The following cell is used to set up a Rust environment on Colab and Binder. Don't execute it locally!\n",
11+
"\n",
12+
"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)."
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": null,
18+
"id": "1d278011-f31a-4e13-890f-1ad8533396b8",
19+
"metadata": {},
20+
"outputs": [],
21+
"source": [
22+
"!rm -rf /root/.local/share/jupyter/kernels\n",
23+
"\n",
24+
"# Nix install\n",
25+
"!curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm\n",
26+
"!ln -s /root/.nix-profile/bin /opt/bin\n",
27+
"\n",
28+
"# Install evcxr\n",
29+
"!nix-env -f '<nixpkgs>' -iA cargo rustc evcxr sccache\n",
30+
"!evcxr_jupyter --install\n",
31+
"\n",
32+
"# Configure evcxr\n",
33+
"!mkdir -p /root/.config/evcxr\n",
34+
"!printf \":timing\\n:sccache 1\" > /root/.config/evcxr/init.evcxr\n",
35+
"\n",
36+
"# IPC Proxy (https://stackoverflow.com/a/74821762)\n",
37+
"!wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n",
38+
"!python install_ipc_proxy_kernel.py --quiet --kernel=rust --implementation=ipc_proxy_kernel.py > /dev/null\n",
39+
"\n",
40+
"# To avoid confusion between kernel names\n",
41+
"!sed -i 's/\"display_name\": \"Rust\"/\"display_name\": \"Rust-TCP\"/g' /root/.local/share/jupyter/kernels/rust_tcp/kernel.json"
42+
]
43+
},
344
{
445
"cell_type": "markdown",
546
"id": "ac5c5759",
647
"metadata": {},
748
"source": [
8-
"# Install Dependencies"
49+
"## Install Dependencies"
950
]
1051
},
1152
{

6-plotters-tutorial-part-1.ipynb

+41
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "7c29a52e-53d1-48fc-9f9d-b7cccbe16187",
6+
"metadata": {},
7+
"source": [
8+
"## Google Colab & Binder Rust Setup\n",
9+
"\n",
10+
"The following cell is used to set up a Rust environment on Colab and Binder. Don't execute it locally!\n",
11+
"\n",
12+
"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)."
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": null,
18+
"id": "eeea5473-d6b5-4f9a-8fc0-8608ee36a2f8",
19+
"metadata": {},
20+
"outputs": [],
21+
"source": [
22+
"!rm -rf /root/.local/share/jupyter/kernels\n",
23+
"\n",
24+
"# Nix install\n",
25+
"!curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm\n",
26+
"!ln -s /root/.nix-profile/bin /opt/bin\n",
27+
"\n",
28+
"# Install evcxr\n",
29+
"!nix-env -f '<nixpkgs>' -iA cargo rustc evcxr sccache\n",
30+
"!evcxr_jupyter --install\n",
31+
"\n",
32+
"# Configure evcxr\n",
33+
"!mkdir -p /root/.config/evcxr\n",
34+
"!printf \":timing\\n:sccache 1\" > /root/.config/evcxr/init.evcxr\n",
35+
"\n",
36+
"# IPC Proxy (https://stackoverflow.com/a/74821762)\n",
37+
"!wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n",
38+
"!python install_ipc_proxy_kernel.py --quiet --kernel=rust --implementation=ipc_proxy_kernel.py > /dev/null\n",
39+
"\n",
40+
"# To avoid confusion between kernel names\n",
41+
"!sed -i 's/\"display_name\": \"Rust\"/\"display_name\": \"Rust-TCP\"/g' /root/.local/share/jupyter/kernels/rust_tcp/kernel.json"
42+
]
43+
},
344
{
445
"cell_type": "markdown",
546
"id": "71294001",

7-calculus-tutorial-part-1.ipynb

+41
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "0f6d8195-c607-4a0a-babe-00ea6cf6d575",
6+
"metadata": {},
7+
"source": [
8+
"## Google Colab & Binder Rust Setup\n",
9+
"\n",
10+
"The following cell is used to set up a Rust environment on Colab and Binder. Don't execute it locally!\n",
11+
"\n",
12+
"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)."
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": null,
18+
"id": "5a69893a-9677-4256-9ce2-69a9189931ea",
19+
"metadata": {},
20+
"outputs": [],
21+
"source": [
22+
"!rm -rf /root/.local/share/jupyter/kernels\n",
23+
"\n",
24+
"# Nix install\n",
25+
"!curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm\n",
26+
"!ln -s /root/.nix-profile/bin /opt/bin\n",
27+
"\n",
28+
"# Install evcxr\n",
29+
"!nix-env -f '<nixpkgs>' -iA cargo rustc evcxr sccache\n",
30+
"!evcxr_jupyter --install\n",
31+
"\n",
32+
"# Configure evcxr\n",
33+
"!mkdir -p /root/.config/evcxr\n",
34+
"!printf \":timing\\n:sccache 1\" > /root/.config/evcxr/init.evcxr\n",
35+
"\n",
36+
"# IPC Proxy (https://stackoverflow.com/a/74821762)\n",
37+
"!wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n",
38+
"!python install_ipc_proxy_kernel.py --quiet --kernel=rust --implementation=ipc_proxy_kernel.py > /dev/null\n",
39+
"\n",
40+
"# To avoid confusion between kernel names\n",
41+
"!sed -i 's/\"display_name\": \"Rust\"/\"display_name\": \"Rust-TCP\"/g' /root/.local/share/jupyter/kernels/rust_tcp/kernel.json"
42+
]
43+
},
344
{
445
"cell_type": "markdown",
546
"id": "0ad92c1a",

0 commit comments

Comments
 (0)