nb_util 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,235 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {
6
+ "toc": "true"
7
+ },
8
+ "source": [
9
+ "# Table of Contents\n",
10
+ " <p><div class=\"lev1 toc-item\"><a href=\"#copy&amp;pasteの実装\" data-toc-modified-id=\"copy&amp;pasteの実装-1\"><span class=\"toc-item-num\">1&nbsp;&nbsp;</span>copy&amp;pasteの実装</a></div>"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "markdown",
15
+ "metadata": {},
16
+ "source": [
17
+ "# copy&pasteの実装\n",
18
+ "\n",
19
+ "ipynbではおなじsessionのなかではcopy&paseができるが,ファイルをまたいだcopy&pasteがないみたい.\n",
20
+ "\n",
21
+ "そこでrubyで実装した.\n",
22
+ "targetsは\n",
23
+ "```\n",
24
+ "src = './numerical_calc/python_ode.ipynb'\n",
25
+ "target = './symbolic_math/cg.ipynb'\n",
26
+ "```\n",
27
+ "\n",
28
+ "1. 最初にjsonにより読み込む\n",
29
+ "1. ipynbは'cells','metadata','nbformat','nbformat_minor'からなるhashであることを確認\n",
30
+ "1. cell内のsourceで#から始めるものを表示\n",
31
+ "1. src_s,src_fとしてその間をcopyに貯める\n",
32
+ "1. targetのcellsの最後に追加.\n",
33
+ "\n",
34
+ "あとは,tmp.ipynbを開いて適当なところにcut&paste.\n",
35
+ "\n"
36
+ ]
37
+ },
38
+ {
39
+ "cell_type": "code",
40
+ "execution_count": 23,
41
+ "metadata": {},
42
+ "outputs": [
43
+ {
44
+ "name": "stdout",
45
+ "output_type": "stream",
46
+ "text": [
47
+ "cells\n",
48
+ "metadata\n",
49
+ "nbformat\n",
50
+ "nbformat_minor\n",
51
+ "source\n",
52
+ "\"# Table of Contents\"\n",
53
+ "\"# Euler法による落下運動\"\n",
54
+ "\"## Euler法\"\n",
55
+ "\"## 空気抵抗がある水滴の落下\"\n",
56
+ "\"# %notebook inline\"\n",
57
+ "\"# 高精度計算\"\n",
58
+ "\"## 2次のRunge-Kuttaの導出\"\n",
59
+ "\"## Runge-Kutta2次公式\"\n",
60
+ "\"## Runge-Kutta4次公式\"\n",
61
+ "\"## 連立方程式にRunge-Kutta4次公式を\"\n",
62
+ "\"# %notebook inline\"\n",
63
+ "\"# RLC回路の応答\"\n",
64
+ "\"# 課題\"\n",
65
+ "\n"
66
+ ]
67
+ }
68
+ ],
69
+ "source": [
70
+ "require 'json'\n",
71
+ "require 'pp'\n",
72
+ "j_src = open('./numerical_calc/python_ode.ipynb'){|file| JSON.load(file)}\n",
73
+ "j_trg = open('./symbolic_math/cg.ipynb'){|file| JSON.load(file)}\n",
74
+ "\n",
75
+ "j_src.each_pair do |key, val|\n",
76
+ " puts key\n",
77
+ "end\n",
78
+ "print \"source\\n\"\n",
79
+ "j_src['cells'].each do |val|\n",
80
+ " tmp = val['source'][0].chomp\n",
81
+ " p tmp if tmp.match(/^#/)\n",
82
+ "end\n",
83
+ "puts"
84
+ ]
85
+ },
86
+ {
87
+ "cell_type": "code",
88
+ "execution_count": 20,
89
+ "metadata": {},
90
+ "outputs": [
91
+ {
92
+ "name": "stdout",
93
+ "output_type": "stream",
94
+ "text": [
95
+ "source\n",
96
+ "true\n",
97
+ "false\n",
98
+ "\n",
99
+ "target\n",
100
+ "\n",
101
+ "modified target?\n",
102
+ "# Table of Contents\n",
103
+ "# CG(ComputerGraphics)\n",
104
+ "## listplot, pointplot \n",
105
+ "## 写像の表示 \n",
106
+ "## 回転写像 \n",
107
+ "## 平行投影図の作成 \n",
108
+ "## 透視図 \n",
109
+ "## Mapleの描画関数の覚書 \n",
110
+ "# 動画(Animation)\n",
111
+ "## matplotlibでanimation\n",
112
+ "## plotの動画\n",
113
+ "## animate関数 \n",
114
+ "## リストに貯めて,display表示 \n",
115
+ "## 凝った例 \n",
116
+ "## ファイルへの保存 \n",
117
+ "## Runge-Kutta4次公式\n",
118
+ "## 連立方程式にRunge-Kutta4次公式を\n",
119
+ "# %notebook inline\n",
120
+ "\n"
121
+ ]
122
+ },
123
+ {
124
+ "data": {
125
+ "text/plain": [
126
+ "#<File:tmp.ipynb (closed)>"
127
+ ]
128
+ },
129
+ "execution_count": 20,
130
+ "metadata": {},
131
+ "output_type": "execute_result"
132
+ }
133
+ ],
134
+ "source": [
135
+ "require 'json'\n",
136
+ "require 'pp'\n",
137
+ "j_src = open('./numerical_calc/python_ode.ipynb'){|i_f| JSON.load(i_f)}\n",
138
+ "j_trg = open('./symbolic_math/cg.ipynb'){|i_f| JSON.load(i_f)}\n",
139
+ "\n",
140
+ "src_s = '## Runge-Kutta4次公式'\n",
141
+ "src_f = '# RLC回路の応答'\n",
142
+ "\n",
143
+ "copy = []\n",
144
+ "on_copy = false\n",
145
+ "j_src['cells'].each do |val|\n",
146
+ " tmp = val['source'][0].chomp\n",
147
+ " case tmp\n",
148
+ " when src_s\n",
149
+ " on_copy=true\n",
150
+ " when src_f\n",
151
+ " on_copy=false\n",
152
+ " end\n",
153
+ " copy << val if on_copy\n",
154
+ "end\n",
155
+ "\n",
156
+ "copy.each do |val|\n",
157
+ " j_trg['cells'] << val\n",
158
+ "end\n",
159
+ "\n",
160
+ "print \"\\nmodified target?\\n\"\n",
161
+ "j_trg['cells'].each do |val|\n",
162
+ " tmp = val['source'][0].chomp\n",
163
+ " p tmp if tmp.match(/^#/)\n",
164
+ "end\n",
165
+ "print \"\\n\"\n",
166
+ "open('tmp.ipynb','w'){|o_f| JSON.dump(j_trg, o_f)}"
167
+ ]
168
+ },
169
+ {
170
+ "cell_type": "code",
171
+ "execution_count": null,
172
+ "metadata": {
173
+ "collapsed": true
174
+ },
175
+ "outputs": [],
176
+ "source": []
177
+ }
178
+ ],
179
+ "metadata": {
180
+ "kernelspec": {
181
+ "display_name": "Ruby 2.2.2",
182
+ "language": "ruby",
183
+ "name": "ruby"
184
+ },
185
+ "language_info": {
186
+ "file_extension": ".rb",
187
+ "mimetype": "application/x-ruby",
188
+ "name": "ruby",
189
+ "version": "2.2.2"
190
+ },
191
+ "latex_envs": {
192
+ "LaTeX_envs_menu_present": true,
193
+ "autocomplete": true,
194
+ "bibliofile": "biblio.bib",
195
+ "cite_by": "apalike",
196
+ "current_citInitial": 1,
197
+ "eqLabelWithNumbers": true,
198
+ "eqNumInitial": 1,
199
+ "hotkeys": {
200
+ "equation": "Ctrl-E",
201
+ "itemize": "Ctrl-I"
202
+ },
203
+ "labels_anchors": false,
204
+ "latex_user_defs": false,
205
+ "report_style_numbering": false,
206
+ "user_envs_cfg": false
207
+ },
208
+ "toc": {
209
+ "colors": {
210
+ "hover_highlight": "#DAA520",
211
+ "navigate_num": "#000000",
212
+ "navigate_text": "#333333",
213
+ "running_highlight": "#FF0000",
214
+ "selected_highlight": "#FFD700",
215
+ "sidebar_border": "#EEEEEE",
216
+ "wrapper_background": "#FFFFFF"
217
+ },
218
+ "moveMenuLeft": true,
219
+ "nav_menu": {
220
+ "height": "13px",
221
+ "width": "253px"
222
+ },
223
+ "navigate_menu": true,
224
+ "number_sections": true,
225
+ "sideBar": true,
226
+ "threshold": 4,
227
+ "toc_cell": true,
228
+ "toc_section_display": "block",
229
+ "toc_window_display": false,
230
+ "widenNotebook": false
231
+ }
232
+ },
233
+ "nbformat": 4,
234
+ "nbformat_minor": 2
235
+ }
@@ -0,0 +1,611 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {
6
+ "toc": true
7
+ },
8
+ "source": [
9
+ "<h1>Table of Contents<span class=\"tocSkip\"></span></h1>\n",
10
+ "<div class=\"toc\" style=\"margin-top: 1em;\"><ul class=\"toc-item\"><li><span><a href=\"#How-to-set-up-mac\" data-toc-modified-id=\"How-to-set-up-mac-1\"><span class=\"toc-item-num\">1&nbsp;&nbsp;</span>How to set-up mac</a></span><ul class=\"toc-item\"><li><span><a href=\"#auther-小脇-雅健\" data-toc-modified-id=\"auther-小脇-雅健-1.1\"><span class=\"toc-item-num\">1.1&nbsp;&nbsp;</span>auther 小脇 雅健</a></span></li></ul></li><li><span><a href=\"#動作環境又は,前提の情報\" data-toc-modified-id=\"動作環境又は,前提の情報-2\"><span class=\"toc-item-num\">2&nbsp;&nbsp;</span>動作環境又は,前提の情報</a></span><ul class=\"toc-item\"><li><span><a href=\"#OS\" data-toc-modified-id=\"OS-2.1\"><span class=\"toc-item-num\">2.1&nbsp;&nbsp;</span>OS</a></span></li><li><span><a href=\"#Apple-ID-/-Google-ID\" data-toc-modified-id=\"Apple-ID-/-Google-ID-2.2\"><span class=\"toc-item-num\">2.2&nbsp;&nbsp;</span>Apple ID / Google ID</a></span></li><li><span><a href=\"#Github\" data-toc-modified-id=\"Github-2.3\"><span class=\"toc-item-num\">2.3&nbsp;&nbsp;</span>Github</a></span><ul class=\"toc-item\"><li><span><a href=\"#ssh-keyの登録をし直す場合\" data-toc-modified-id=\"ssh-keyの登録をし直す場合-2.3.1\"><span class=\"toc-item-num\">2.3.1&nbsp;&nbsp;</span>ssh keyの登録をし直す場合</a></span></li></ul></li></ul></li><li><span><a href=\"#インストールした内容\" data-toc-modified-id=\"インストールした内容-3\"><span class=\"toc-item-num\">3&nbsp;&nbsp;</span>インストールした内容</a></span><ul class=\"toc-item\"><li><span><a href=\"#Xcode\" data-toc-modified-id=\"Xcode-3.1\"><span class=\"toc-item-num\">3.1&nbsp;&nbsp;</span>Xcode</a></span><ul class=\"toc-item\"><li><span><a href=\"#Xcode\" data-toc-modified-id=\"Xcode-3.1.1\"><span class=\"toc-item-num\">3.1.1&nbsp;&nbsp;</span>Xcode</a></span></li><li><span><a href=\"#Command-Line-Tools\" data-toc-modified-id=\"Command-Line-Tools-3.1.2\"><span class=\"toc-item-num\">3.1.2&nbsp;&nbsp;</span>Command Line Tools</a></span></li></ul></li><li><span><a href=\"#Homebrew\" data-toc-modified-id=\"Homebrew-3.2\"><span class=\"toc-item-num\">3.2&nbsp;&nbsp;</span>Homebrew</a></span></li><li><span><a href=\"#fish\" data-toc-modified-id=\"fish-3.3\"><span class=\"toc-item-num\">3.3&nbsp;&nbsp;</span>fish</a></span><ul class=\"toc-item\"><li><span><a href=\"#fish\" data-toc-modified-id=\"fish-3.3.1\"><span class=\"toc-item-num\">3.3.1&nbsp;&nbsp;</span>fish</a></span></li><li><span><a href=\"#fisherman\" data-toc-modified-id=\"fisherman-3.3.2\"><span class=\"toc-item-num\">3.3.2&nbsp;&nbsp;</span>fisherman</a></span></li></ul></li><li><span><a href=\"#emacs\" data-toc-modified-id=\"emacs-3.4\"><span class=\"toc-item-num\">3.4&nbsp;&nbsp;</span>emacs</a></span><ul class=\"toc-item\"><li><span><a href=\"#emacs\" data-toc-modified-id=\"emacs-3.4.1\"><span class=\"toc-item-num\">3.4.1&nbsp;&nbsp;</span>emacs</a></span></li><li><span><a href=\"#init.el\" data-toc-modified-id=\"init.el-3.4.2\"><span class=\"toc-item-num\">3.4.2&nbsp;&nbsp;</span>init.el</a></span></li></ul></li><li><span><a href=\"#rbenv\" data-toc-modified-id=\"rbenv-3.5\"><span class=\"toc-item-num\">3.5&nbsp;&nbsp;</span>rbenv</a></span></li><li><span><a href=\"#pyenv\" data-toc-modified-id=\"pyenv-3.6\"><span class=\"toc-item-num\">3.6&nbsp;&nbsp;</span>pyenv</a></span></li><li><span><a href=\"#jupyter-notebook\" data-toc-modified-id=\"jupyter-notebook-3.7\"><span class=\"toc-item-num\">3.7&nbsp;&nbsp;</span>jupyter notebook</a></span><ul class=\"toc-item\"><li><span><a href=\"#anaconda-and-jupyter-notebook\" data-toc-modified-id=\"anaconda-and-jupyter-notebook-3.7.1\"><span class=\"toc-item-num\">3.7.1&nbsp;&nbsp;</span>anaconda and jupyter notebook</a></span></li><li><span><a href=\"#ruby-kernel\" data-toc-modified-id=\"ruby-kernel-3.7.2\"><span class=\"toc-item-num\">3.7.2&nbsp;&nbsp;</span>ruby kernel</a></span><ul class=\"toc-item\"><li><span><a href=\"#conda\" data-toc-modified-id=\"conda-3.7.2.1\"><span class=\"toc-item-num\">3.7.2.1&nbsp;&nbsp;</span>conda</a></span></li><li><span><a href=\"#pip\" data-toc-modified-id=\"pip-3.7.2.2\"><span class=\"toc-item-num\">3.7.2.2&nbsp;&nbsp;</span>pip</a></span></li></ul></li></ul></li><li><span><a href=\"#tex\" data-toc-modified-id=\"tex-3.8\"><span class=\"toc-item-num\">3.8&nbsp;&nbsp;</span>tex</a></span><ul class=\"toc-item\"><li><span><a href=\"#MacTeX\" data-toc-modified-id=\"MacTeX-3.8.1\"><span class=\"toc-item-num\">3.8.1&nbsp;&nbsp;</span>MacTeX</a></span></li></ul></li></ul></li></ul></div>"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "markdown",
15
+ "metadata": {},
16
+ "source": [
17
+ "# How to set-up mac "
18
+ ]
19
+ },
20
+ {
21
+ "cell_type": "markdown",
22
+ "metadata": {},
23
+ "source": [
24
+ "## auther 小脇 雅健"
25
+ ]
26
+ },
27
+ {
28
+ "cell_type": "markdown",
29
+ "metadata": {},
30
+ "source": [
31
+ "# 動作環境又は,前提の情報"
32
+ ]
33
+ },
34
+ {
35
+ "cell_type": "markdown",
36
+ "metadata": {},
37
+ "source": [
38
+ "## OS\n",
39
+ "- macOS High Sierra 10.13.1で試している."
40
+ ]
41
+ },
42
+ {
43
+ "cell_type": "markdown",
44
+ "metadata": {},
45
+ "source": [
46
+ "## Apple ID / Google ID\n",
47
+ "- ID: d.konglaw@gmail.com\n",
48
+ "- Pass: Cslhome1"
49
+ ]
50
+ },
51
+ {
52
+ "cell_type": "markdown",
53
+ "metadata": {},
54
+ "source": [
55
+ "## Github"
56
+ ]
57
+ },
58
+ {
59
+ "cell_type": "markdown",
60
+ "metadata": {},
61
+ "source": [
62
+ "### ssh keyの登録をし直す場合\n",
63
+ "1. sshを登録する,sshが存在するかまずは確認\n",
64
+ "```ruby \n",
65
+ "ls .ssh\n",
66
+ "```\n",
67
+ "1. これで,id_rsa id_rsa.pubがあれば消去して作り直す\n",
68
+ "```ruby\n",
69
+ "ssh-keygen\n",
70
+ "```\n",
71
+ "1. これで,id_rsa id_rsa.pubが作成されるので,その中のid_rsa.pubをGithubに登録"
72
+ ]
73
+ },
74
+ {
75
+ "cell_type": "markdown",
76
+ "metadata": {},
77
+ "source": [
78
+ "# インストールした内容"
79
+ ]
80
+ },
81
+ {
82
+ "cell_type": "markdown",
83
+ "metadata": {},
84
+ "source": [
85
+ "## Xcode"
86
+ ]
87
+ },
88
+ {
89
+ "cell_type": "markdown",
90
+ "metadata": {},
91
+ "source": [
92
+ "### Xcode\n",
93
+ "1. Version 9.1\n",
94
+ " 1. 特にbrewなどは,Xcodeの**[Command Line Tools](http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/)**をインストールするために,macOSに対しての最新のバージョンがおそらく必要である.\n",
95
+ "1. Xcodeのインストールは,Apple Storeから,インストールできるのでインストールしてください.\n",
96
+ "1. インストール後に,ライセンスの同意が求められるので,同意してください."
97
+ ]
98
+ },
99
+ {
100
+ "cell_type": "markdown",
101
+ "metadata": {},
102
+ "source": [
103
+ "### Command Line Tools\n",
104
+ "1. **xcode-select --install**がインストールされているか,下記コマンドで確認できる.\n",
105
+ "```ruby\n",
106
+ "ls /Library/Developer/CommandLineTools/\n",
107
+ "```\n",
108
+ "1. 1.Aで紹介した,**Command Line Tools**がなければ下記コマンドで入手する\n",
109
+ "```ruby\n",
110
+ "xcode-select --install\n",
111
+ "```"
112
+ ]
113
+ },
114
+ {
115
+ "cell_type": "markdown",
116
+ "metadata": {},
117
+ "source": [
118
+ "## Homebrew\n",
119
+ "1. 下記情報は,[Homwbrew](http://brew.sh)を参考に\n",
120
+ "```ruby\n",
121
+ "ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"\n",
122
+ "=> 途中パスワードを入力必要があればログイン時パスワードを入力してください。\n",
123
+ "```"
124
+ ]
125
+ },
126
+ {
127
+ "cell_type": "markdown",
128
+ "metadata": {},
129
+ "source": [
130
+ "1. `brew doctor` をして下記のerrorが出たら,\n",
131
+ "\n",
132
+ "```ruby\n",
133
+ "Please note that these warnings are just used to help the Homebrew maintainers\n",
134
+ "with debugging if you file an issue. If everything you use Homebrew for is\n",
135
+ "working fine: please don't worry and just ignore them. Thanks!\n",
136
+ "\n",
137
+ "Warning: python is symlinked to python3\n",
138
+ "This will confuse build scripts and in general lead to subtle breakage.\n",
139
+ "\n",
140
+ "Warning: \"config\" scripts exist outside your system or Homebrew directories.\n",
141
+ "`./configure` scripts often look for *-config scripts to determine if\n",
142
+ "software packages are installed, and what additional flags to use when\n",
143
+ "compiling and linking.\n",
144
+ "\n",
145
+ "Having additional scripts in your path can confuse software installed via\n",
146
+ "Homebrew if the config script overrides a system or Homebrew provided\n",
147
+ "script of the same name. We found the following \"config\" scripts:\n",
148
+ " /Users/MAC/.pyenv/shims/icu-config\n",
149
+ " /Users/MAC/.pyenv/shims/libpng16-config\n",
150
+ " /Users/MAC/.pyenv/shims/python3.6m-config\n",
151
+ " /Users/MAC/.pyenv/shims/python-config\n",
152
+ " /Users/MAC/.pyenv/shims/python3-config\n",
153
+ " /Users/MAC/.pyenv/shims/python3.6-config\n",
154
+ "```\n",
155
+ "\n",
156
+ "1. `~/.config/fish/config.fish` に下記を追加\n",
157
+ "\n",
158
+ "```ruby\n",
159
+ "function brew\n",
160
+ " set -l index (contains -i $HOME/.pyenv/shims $PATH)\n",
161
+ " set PATH[$index] /bin # /bin is dummy\n",
162
+ " command brew $argv\n",
163
+ " set PATH[$index] $HOME/.pyenv/shims\n",
164
+ "end\n",
165
+ "```\n"
166
+ ]
167
+ },
168
+ {
169
+ "cell_type": "markdown",
170
+ "metadata": {},
171
+ "source": [
172
+ "## fish"
173
+ ]
174
+ },
175
+ {
176
+ "cell_type": "markdown",
177
+ "metadata": {},
178
+ "source": [
179
+ "### fish\n",
180
+ "1. brewよりfishを以下コマンドで実行.\n",
181
+ "```ruby\n",
182
+ "brew install fish\n",
183
+ "chsh -s /usr/local/bin/fish\n",
184
+ "```\n",
185
+ "```ruby\n",
186
+ "chsh: /usr/local/bin/fish: non-standard shell\n",
187
+ "```\n",
188
+ "と表示されたら,管理者権限で\n",
189
+ "```ruby \n",
190
+ "sudo emacs /etc/shells\n",
191
+ "```\n",
192
+ "/etc/shells に fish を追加していなかったため\n",
193
+ "ファイル末尾に「/usr/local/bin/fish」を追記\n",
194
+ "もう一度実行\n",
195
+ "```ruby\n",
196
+ "chsh -s /usr/local/bin/fish\n",
197
+ "```"
198
+ ]
199
+ },
200
+ {
201
+ "cell_type": "markdown",
202
+ "metadata": {},
203
+ "source": [
204
+ "### fisherman\n",
205
+ "1. install [fisherman](https://github.com/fisherman/fisherman)\n",
206
+ "```ruby\n",
207
+ "curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs https://git.io/fisher\n",
208
+ "```\n",
209
+ "1. install a plugin (themeのインストールと[font](https://github.com/powerline/fonts)の設定) \n",
210
+ "```ruby\n",
211
+ "fisher omf/theme-bobthefish\n",
212
+ "# clone\n",
213
+ "git clone https://github.com/powerline/fonts.git --depth=1\n",
214
+ "# install\n",
215
+ "cd fonts\n",
216
+ "./install.sh\n",
217
+ "# clean-up a bit\n",
218
+ "cd ..\n",
219
+ "rm -rf fonts\n",
220
+ "```\n",
221
+ "fontがインストールされたら,その後環環境設定を開いてfontを D2Coding for Powerlineに設定"
222
+ ]
223
+ },
224
+ {
225
+ "cell_type": "markdown",
226
+ "metadata": {},
227
+ "source": [
228
+ "## emacs"
229
+ ]
230
+ },
231
+ {
232
+ "cell_type": "markdown",
233
+ "metadata": {},
234
+ "source": [
235
+ "### emacs\n",
236
+ "macに元々入っているemacsでも良いが,バージョンがかなり古い.updateしたい方はしてね.\n",
237
+ "1. brewよりインストールする\n",
238
+ "```ruby\n",
239
+ "brew tap railwaycat/emacsmacport\n",
240
+ "brew install emacs-mac --with-modern-icon\n",
241
+ "```\n",
242
+ "2. emacsのバージョンを確認して,上がっていたら成功\n",
243
+ "```ruby\n",
244
+ "emacs --version\n",
245
+ "```"
246
+ ]
247
+ },
248
+ {
249
+ "cell_type": "markdown",
250
+ "metadata": {},
251
+ "source": [
252
+ "### init.el\n",
253
+ "emacsを文字をカラーにしたり設定する\n",
254
+ "emacsの設定ファイルが,\n",
255
+ "`\n",
256
+ "/Users/$(whoami)/.emacs.d\n",
257
+ "`\n",
258
+ "にあるので,その中に***init.el***ファイルを作成する.\n",
259
+ "下記に,サンプルを置いとくが,自分好みに設定することをお勧めする.\n",
260
+ "```ruby\n",
261
+ "; start package.el with emacs\n",
262
+ "(require 'package)\n",
263
+ "; add MELPA to repository list\n",
264
+ "(add-to-list 'package-archives '(\"melpa\" . \"http://melpa.milkbox.net/packages/\"))\n",
265
+ "; initialize package.el\n",
266
+ "(package-initialize)\n",
267
+ "; start auto-complete with emacs\n",
268
+ "(require 'auto-complete)\n",
269
+ "; do default config for auto-complete\n",
270
+ "(require 'auto-complete-config)\n",
271
+ "(ac-config-default)\n",
272
+ "\n",
273
+ "(electric-pair-mode 1)\n",
274
+ "\n",
275
+ "(require 'linum)\n",
276
+ "(global-linum-mode 1)\n",
277
+ "(package-initialize)\n",
278
+ "(setq package-archives\n",
279
+ " '((\"gnu\" . \"http://elpa.gnu.org/packages/\")\n",
280
+ " (\"melpa\" . \"http://melpa.org/packages/\")\n",
281
+ " (\"org\" . \"http://orgmode.org/elpa/\")))\n",
282
+ "\n",
283
+ ";----------------------------------------------------------------------\n",
284
+ ";パッケージの取得の追加\n",
285
+ ";----------------------------------------------------------------------\n",
286
+ "(require 'package)\n",
287
+ "(add-to-list 'package-archives '(\"melpa\" . \"http://melpa.milkbox.net/packages/\") t)\n",
288
+ "(add-to-list 'package-archives '(\"marmalade\" . \"http://marmalade-repo.org/packages/\"))\n",
289
+ "(package-initialize)\n",
290
+ ";-----------------------------------------------------------------------\n",
291
+ "\n",
292
+ "(setq load-path (cons \"~/.emacs.d/ruby-mode\" load-path))\n",
293
+ "(autoload 'ruby-mode \"ruby-mode\"\n",
294
+ " \"Mode for editing ruby source files\" t)\n",
295
+ "(add-to-list 'auto-mode-alist '(\"\\\\.rb$\" . ruby-mode))\n",
296
+ "\n",
297
+ "(set-language-environment \"Japanese\")\n",
298
+ "(setq default-input-method \"japanese-mozc\")\n",
299
+ "(prefer-coding-system 'utf-8)\n",
300
+ "\n",
301
+ "\n",
302
+ "; ------------------------------------------------------------------------\n",
303
+ "; auto-install\n",
304
+ "; http://www.emacswiki.org/emacs/download/auto-install.el\n",
305
+ "; ------------------------------------------------------------------------\n",
306
+ "(when(require 'auto-install nil t)\n",
307
+ ";;インストールディレクトリを設定。.emacs.d/elispに入れる。\n",
308
+ "(setq auto-install-directory \"~/.emacs.d/elisp/\")\n",
309
+ ";;EmacsWikiに登録されているelispの名前を取得する\n",
310
+ "(auto-install-update-emacswiki-package-name t)\n",
311
+ ";;必要であればプロキシの設定を行う\n",
312
+ ";;(setq url-proxy-services '((\"http\" . \"hogehoge\")))\n",
313
+ ";;install-elispの関数を利用可能にする\n",
314
+ "(auto-install-compatibility-setup))\n",
315
+ "(custom-set-variables\n",
316
+ " ;; custom-set-variables was added by Custom.\n",
317
+ " ;; If you edit it by hand, you could mess it up, so be careful.\n",
318
+ " ;; Your init file should contain only one such instance.\n",
319
+ " ;; If there is more than one, they won't work right.\n",
320
+ " '(package-selected-packages\n",
321
+ " (quote\n",
322
+ " (smooth-scroll package-utils yaml-mode flycheck undo-tree undohist web-mode rainbo\\\n",
323
+ " w-delimiters ac-dabbrev auto-complete-c-headers auto-complete nlinum))))\n",
324
+ "(custom-set-faces\n",
325
+ " ;; custom-set-faces was added by Custom.\n",
326
+ " ;; If you edit it by hand, you could mess it up, so be careful.\n",
327
+ " ;; Your init file should contain only one such instance.\n",
328
+ " ;; If there is more than one, they won't work right.\n",
329
+ " )\n",
330
+ "\n",
331
+ "(cond (window-system\n",
332
+ "(setq x-select-enable-clipboard t)\n",
333
+ "))\n",
334
+ "(put 'upcase-region 'disabled nil)\n",
335
+ "\n",
336
+ ";-------------------------------------------------------------------------\n",
337
+ ";undo-tree setting\n",
338
+ ";-------------------------------------------------------------------------\n",
339
+ ";; undohistの設定\n",
340
+ "(when (require 'undohist nil t)\n",
341
+ " (undohist-initialize))\n",
342
+ "\n",
343
+ ";; undo-treeモードの設定\n",
344
+ "(when (require 'undo-tree nil t)\n",
345
+ " (global-undo-tree-mode))\n",
346
+ "\n",
347
+ "\n",
348
+ ";-----------------------------------------------------------------------\n",
349
+ "(package-initialize)\n",
350
+ "(setq package-archives\n",
351
+ " '((\"gnu\" . \"http://elpa.gnu.org/packages/\")\n",
352
+ " (\"melpa\" . \"http://melpa.org/packages/\")\n",
353
+ " (\"org\" . \"http://orgmode.org/elpa/\")))\n",
354
+ "\n",
355
+ ";-----------------------------------------------------------------------\n",
356
+ ";-----------------------------------------------------------------------\n",
357
+ "(defface hlline-face\n",
358
+ " '((((class color)\n",
359
+ " (background dark))\n",
360
+ " (:background \"#ffa449\"))\n",
361
+ " (((class color)\n",
362
+ " (background light))\n",
363
+ " (:background \"#1e1e1e\"))\n",
364
+ " (t\n",
365
+ " ()))\n",
366
+ " \"*Face used by hl-line.\")\n",
367
+ "(setq hl-line-face 'hlline-face)\n",
368
+ ";; (setq hl-line-face 'underline) ; 下線\n",
369
+ "(global-hl-line-mode)\n",
370
+ "\n",
371
+ ";; flycheck\n",
372
+ "(add-hook 'ruby-mode-hook\n",
373
+ " '(lambda ()\n",
374
+ " (setq flycheck-checker 'ruby-rubocop)\n",
375
+ " (flycheck-mode 1)))\n",
376
+ "```"
377
+ ]
378
+ },
379
+ {
380
+ "cell_type": "markdown",
381
+ "metadata": {},
382
+ "source": [
383
+ "## rbenv"
384
+ ]
385
+ },
386
+ {
387
+ "cell_type": "markdown",
388
+ "metadata": {},
389
+ "source": [
390
+ "1. rbenvをbrewからインストール\n",
391
+ "```ruby\n",
392
+ "brew install rbenv\n",
393
+ "```\n",
394
+ "1. rbenvがインストールされたら,fishでrbenvの設定が自動でできるものがあるのでそれを使う\n",
395
+ "```ruby\n",
396
+ "fisher rbenv\n",
397
+ "```"
398
+ ]
399
+ },
400
+ {
401
+ "cell_type": "markdown",
402
+ "metadata": {},
403
+ "source": [
404
+ "## pyenv"
405
+ ]
406
+ },
407
+ {
408
+ "cell_type": "markdown",
409
+ "metadata": {},
410
+ "source": [
411
+ "1. pyenvをbrewからインストール\n",
412
+ "```ruby\n",
413
+ "brew install pyenv\n",
414
+ "```\n",
415
+ "1. pyenvがインストールされたら,fishでpyenvの設定が自動でできるものがあるのでそれを使う\n",
416
+ "```ruby\n",
417
+ "fisher pyenv\n",
418
+ "```"
419
+ ]
420
+ },
421
+ {
422
+ "cell_type": "markdown",
423
+ "metadata": {},
424
+ "source": [
425
+ "## jupyter notebook"
426
+ ]
427
+ },
428
+ {
429
+ "cell_type": "markdown",
430
+ "metadata": {},
431
+ "source": [
432
+ "### anaconda and jupyter notebook\n",
433
+ "anacondaを利用して,pythonとjupyter notebookの環境を構築する\n",
434
+ "```ruby\n",
435
+ "# installできるversionを探す\n",
436
+ "pyenv install -l\n",
437
+ "pyenv install anaconda3-5.0.0\n",
438
+ "```\n",
439
+ "今回は,anaconda3-5.0.0を使用してjupyter notebookを使用する"
440
+ ]
441
+ },
442
+ {
443
+ "cell_type": "markdown",
444
+ "metadata": {},
445
+ "source": [
446
+ "### ruby kernel\n",
447
+ "jupyter notebookでrubyを使うために,rubyのkernelを入れる\n",
448
+ "\n",
449
+ "zeromqとかの記述は,どっかで書いたのでまたリンク貼ります.\n",
450
+ "```ruby\n",
451
+ "brew install zeromq --HEAD\n",
452
+ "brew install czmq --HEAD\n",
453
+ "gem install cztop iruby\n",
454
+ "iruby register --force\n",
455
+ "```"
456
+ ]
457
+ },
458
+ {
459
+ "cell_type": "markdown",
460
+ "metadata": {},
461
+ "source": [
462
+ "### nbextensions"
463
+ ]
464
+ },
465
+ {
466
+ "cell_type": "markdown",
467
+ "metadata": {},
468
+ "source": [
469
+ "#### conda\n",
470
+ "jupyterにある拡張機能のnbextensionsをインストールする.\n",
471
+ "\n",
472
+ "anacondaでjupyterをinstallしているので,condaコマンドが使えるため,下記の方法でインストールする.\n",
473
+ "```ruby\n",
474
+ "conda install -y -c conda-forge jupyter_contrib_nbextensions\n",
475
+ "```"
476
+ ]
477
+ },
478
+ {
479
+ "cell_type": "markdown",
480
+ "metadata": {},
481
+ "source": [
482
+ "#### pip\n",
483
+ "condaでもインストールできるが,Table of Contentsの挙動が少しおかしいので,pipの方がいいかもしれない.\n",
484
+ "```ruby\n",
485
+ "pip install https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tarball/master\n",
486
+ "jupyter contrib nbextension install --user\n",
487
+ "```\n"
488
+ ]
489
+ },
490
+ {
491
+ "cell_type": "markdown",
492
+ "metadata": {},
493
+ "source": [
494
+ "## tex"
495
+ ]
496
+ },
497
+ {
498
+ "cell_type": "markdown",
499
+ "metadata": {},
500
+ "source": [
501
+ "### MacTeX\n",
502
+ "TeX Live をフルインストールする場合は MacTeX をインストールしてください.homebrewでMacTeX をインストールできます. Ghostscript などのツールも Homebrew でインストールできます.\n",
503
+ "```ruby\n",
504
+ "brew cask install mactex\n",
505
+ "# open new terminal\n",
506
+ "sudo tlmgr update --self --all\n",
507
+ "sudo tlmgr paper a4\n",
508
+ "```"
509
+ ]
510
+ },
511
+ {
512
+ "cell_type": "code",
513
+ "execution_count": null,
514
+ "metadata": {
515
+ "collapsed": true
516
+ },
517
+ "outputs": [],
518
+ "source": []
519
+ }
520
+ ],
521
+ "metadata": {
522
+ "kernelspec": {
523
+ "display_name": "Ruby 2.4.1",
524
+ "language": "ruby",
525
+ "name": "ruby"
526
+ },
527
+ "language_info": {
528
+ "file_extension": ".rb",
529
+ "mimetype": "application/x-ruby",
530
+ "name": "ruby",
531
+ "version": "2.4.2"
532
+ },
533
+ "latex_envs": {
534
+ "LaTeX_envs_menu_present": true,
535
+ "autocomplete": true,
536
+ "bibliofile": "biblio.bib",
537
+ "cite_by": "apalike",
538
+ "current_citInitial": 1,
539
+ "eqLabelWithNumbers": true,
540
+ "eqNumInitial": 1,
541
+ "hotkeys": {
542
+ "equation": "Ctrl-E",
543
+ "itemize": "Ctrl-I"
544
+ },
545
+ "labels_anchors": false,
546
+ "latex_user_defs": false,
547
+ "report_style_numbering": false,
548
+ "user_envs_cfg": false
549
+ },
550
+ "nbTranslate": {
551
+ "displayLangs": [
552
+ "*"
553
+ ],
554
+ "hotkey": "alt-t",
555
+ "langInMainMenu": true,
556
+ "sourceLang": "en",
557
+ "targetLang": "fr",
558
+ "useGoogleTranslate": true
559
+ },
560
+ "toc": {
561
+ "nav_menu": {
562
+ "height": "102px",
563
+ "width": "252px"
564
+ },
565
+ "number_sections": true,
566
+ "sideBar": true,
567
+ "skip_h1_title": false,
568
+ "toc_cell": true,
569
+ "toc_position": {
570
+ "height": "731px",
571
+ "left": "0px",
572
+ "right": "1130.955810546875px",
573
+ "top": "110.99264526367188px",
574
+ "width": "375px"
575
+ },
576
+ "toc_section_display": "block",
577
+ "toc_window_display": true
578
+ },
579
+ "varInspector": {
580
+ "cols": {
581
+ "lenName": 16,
582
+ "lenType": 16,
583
+ "lenVar": 40
584
+ },
585
+ "kernels_config": {
586
+ "python": {
587
+ "delete_cmd_postfix": "",
588
+ "delete_cmd_prefix": "del ",
589
+ "library": "var_list.py",
590
+ "varRefreshCmd": "print(var_dic_list())"
591
+ },
592
+ "r": {
593
+ "delete_cmd_postfix": ") ",
594
+ "delete_cmd_prefix": "rm(",
595
+ "library": "var_list.r",
596
+ "varRefreshCmd": "cat(var_dic_list()) "
597
+ }
598
+ },
599
+ "types_to_exclude": [
600
+ "module",
601
+ "function",
602
+ "builtin_function_or_method",
603
+ "instance",
604
+ "_Feature"
605
+ ],
606
+ "window_display": false
607
+ }
608
+ },
609
+ "nbformat": 4,
610
+ "nbformat_minor": 2
611
+ }