Skip to content

Instantly share code, notes, and snippets.

@probe301
Last active February 8, 2017 08:21
Show Gist options
  • Select an option

  • Save probe301/24d0ce22aa4cd8395bbd7d1bd796fe58 to your computer and use it in GitHub Desktop.

Select an option

Save probe301/24d0ce22aa4cd8395bbd7d1bd796fe58 to your computer and use it in GitHub Desktop.
Jupyter Notebook Gist
# multiple plot in grid
f, plots = plt.subplots(21, 10, sharex='all', sharey='all', figsize=(10, 21))
for i in range(203):
plots[i // 10, i % 10].axis('off')
plots[i // 10, i % 10].imshow(pat[i], cmap=plt.cm.bone)
# ===============
jupyterthemes
pip install --upgrade jupyterthemes
jt -t grade3 -fs 14 -cellw 1100 -f meslo
themes choose from
chesterish
monokai
oceans16
onedork
solarized-light
jupyterthemes coding fonts # 似乎不起作用
-f arg Monospace Font
consolamono Consolamono
dejavu DejaVu Sans Mono
inconsolata Inconsolata-g
meslo Meslo
oxygen Oxygen Mono
source Source Code Pro
sourcemed Source Code Pro Medium
# ===============
Jupyter notebook extensions
pip install https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tarball/master
or
pip install jupyter_contrib_nbextensions
pip 安装依赖包时会出错, 需要先
conda update setuptools
然后就顺利运行了
jupyter contrib nbextension install --system
===============
jupyter javascript hotkeys
%%javascript
Jupyter.keyboard_manager.command_shortcuts.add_shortcut('f5', {
help : 'run cell',
handler : function (event) {
IPython.notebook.execute_cell();
return false;
}}
);
Jupyter.keyboard_manager.command_shortcuts.add_shortcut('ctrl-.', {
help : 'run cell',
handler : function (event) {
IPython.notebook.execute_cell();
return false;
}}
);
Jupyter.keyboard_manager.edit_shortcuts.add_shortcut('f5', {
help : 'run cell',
handler : function (event) {
IPython.notebook.execute_cell();
return false;
}}
);
Jupyter.keyboard_manager.edit_shortcuts.add_shortcut('ctrl-.', {
help : 'run cell',
handler : function (event) {
IPython.notebook.execute_cell();
return false;
}}
);
Jupyter.keyboard_manager.edit_shortcuts.add_shortcut('ctrl-enter', {
help : 'none',
// 防止与 Sublime hotkey Ctrl+Enter 冲突
handler : function (event) {
return false;
}}
);
var cell = Jupyter.notebook.get_selected_cell();
var config = cell.config;
var patch = {
CodeCell: {
cm_config:{indentUnit: 2}
}
}
config.update(patch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment