From 236b81e19e520f75dbc53f44f20f2ef1f1090ce2 Mon Sep 17 00:00:00 2001 From: Zhigang Song Date: Wed, 28 Feb 2024 02:22:23 +0800 Subject: [PATCH] support jupyter notebook support --- Dockerfile | 13 +- Gemfile | 3 +- Gemfile.lock | 143 +++++++++++++----- _config.yml | 2 +- ...e-Learning-Mathematical-Foundations-hw2.md | 4 + _posts/ai/ntu/decision_stump.ipynb | 10 +- .../vue/2024-01-24-vue-web-component.md | 4 +- bootstrap.sh | 7 +- 8 files changed, 128 insertions(+), 58 deletions(-) diff --git a/Dockerfile b/Dockerfile index a38b3b0..9f09058 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,12 @@ -FROM ubuntu:latest +FROM ruby:3.1-slim-bullseye as jekyll RUN apt-get update -q \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qy build-essential ruby ruby-dev graphviz git \ - && apt-get clean \ - && rm -rf /var/lib/apt + && DEBIAN_FRONTEND=noninteractive apt-get install -qy build-essential ruby ruby-dev graphviz git python3-notebook jupyter-nbconvert \ + && apt-get clean \ + && rm -rf /var/lib/apt RUN gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/ \ - && gem install jekyll \ - && gem update --system + && gem install jekyll \ + && gem update --system WORKDIR /blog ENTRYPOINT ["/bin/bash", "bootstrap.sh"] -# ENTRYPOINT ["bin/bash"] diff --git a/Gemfile b/Gemfile index 0fb49a2..fa271d7 100644 --- a/Gemfile +++ b/Gemfile @@ -3,9 +3,10 @@ source "https://gems.ruby-china.com/" #gem "rexml", ">= 3.2.5" gem "jekyll-text-theme" gem "tzinfo-data" -# gem "jekyll-jupyter-notebook" group :jekyll_plugins do gem 'jekyll-graphviz', :git => 'https://github.com/sidgwick/jekyll-graphviz.git' + gem "jekyll-jupyter-notebook", :git => "https://github.com/sidgwick/jekyll-jupyter-notebook" + # gem "jekyll-jupyter-notebook", :path => "./_drafts/jekyll-jupyter-notebook" # gem 'jekyll-graphviz', :path => "./jekyll-graphviz" end diff --git a/Gemfile.lock b/Gemfile.lock index 2e24cd2..80c6580 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,51 +4,75 @@ GIT specs: jekyll-graphviz (0.1.0) +GIT + remote: https://github.com/sidgwick/jekyll-jupyter-notebook + revision: 0805b888e7ed45e80495c0aefa2cb0a854f2a102 + specs: + jekyll-jupyter-notebook (0.0.6) + jekyll + GEM remote: https://gems.ruby-china.com/ specs: - activesupport (7.0.2.3) + activesupport (7.1.3.2) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) + base64 (0.2.0) + bigdecimal (3.1.6) colorator (1.1.0) - concurrent-ruby (1.1.10) + concurrent-ruby (1.2.3) + connection_pool (2.4.1) + drb (2.2.0) + ruby2_keywords em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) eventmachine (1.2.7) - ffi (1.15.5) + ffi (1.16.3) forwardable-extended (2.6.0) - gemoji (3.0.1) - html-pipeline (2.14.1) + gemoji (4.1.0) + google-protobuf (3.25.3) + google-protobuf (3.25.3-aarch64-linux) + google-protobuf (3.25.3-arm64-darwin) + google-protobuf (3.25.3-x86-linux) + google-protobuf (3.25.3-x86_64-darwin) + google-protobuf (3.25.3-x86_64-linux) + html-pipeline (2.14.3) activesupport (>= 2) nokogiri (>= 1.4) http_parser.rb (0.8.0) - i18n (1.10.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) - jekyll (4.2.2) + jekyll (4.3.3) addressable (~> 2.4) colorator (~> 1.0) em-websocket (~> 0.5) i18n (~> 1.0) - jekyll-sass-converter (~> 2.0) + jekyll-sass-converter (>= 2.0, < 4.0) jekyll-watch (~> 2.0) - kramdown (~> 2.3) + kramdown (~> 2.3, >= 2.3.1) kramdown-parser-gfm (~> 1.0) liquid (~> 4.0) - mercenary (~> 0.4.0) + mercenary (>= 0.3.6, < 0.5) pathutil (~> 0.9) - rouge (~> 3.0) + rouge (>= 3.0, < 5.0) safe_yaml (~> 1.0) - terminal-table (~> 2.0) - jekyll-feed (0.16.0) + terminal-table (>= 1.8, < 4.0) + webrick (~> 1.7) + jekyll-feed (0.17.0) jekyll (>= 3.7, < 5.0) jekyll-paginate (1.1.0) - jekyll-sass-converter (2.2.0) - sassc (> 2.0.1, < 3.0) + jekyll-sass-converter (3.0.0) + sass-embedded (~> 1.54) jekyll-sitemap (1.4.0) jekyll (>= 3.7, < 5.0) jekyll-text-theme (2.2.6) @@ -59,50 +83,93 @@ GEM jemoji (~> 0.8) jekyll-watch (2.2.1) listen (~> 3.0) - jemoji (0.12.0) - gemoji (~> 3.0) + jemoji (0.13.0) + gemoji (>= 3, < 5) html-pipeline (~> 2.2) jekyll (>= 3.0, < 5.0) - kramdown (2.3.2) + kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - liquid (4.0.3) - listen (3.7.1) + liquid (4.0.4) + listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.4.0) - minitest (5.15.0) - nokogiri (1.13.3-x86_64-linux) + minitest (5.22.2) + mutex_m (0.2.0) + nokogiri (1.16.2-aarch64-linux) + racc (~> 1.4) + nokogiri (1.16.2-arm-linux) + racc (~> 1.4) + nokogiri (1.16.2-arm64-darwin) + racc (~> 1.4) + nokogiri (1.16.2-x86-linux) + racc (~> 1.4) + nokogiri (1.16.2-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.16.2-x86_64-linux) racc (~> 1.4) pathutil (0.16.2) forwardable-extended (~> 2.6) - public_suffix (4.0.6) - racc (1.6.0) - rb-fsevent (0.11.1) + public_suffix (5.0.4) + racc (1.7.3) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - rexml (3.2.5) - rouge (3.28.0) + rexml (3.2.6) + rouge (4.2.0) + ruby2_keywords (0.0.5) safe_yaml (1.0.5) - sassc (2.4.0) - ffi (~> 1.9) - terminal-table (2.0.0) - unicode-display_width (~> 1.1, >= 1.1.1) - tzinfo (2.0.4) + sass-embedded (1.71.1-aarch64-linux-gnu) + google-protobuf (~> 3.25) + sass-embedded (1.71.1-aarch64-linux-musl) + google-protobuf (~> 3.25) + sass-embedded (1.71.1-arm-linux-gnueabihf) + google-protobuf (~> 3.25) + sass-embedded (1.71.1-arm-linux-musleabihf) + google-protobuf (~> 3.25) + sass-embedded (1.71.1-arm64-darwin) + google-protobuf (~> 3.25) + sass-embedded (1.71.1-x86-linux-gnu) + google-protobuf (~> 3.25) + sass-embedded (1.71.1-x86-linux-musl) + google-protobuf (~> 3.25) + sass-embedded (1.71.1-x86_64-darwin) + google-protobuf (~> 3.25) + sass-embedded (1.71.1-x86_64-linux-gnu) + google-protobuf (~> 3.25) + sass-embedded (1.71.1-x86_64-linux-musl) + google-protobuf (~> 3.25) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - tzinfo-data (1.2022.1) + tzinfo-data (1.2024.1) tzinfo (>= 1.0.0) - unicode-display_width (1.8.0) + unicode-display_width (2.5.0) + webrick (1.8.1) PLATFORMS - ruby + aarch64-linux-gnu + aarch64-linux-musl + arm-linux + arm-linux-gnueabihf + arm-linux-musleabihf + arm64-darwin + x86-linux + x86-linux-gnu + x86-linux-musl + x86_64-darwin x86_64-linux + x86_64-linux-gnu + x86_64-linux-musl DEPENDENCIES jekyll-graphviz! + jekyll-jupyter-notebook! jekyll-text-theme tzinfo-data BUNDLED WITH - 2.3.10 + 2.5.6 diff --git a/_config.yml b/_config.yml index cf852be..de55beb 100644 --- a/_config.yml +++ b/_config.yml @@ -222,4 +222,4 @@ plugins: - jekyll-paginate - jekyll-sitemap - jemoji - # - jekyll-jupyter-notebook + - jekyll-jupyter-notebook diff --git a/_posts/ai/ntu/2024-02-27-Machine-Learning-Mathematical-Foundations-hw2.md b/_posts/ai/ntu/2024-02-27-Machine-Learning-Mathematical-Foundations-hw2.md index 9ff895d..d36de32 100644 --- a/_posts/ai/ntu/2024-02-27-Machine-Learning-Mathematical-Foundations-hw2.md +++ b/_posts/ai/ntu/2024-02-27-Machine-Learning-Mathematical-Foundations-hw2.md @@ -8,4 +8,8 @@ tags: ai ntu machine-learning mathematical-foundations +{::nomarkdown} +{% jupyter_notebook "decision_stump.ipynb" %} +{:/nomarkdown} + {% include_relative decision_stump.html %} diff --git a/_posts/ai/ntu/decision_stump.ipynb b/_posts/ai/ntu/decision_stump.ipynb index 3878413..60946be 100644 --- a/_posts/ai/ntu/decision_stump.ipynb +++ b/_posts/ai/ntu/decision_stump.ipynb @@ -150,7 +150,7 @@ "\n", "至于 $s$, 它仅可以取 $\\{-1, +1\\}$.\n", "\n", - "> 出于计算后面的 19/20 题通用考虑, 下面的代码里面对第一个和最后一个 $\\theta$ 的处理, 不是用的 $-1$, $+1$ 的边界, 而是用的 $ x_0 - 1$ 和 $ x_20 + 1 $." + "> 出于计算后面的 19/20 题通用考虑, 下面的代码里面对第一个和最后一个 $\\theta$ 的处理, 不是用的 $-1$ 和 $+1$ 边界, 而是用的 $ x_0 - 1$ 和 $ x_{20} + 1 $." ] }, { @@ -267,13 +267,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Question 18\n", + "## Question 18\n", "\n", "**解:**\n", "\n", "参考 Question 17 里面关于 $E_{out}$ 的计算.\n", "\n", - "---\n", + "-----\n", "\n", "我最开始的更新错误部分的写法实际上是:\n", "\n", @@ -304,7 +304,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Question 19\n", + "## Question 19\n", "\n", "决策树桩也适用于多维数据. 特别地, 现在每个决策树桩处理一个特定的维度 $i$, 如下:\n", "\n", @@ -391,7 +391,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Question 20\n", + "## Question 20\n", "\n", "用第 19 题求得的 params, 在 $\\mathcal{D}_{test}$ 上面执行预测, 并收集每个维度上的错误情况, 最后报告一个最小的错误." ] diff --git a/_posts/javascript/vue/2024-01-24-vue-web-component.md b/_posts/javascript/vue/2024-01-24-vue-web-component.md index 4bdb26a..0eccb13 100644 --- a/_posts/javascript/vue/2024-01-24-vue-web-component.md +++ b/_posts/javascript/vue/2024-01-24-vue-web-component.md @@ -4,8 +4,6 @@ date: 2024-01-24 19:00:00 tags: javascript vue --- -{% raw %} - # 准备 安装 vue 命令行工具: @@ -24,6 +22,8 @@ tags: javascript vue +{% raw %} + ```text Vue CLI v5.0.8 ? Please pick a preset: Manually select features diff --git a/bootstrap.sh b/bootstrap.sh index aaf7a6e..7287630 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,11 +1,10 @@ #!/bin/bash -gem install bundler:2.3.10 +gem install bundler:2.5.6 bundler --version gem install rexml -v 3.2.5 +gem install jekyll-jupyter-notebook bundle install -jekyll build +jekyll build --trace # jekyll serve -H 0.0.0.0 - -