ipython-notebook

IPython: How to wipe IPython's history selectively & securely?

自古美人都是妖i 提交于 2019-12-02 23:41:03
I have been learning how to use the paramiko package only to discover that all I stored passwords in plain text in IPython's %hist . Not so good. I therefore need to get rid of particular parts of what is stored in %hist . Saying that, I do not want to wipe the whole history . - Only the parts where I have been careless enough to type password = or similar chosen terms. Thanks Comments I don't need: %clear only clears the session. It does not wipe the history. Yes. I will only use xSA_keys from now on. Matt History is store on $(ipython locate)/profile_default/history.sqlite by default. You

Is there a way to print a jupyter/ipython notebook slide presentation?

五迷三道 提交于 2019-12-02 23:34:13
Is there a way to print out a slide deck of a jupyter/ipython notebook slides? Is it possible to do from the nbviewer site ( http://nbviewer.ipython.org ) ? I know that I can print a pdf of my notebook, but when I do, it doesn't have the same page breaks and doesn't skip all the code that I would like skipped (for example, the libraries I've imported aren't necessary). I'd like to have it as a backup or a printable handout. You can try this: jupyter nbconvert --to slides --post serve /path/to/your/notebook.ipynb This should fire up your browser and serve the presentation (e.g at http://127.0.0

How do I reset the Jupyter/IPython input prompt numbering?

蓝咒 提交于 2019-12-02 21:34:21
I just wrote my first extensive Python tutorial using IPython notebooks. All went well, except I did a lot of testing and moving blocks around. How do I reset the In [ ]: numbering? I have tried quitting and reloading, but that doesn't seem to work. I think, the only way to to what you want is: - 'Kernel > Restart' (restart the kernel) and then 'Cell > Run All' (run the script). You can reset the kernel (shortcut: C-m . ) and re-run the whole notebook. Quitting and reloading doesn't work because the code is not re-evaluated. 'Kernel' -> 'Restart & Run All' Just make sure you saved your

How can I open an IPython notebook without the output?

一个人想着一个人 提交于 2019-12-02 20:41:46
I have an IPython notebook where I've accidentally dumped a huge output (15 MB) that crashed the notebook. Now when I open the notebook and attempt to delete the troublesome cell, the notebook crashes again—thus preventing me from fixing the problem and restoring the notebook to stability. The best fix I can think of is manually pasting the input cells to a new notebook, but is there a way to just open the notebook without any outputs? There is this nice snippet (that I use as a git commit hook) to strip the output of an ipython notebook: #!/usr/bin/env python def strip_output(nb): for ws in

Changing the default port for iPython notebook server / Jupyter

偶尔善良 提交于 2019-12-02 20:29:50
I am trying to run an ipython notebook / jupyter server on a machine behind a firewall. The only port which is open is port 80. So was wondering how I can change the default port from 8890 to 80? I have ran the following command ipython profile create to create a profile. Then edited ipython_notebook_config.py and edited it to contain the following: c = get_config() c.NotebookApp.port = 80 When I try to run python notebook. I get the following error: ERROR: the notebook server could not be started because no available port could be found. Hoever, nothing else seems to be using port 80. Apache

function name + tab does not return docstring in IPython

跟風遠走 提交于 2019-12-02 20:24:16
In IPython, I am used to write function( and then strike a tab, and get the contents of the docstring and a list of the named arguments. However, this stopped working since I installed IPython 2.0. Is there an explanation or a know fix? Oh, the shortcut is now shift+tab . Shift-tab only works when you place the edit cursor inside or after the object. Not when it's at the start of the object. This gotcha is not documented anywhere...! I filed jupyter issue Shift-Tab completion doesn't work when edit cursor is at the start of the object #1902 来源: https://stackoverflow.com/questions/22850566

IPython (Jupyter) MathJaX preamble

旧时模样 提交于 2019-12-02 19:20:37
Question How can I setup a MathJax "preamble" for use in IPython (or Jupyter) notebooks for repeated use in a way that is convenient for others to read my documents (on http://nbviewer.org ) and that works for LaTeX/PDF generation? Background I would like to use IPython (now Jupyter) notebooks for documents that I later convert to PDF via LaTeX (using ipython nbconvert ). The problem is how to include a bunch of macro definitions that I use in almost every document. Something like: \newcommand{\vect}[1]{\vec{#1}} \newcommand{\abs}[1]{\lvert#1\rvert} \DeclareMathOperator{\erf}{erf} etc. As far

How to write text in ipython notebook?

﹥>﹥吖頭↗ 提交于 2019-12-02 17:24:38
Here is an example of IPython notebook in which besides the input and output cells we have a plain text. How can I do the same in my IPython notebook? At the moment I have inly In and Out cells. Matt Change the cell type to Markdown in the menu bar, from Code to Markdown . Currently in Notebook 4.x , the keyboard shortcut for such an action is: Esc (for command mode), then m (for markdown). As it is written in the documentation you have to change the cell type to a markdown. Adding to Matt's answer above (as I don't have comment privileges yet), one mouse-free workflow would be: Esc then m

Using IPython console along side IPython notebook

試著忘記壹切 提交于 2019-12-02 16:16:45
While working on an IPython notebook, I'm increasingly finding myself wishing that the notebook would have a console attached to it, for interactive programming. I find myself adding lines to test snippets of code and then deleting them and that's the good usage. In the worse usage I'm changing the commands in the same line, evaluating the line over and over, changing entirely the purpose of the line until I get it right, and then I'm Ctrl-Z ing all the way back to the original cell content. If I could have an interactive interpreter at the bottom of the notebook, that would definitely

How can I block comment code in the IPython notebook?

痞子三分冷 提交于 2019-12-02 16:14:31
I have defined a function in an IPython notebook and would like to be able to block comment a section of it. Intuitively, I'd expect to be able to highlight a section of code, right click and have an option to comment out the selection but this has not been implemented. Is there a way to do this? Default solution In IPython 2.x and 3.x (cmd|ctrl)-/ works but requires an english (american) keyboard layout, see https://github.com/ipython/ipython/pull/3673 . Other keyboard layouts In case you have a non-english keyboard layout, you can define a custom keybinding for the codemirror editor via your