Skip to content

Instantly share code, notes, and snippets.

@doowon
doowon / jupyter_systemd
Created Jul 22, 2016
A systemd script for jupyter
View jupyter_systemd
# After Ubuntu 16.04, Systemd becomes the default.
# It is simler than https://gist.github.com/Doowon/38910829898a6624ce4ed554f082c4dd
[Unit]
Description=Jupyter Notebook
[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=/usr/local/bin/jupyter notebook --no-browser --config=/home/jail/home/notebook/.jupyter/jupyter_notebook_config.py
@doowon
doowon / jupyter
Last active Jul 20, 2020 — forked from jmtatsch/jupyter
A service (init.d) script for jupyter
View jupyter
#! /bin/sh
### BEGIN INIT INFO
# Provides: jupyter
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start jupyter
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@doowon
doowon / jupyter_notebook_noneditable_markdown.js
Created Jul 22, 2016
Never allow markdown cells to be editable.
View jupyter_notebook_noneditable_markdown.js
// When a cell is clicked and the cell's mode is changed to the edit mode
// Then, this below event is called.
$([IPython.events]).on("edit_mode.Cell", function () {
if (IPython.notebook.get_selected_cell().cell_type == "markdown") {
IPython.notebook.execute_selected_cells();
}
});
@doowon
doowon / pythonexporter.py
Created Jul 22, 2016
nbconvert Python exporter example
View pythonexporter.py
import nbformat
from nbconvert import PythonExporter
exporter = PythonExporter()
(source, meta) = exporter.from_filename('something.ipynb')
# When NB object is used.
#with open('something.ipynb', 'r') as infile:
#nb = nbformat.reads(infile.read(), nbformat.NO_CONVERT)
#(source, meta) = exporter.from_notebook_node(nb)