Last active
July 22, 2018 09:00
-
-
Save u1and0/9b93f9a299bd4a9a4380b672f2da2d39 to your computer and use it in GitHub Desktop.
Jupyter, Ipythonの設定 ~起動、グラフの日本語表示、エイリアス、インライン表示、スタートアップモジュールインポート~ ref: https://qiita.com/u1and0/items/a926a7be5d182932a929
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [In] %load_ext autoreload # マジックコマンド%autoreloadをロードする | |
| [In] %autoreload hello | |
| [In] hello.hello() | |
| [Out] f**k! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __modules__ = ('numpy', | |
| 'pandas', | |
| 'matplotlib.pyplot', | |
| 'seaborn') | |
| __standfor__ = {'numpy': 'np', | |
| 'pandas': 'pd', | |
| 'matplotlib.pyplot': 'plt', | |
| 'seaborn': 'sns'} | |
| for __module__ in __modules__: | |
| __execution__ = 'import %s as %s' % (__module__, __standfor__[__module__]) | |
| print(__execution__) | |
| exec(__execution__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __inline__ = 'matplotlib inline' | |
| __gui__ = 'matplotlib auto' | |
| try: | |
| get_ipython().magic(__inline__) | |
| print('%' + __inline__) | |
| except: | |
| get_ipython().magic(__gui__) | |
| print('%' + __gui__) | |
| print("If you'd like to use `plt.show()` command,") | |
| print('you can type `plt.ioff()`/`plt.ion()` to turn interactive mode off/on.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmd /k "jupyter qtconsole --style=monokai" -new_console:t:"Jupyter" -new_console:b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmd /k "%ConEmuDir%\..\init.bat" -new_console:d:%HOME%\python & ipython |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UnknownBackend: No event loop integration for 'inline'. | |
| Supported event loops are: qt, qt4, qt5, gtk, gtk2, gtk3, tk, wx, pyglet, glut, osx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| If you use `plt.show()` command, | |
| you should use `plt.ioff()` to turn interactive mode off. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [In] %autoreload 2 # すべてのモジュールを常にリロード |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def hello(): | |
| print('hello') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def hello(): | |
| print('f**k!') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [In]import hello | |
| ## ~~hello.pyの書き換え~~ | |
| [In]import imp | |
| [In]imp.reload(hello) | |
| [In] hello.hello() | |
| [Out] f**k! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| c.AliasManager.user_aliases = [ | |
| # shell command | |
| ('ls', 'ls --show-control-chars -F --color'), | |
| ('grep', 'grep --color'), | |
| ('grepx', 'grep --color -nriC'), | |
| ('find', 'find . -name'), | |
| # git | |
| ('g', 'git'), | |
| ('gf', 'git flow'), | |
| # add,commit,push | |
| ('ga', 'git add'), | |
| ('gaa', 'git add .'), | |
| ('gan', 'git add -n .'), | |
| ('gaundo', 'git reset HEAD'), | |
| ('gc', 'git commit'), | |
| ('gac', 'git commit -am'), | |
| ('gcundo', 'git commit --amend'), | |
| ('gp', 'git push'), | |
| ('gpo', 'git push origin'), | |
| # status | |
| ('gs', 'git status --short --branch'), | |
| ('gd', 'git diff --color-words'), | |
| ('gls', 'git ls-files'), | |
| ('gl', 'git log --oneline --all --graph --decorate'), | |
| # branch | |
| ('gb', 'git branch'), | |
| ('gch', 'git checkout'), | |
| ('gm', 'git merge'), | |
| ('gt', 'git tag'), | |
| ] | |
| c.InteractiveShellApp.exec_lines = ['%load_ext autoreload', '%autoreload 2'] | |
| c.InlineBackend.rc = {'font.family': 'IPAMincho', | |
| 'figure.facecolor': (1, 1, 1, 1), | |
| 'savefig.dpi': 72, | |
| 'figure.subplot.bottom': 0.125, | |
| 'figure.edgecolor': (1, 1, 1, 1)} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [In] import hello | |
| [In] hello.hello() | |
| [Out] hello |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| c.InteractiveShellApp.exec_lines = ['%load_ext autoreload', '%autoreload 2'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| font.family : IPAMincho |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| def set(context="notebook", style="darkgrid", palette="deep", | |
| font="IPAMincho", font_scale=1, color_codes=False, rc=None): | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| c.InteractiveShellApp.exec_lines = ['%load_ext autoreload', '%autoreload 2'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [In] %autoreload 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jupyter notebook -new_console:t:"Jupyter Notebook" -new_console:b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ ipython profile create <name> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [In] import hello | |
| [In] hello.hello() | |
| [Out] hello | |
| ## ここは'f**k!'と表示されたかった。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment