Imported all the notebooks
[tm351-notebooks.git] / notebooks / Styler.ipynb
diff --git a/notebooks/Styler.ipynb b/notebooks/Styler.ipynb
new file mode 100644 (file)
index 0000000..48ab1e9
--- /dev/null
@@ -0,0 +1,729 @@
+{
+ "metadata": {
+  "name": "",
+  "signature": "sha256:aa888edcf2c16c8b4933dee5ed6b0c5a477cb791c7c98c205e837c71a73ebdc1"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+  {
+   "cells": [
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "!curl -L https://gist.github.com/psychemedia/273b72fd2256c4efdd85/raw/answer_button.js > $(ipython locate profile)/static/custom/answer_button.js\n",
+      "!curl -L https://gist.github.com/psychemedia/b0c218135d2698648cbe/raw/activityCodeCell.js > $(ipython locate profile)/static/custom/activityCodeCell.js\n",
+      "!curl -L  https://gist.github.com/psychemedia/ab7bbc3aa731269bd3b4/raw/custom.css > $(ipython locate profile)/static/custom/custom.css\n"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\r\n",
+        "                                 Dload  Upload   Total   Spent    Left  Speed\r\n",
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0\r\n"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:07 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:08 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:09 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:10 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:11 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "100  1302  100  1302    0     0    111      0  0:00:11  0:00:11 --:--:--   309\r\n"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\r\n",
+        "                                 Dload  Upload   Total   Spent    Left  Speed\r\n",
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0\r\n"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:06 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:07 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:08 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:09 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:10 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:11 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "100  3847  100  3847    0     0    331      0  0:00:11  0:00:11 --:--:--   915\r\n"
+       ]
+      }
+     ],
+     "prompt_number": 11
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#In $(ipython locate profile)/static/custom/custom.js\n",
+      "## $([IPython.events]).on('app_initialized.NotebookApp', function(){ require(['custom/answer_buttons'])});\n",
+      "!sed -i '$a $([IPython.events]).on(\"app_initialized.NotebookApp\", function(){ require([\"custom/answer_buttons\",\"custom/activityCodeCell\"])});' $(ipython locate profile)/static/custom/custom.js"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [],
+     "prompt_number": 5
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": []
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": []
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": []
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#Remove last line of custom.js \n",
+      "#! sed '$d' <  $(ipython locate profile)/static/custom/custom.js > tmpcjs ; mv tmpcjs $(ipython locate profile)/static/custom/custom.js"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [],
+     "prompt_number": 4
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "NO...\n",
+      "\n",
+      "Follow:\n",
+      "\n",
+      "https://gist.github.com/psychemedia/ab7bbc3aa731269bd3b4 <- currently contains deprecated cells\n",
+      "\n",
+      "replacing URL_TO with *https://gist.github.com/psychemedia/ab7bbc3aa731269bd3b4/raw*"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "!head -n 500  $(ipython locate profile)/static/custom/custom.js"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "// leave at least 2 line with only a star on it below, or doc generation fails\r\n",
+        "/**\r\n",
+        " *\r\n",
+        " *\r\n",
+        " * Placeholder for custom user javascript\r\n",
+        " * mainly to be overridden in profile/static/custom/custom.js\r\n",
+        " * This will always be an empty file in IPython\r\n",
+        " *\r\n",
+        " * User could add any javascript in the `profile/static/custom/custom.js` file\r\n",
+        " * (and should create it if it does not exist).\r\n",
+        " * It will be executed by the ipython notebook at load time.\r\n",
+        " *\r\n",
+        " * Same thing with `profile/static/custom/custom.css` to inject custom css into the notebook.\r\n",
+        " *\r\n",
+        " * Example :\r\n",
+        " *\r\n",
+        " * Create a custom button in toolbar that execute `%qtconsole` in kernel\r\n",
+        " * and hence open a qtconsole attached to the same kernel as the current notebook\r\n",
+        " *\r\n",
+        " *    $([IPython.events]).on('app_initialized.NotebookApp', function(){\r\n",
+        " *        IPython.toolbar.add_buttons_group([\r\n",
+        " *            {\r\n",
+        " *                 'label'   : 'run qtconsole',\r\n",
+        " *                 'icon'    : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons\r\n",
+        " *                 'callback': function () {\r\n",
+        " *                     IPython.notebook.kernel.execute('%qtconsole')\r\n",
+        " *                 }\r\n",
+        " *            }\r\n",
+        " *            // add more button here if needed.\r\n",
+        " *            ]);\r\n",
+        " *    });\r\n",
+        " *\r\n",
+        " * Example :\r\n",
+        " *\r\n",
+        " *  Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );`\r\n",
+        " *  to load custom script into the notebook.\r\n",
+        " *\r\n",
+        " *    // to load the metadata ui extension example.\r\n",
+        " *    $.getScript('/static/notebook/js/celltoolbarpresets/example.js');\r\n",
+        " *    // or\r\n",
+        " *    // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert\r\n",
+        " *    $.getScript('/static/notebook/js/celltoolbarpresets/slideshow.js');\r\n",
+        " *\r\n",
+        " *\r\n",
+        " * @module IPython\r\n",
+        " * @namespace IPython\r\n",
+        " * @class customjs\r\n",
+        " * @static\r\n",
+        " */\r\n",
+        "$([IPython.events]).on(\"app_initialized.NotebookApp\", function(){ require([\"custom/answer_buttons\",\"custom/activityCodeCell\"])});\r\n"
+       ]
+      }
+     ],
+     "prompt_number": 1
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "!ls $(ipython locate profile)/static/custom/\n"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "activityCodeCell.js  custom.css  custom.js\r\n"
+       ]
+      }
+     ],
+     "prompt_number": 2
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "!curl -L  https://gist.githubusercontent.com/psychemedia/b0c218135d2698648cbe/raw/activityCodeCell.js  > $(ipython locate profile)/static/custom/activityCodeCell.js    \n",
+      "#In $(ipython locate profile)/static/custom/custom.js\n",
+      "!sed -i '$a $([IPython.events]).on(\"app_initialized.NotebookApp\", function(){ require([\"custom/activityCodeCell\"])});' $(ipython locate profile)/static/custom/custom.js"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\r\n",
+        "                                 Dload  Upload   Total   Spent    Left  Speed\r\n",
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "100  3847    0  3847    0     0    641      0 --:--:--  0:00:05 --:--:--  1105\r\n"
+       ]
+      }
+     ],
+     "prompt_number": 1
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "!curl -L  https://gist.githubusercontent.com/psychemedia/273b72fd2256c4efdd85/raw/answer_button.js > $(ipython locate profile)/static/custom/answer_buttons.js\n",
+      "## \n",
+      "!sed -i '$a $([IPython.events]).on(\"app_initialized.NotebookApp\", function(){ require([\"custom/answer_buttons\"])});' $(ipython locate profile)/static/custom/custom.js"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\r\n",
+        "                                 Dload  Upload   Total   Spent    Left  Speed\r\n",
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0"
+       ]
+      },
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\r",
+        "100  1302    0  1302    0     0    219      0 --:--:--  0:00:05 --:--:--   379\r\n"
+       ]
+      }
+     ],
+     "prompt_number": 2
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#Delete last line of file\n",
+      "#! sed '$d' <  $(ipython locate profile)/static/custom/custom.js > tmpcjs ; mv tmpcjs $(ipython locate profile)/static/custom/custom.js"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [],
+     "prompt_number": 7
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "!head -n 100  $(ipython locate profile)/static/custom/custom.js\n"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "// leave at least 2 line with only a star on it below, or doc generation fails\r\n",
+        "/**\r\n",
+        " *\r\n",
+        " *\r\n",
+        " * Placeholder for custom user javascript\r\n",
+        " * mainly to be overridden in profile/static/custom/custom.js\r\n",
+        " * This will always be an empty file in IPython\r\n",
+        " *\r\n",
+        " * User could add any javascript in the `profile/static/custom/custom.js` file\r\n",
+        " * (and should create it if it does not exist).\r\n",
+        " * It will be executed by the ipython notebook at load time.\r\n",
+        " *\r\n",
+        " * Same thing with `profile/static/custom/custom.css` to inject custom css into the notebook.\r\n",
+        " *\r\n",
+        " * Example :\r\n",
+        " *\r\n",
+        " * Create a custom button in toolbar that execute `%qtconsole` in kernel\r\n",
+        " * and hence open a qtconsole attached to the same kernel as the current notebook\r\n",
+        " *\r\n",
+        " *    $([IPython.events]).on('app_initialized.NotebookApp', function(){\r\n",
+        " *        IPython.toolbar.add_buttons_group([\r\n",
+        " *            {\r\n",
+        " *                 'label'   : 'run qtconsole',\r\n",
+        " *                 'icon'    : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons\r\n",
+        " *                 'callback': function () {\r\n",
+        " *                     IPython.notebook.kernel.execute('%qtconsole')\r\n",
+        " *                 }\r\n",
+        " *            }\r\n",
+        " *            // add more button here if needed.\r\n",
+        " *            ]);\r\n",
+        " *    });\r\n",
+        " *\r\n",
+        " * Example :\r\n",
+        " *\r\n",
+        " *  Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );`\r\n",
+        " *  to load custom script into the notebook.\r\n",
+        " *\r\n",
+        " *    // to load the metadata ui extension example.\r\n",
+        " *    $.getScript('/static/notebook/js/celltoolbarpresets/example.js');\r\n",
+        " *    // or\r\n",
+        " *    // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert\r\n",
+        " *    $.getScript('/static/notebook/js/celltoolbarpresets/slideshow.js');\r\n",
+        " *\r\n",
+        " *\r\n",
+        " * @module IPython\r\n",
+        " * @namespace IPython\r\n",
+        " * @class customjs\r\n",
+        " * @static\r\n",
+        " */\r\n",
+        "$([IPython.events]).on(\"app_initialized.NotebookApp\", function(){ require([\"custom/activityCodeCell\"])});\r\n",
+        "$([IPython.events]).on(\"app_initialized.NotebookApp\", function(){ require([\"custom/answer_buttons\"])});\r\n"
+       ]
+      }
+     ],
+     "prompt_number": 9
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "/bin/sh: 1: deb: not found\r\n"
+       ]
+      }
+     ],
+     "prompt_number": 10
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "!echo  $(ipython locate profile)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "/root/.ipython/profile_default\r\n"
+       ]
+      }
+     ],
+     "prompt_number": 1
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": []
+    }
+   ],
+   "metadata": {}
+  }
+ ]
+}
\ No newline at end of file