make it simple and take easy!
vagrant init hashicorp/precise32
vagrant init data-science-toolbox/dst
dst setup base
用来 create a password-protected profile.config.vm.network "forwarded_port", guest: 8888, host: 8888
我用 sublime Text 打开,其他的也可以。这里就如同bottle本地服务器的功能。模拟一个服务器,可以支持本地网页浏览。sudo ipython notebook --profile=dst
这一步最让人激动!https;//localhost:8888
访问http://nbviewer.ipython.org/github/
+ 后加上github链接中(https://github.com/
)后面的链接。这样出来如下结果。print 'hello ipython notebook!'
hello ipython notebook!
from IPython.display import Latex
Latex(r"$\sqrt{x^2+y^2}$")
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.mlab as mlab
mean = [10,12,16,22,25]
variance = [3,6,8,10,12]
x = np.linspace(0,40,1000)
for i in range(4):
sigma = np.sqrt(variance[i])
y = mlab.normpdf(x,mean[i],sigma)
plt.plot(x,y, label=r'$v_{}$'.format(i+1))
plt.xlabel("X")
plt.ylabel("P(X)")
<matplotlib.text.Text at 0x7f8968311ed0>
!pwd
/home/vagrant
%magic
%%bash
echo "My shell is:" $SHELL
echo "User:" $USER
My shell is: /bin/bash User: root
%%file test.txt
This is a test file!
It can contain anything I want...
more...
Writing test.txt
!ls
notebooks repos test.txt
!cat test.txt
This is a test file! It can contain anything I want... more...
%lsmagic
Available line magics: %alias %alias_magic %autocall %automagic %autosave %bookmark %cat %cd %clear %colors %config %connect_info %cp %debug %dhist %dirs %doctest_mode %ed %edit %env %gui %hist %history %install_default_config %install_ext %install_profiles %killbgscripts %ldir %less %lf %lk %ll %load %load_ext %loadpy %logoff %logon %logstart %logstate %logstop %ls %lsmagic %lx %macro %magic %man %matplotlib %mkdir %more %mv %notebook %page %pastebin %pdb %pdef %pdoc %pfile %pinfo %pinfo2 %popd %pprint %precision %profile %prun %psearch %psource %pushd %pwd %pycat %pylab %qtconsole %quickref %recall %rehashx %reload_ext %rep %rerun %reset %reset_selective %rm %rmdir %run %save %sc %store %sx %system %tb %time %timeit %unalias %unload_ext %who %who_ls %whos %xdel %xmode Available cell magics: %%! %%HTML %%SVG %%bash %%capture %%debug %%file %%html %%javascript %%latex %%perl %%prun %%pypy %%python %%python2 %%python3 %%ruby %%script %%sh %%svg %%sx %%system %%time %%timeit %%writefile Automagic is ON, % prefix IS NOT needed for line magics.
>>> # Fibonacci series:
... # the sum of two elements defines the next
... a, b = 0, 1
>>> while b < 10:
... print(b)
... a, b = b, a+b
1 1 2 3 5 8
In [1]: for i in range(5):
...: print(i)
...: print "---the end---"
0 1 2 3 4 ---the end---
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import gcf
x = np.linspace(0, 2*np.pi, 300)
y = np.sin(x**2)
plt.plot(x, y)
plt.title("A little chirp")
f = gcf() # let's keep the figure object around for later...