Draft Forbes Group Website (Build by Nikola). The official site is hosted at:
License: GPL3
ubuntu2004
<?xml version="1.0" encoding="utf-8"?>1<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>The Forbes Group (Posts about notes)</title><link>http://swan.physics.wsu.edu/forbes/</link><description></description><atom:link href="http://swan.physics.wsu.edu/forbes/categories/cat_notes.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2023 <a href="mailto:Michael McNeil Forbes <[email protected]>">Michael McNeil Forbes</a> </copyright><lastBuildDate>Wed, 15 Mar 2023 01:00:14 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Nikola Website</title><link>http://swan.physics.wsu.edu/forbes/public/notes/nikola-website/</link><dc:creator>Michael McNeil Forbes</dc:creator><description><div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">2</div><div class="inner_cell">3<div class="text_cell_render border-box-sizing rendered_html">4<h2 id="Nikola-for-Websites">Nikola for Websites<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/nikola-website/#Nikola-for-Websites">¶</a></h2><p>In this post we describe how to we use Nikola for hosting research websites. Note: this is not a comprehensive discussion of Nikola's features but a streamlined explanation of the assumptions we make for simplified organization.</p>5<p><a href="http://swan.physics.wsu.edu/forbes/public/notes/nikola-website/">Read more…</a> (1 min remaining to read)</p></div></div></div></description><guid>http://swan.physics.wsu.edu/forbes/public/notes/nikola-website/</guid><pubDate>Thu, 12 Jul 2018 06:02:43 GMT</pubDate></item><item><title>CoCalc Workflow (formerly Sage Mathcloud)</title><link>http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/</link><dc:creator>Michael McNeil Forbes</dc:creator><description><div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">6</div><div class="inner_cell">7<div class="text_cell_render border-box-sizing rendered_html">8<p>We describe various strategies for working with <a href="https://cocalc.com">CoCalc</a> including version control, collaboration, and using Dropbox.</p>9<!-- END TEASER -->10<p><em>Note: In some places, such as my aliases, I still use the acronym SMC which refers to Sage Mathcloud – the previous name for CoCalc.</em></p>1112</div>13</div>14</div>15<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">16</div><div class="inner_cell">17<div class="text_cell_render border-box-sizing rendered_html">18<h2>Table of Contents<span class="tocSkip"></span></h2>19<div class="toc"><ul class="toc-item"><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#TL;DR" data-toc-modified-id="TL;DR-1"><span class="toc-item-num">1 </span>TL;DR</a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Setup" data-toc-modified-id="Setup-2"><span class="toc-item-num">2 </span>Setup</a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Custom-Environments" data-toc-modified-id="Custom-Environments-3"><span class="toc-item-num">3 </span>Custom Environments</a></span><ul class="toc-item"><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#TL;DR:" data-toc-modified-id="TL;DR:-3.1"><span class="toc-item-num">3.1 </span>TL;DR:</a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#MayaVi" data-toc-modified-id="MayaVi-3.2"><span class="toc-item-num">3.2 </span>MayaVi</a></span></li></ul></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#System-Software" data-toc-modified-id="System-Software-4"><span class="toc-item-num">4 </span>System Software</a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Synchronization" data-toc-modified-id="Synchronization-5"><span class="toc-item-num">5 </span>Synchronization</a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#MathJaX" data-toc-modified-id="MathJaX-6"><span class="toc-item-num">6 </span>MathJaX</a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#RClone-for-Google-Drive-etc." data-toc-modified-id="RClone-for-Google-Drive-etc.-7"><span class="toc-item-num">7 </span>RClone for Google Drive etc.</a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Notebook-Extensions" data-toc-modified-id="Notebook-Extensions-8"><span class="toc-item-num">8 </span>Notebook Extensions</a></span><ul class="toc-item"><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#(Old-Procedure:-Not-Needed-Anymore)" data-toc-modified-id="(Old-Procedure:-Not-Needed-Anymore)-8.1"><span class="toc-item-num">8.1 </span>(Old Procedure: Not Needed Anymore)</a></span></li></ul></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Raw-File-Access" data-toc-modified-id="Raw-File-Access-9"><span class="toc-item-num">9 </span>Raw File Access</a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Configuration-Files" data-toc-modified-id="Configuration-Files-10"><span class="toc-item-num">10 </span>Configuration Files</a></span><ul class="toc-item"><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Your-Computer" data-toc-modified-id="Your-Computer-10.1"><span class="toc-item-num">10.1 </span>Your Computer</a></span><ul class="toc-item"><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.bashrc" data-toc-modified-id="~/.bashrc-10.1.1"><span class="toc-item-num">10.1.1 </span><code>~/.bashrc</code></a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.ssh/config" data-toc-modified-id="~/.ssh/config-10.1.2"><span class="toc-item-num">10.1.2 </span><code>~/.ssh/config</code></a></span></li></ul></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#CoCalc-Project" data-toc-modified-id="CoCalc-Project-10.2"><span class="toc-item-num">10.2 </span>CoCalc Project</a></span><ul class="toc-item"><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.bash_alias" data-toc-modified-id="~/.bash_alias-10.2.1"><span class="toc-item-num">10.2.1 </span><code>~/.bash_alias</code></a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.inputrc" data-toc-modified-id="~/.inputrc-10.2.2"><span class="toc-item-num">10.2.2 </span><code>~/.inputrc</code></a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.hgrc" data-toc-modified-id="~/.hgrc-10.2.3"><span class="toc-item-num">10.2.3 </span><code>~/.hgrc</code></a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.hgignore" data-toc-modified-id="~/.hgignore-10.2.4"><span class="toc-item-num">10.2.4 </span><code>~/.hgignore</code></a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.gitconfig" data-toc-modified-id="~/.gitconfig-10.2.5"><span class="toc-item-num">10.2.5 </span><code>~/.gitconfig</code></a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.mrconfig" data-toc-modified-id="~/.mrconfig-10.2.6"><span class="toc-item-num">10.2.6 </span><code>~/.mrconfig</code></a></span></li></ul></li></ul></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#References" data-toc-modified-id="References-11"><span class="toc-item-num">11 </span>References</a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Old-Information-(Out-of-Data)" data-toc-modified-id="Old-Information-(Out-of-Data)-12"><span class="toc-item-num">12 </span>Old Information (Out of Data)</a></span><ul class="toc-item"><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Dropbox-no-longer-works!" data-toc-modified-id="Dropbox-no-longer-works!-12.1"><span class="toc-item-num">12.1 </span>Dropbox </a><a href="https://github.com/sagemathinc/cocalc/issues/11" target="_blank">no longer works!</a></span><ul class="toc-item"><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Dropbox-and-Version-Control" data-toc-modified-id="Dropbox-and-Version-Control-12.1.1"><span class="toc-item-num">12.1.1 </span>Dropbox and Version Control</a></span></li><li><span><a href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Dropbox-Issues" data-toc-modified-id="Dropbox-Issues-12.1.2"><span class="toc-item-num">12.1.2 </span>Dropbox Issues</a></span></li></ul></li></ul></li></ul></div>2021</div>22</div>23</div>24<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">25</div><div class="inner_cell">26<div class="text_cell_render border-box-sizing rendered_html">27<h2 id="TL;DR">TL;DR<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#TL;DR">¶</a></h2>28</div>29</div>30</div>31<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">32</div><div class="inner_cell">33<div class="text_cell_render border-box-sizing rendered_html">34<ol>35<li>Setup your local computer (once) as discussed below.</li>36<li>Create a CoCalc project, add network access etc., and add your ssh key, and create an alias on your local computer for convenience.</li>37<li>SSH to your CoCalc project and then do something like this:</li>38</ol>39<div class="highlight"><pre><span></span>ssh<span class="w"> </span>smcbec<span class="w"> </span><span class="c1"># Or whatever you called your alias</span>4041<span class="nb">cd</span><span class="w"> </span>~<span class="w"> </span><span class="c1"># Do this in the top level of your cocalc project.</span>4243cat<span class="w"> </span>&gt;&gt;<span class="w"> </span>~/.hgrc<span class="w"> </span><span class="s">&lt;&lt;EOF</span>44<span class="s">[ui]</span>45<span class="s">username = \$LC_HG_USERNAME</span>46<span class="s">merge = emacs</span>47<span class="s">paginate = never</span>4849<span class="s">[extensions]</span>50<span class="s"># Builtin extensions:</span>51<span class="s">rebase=</span>52<span class="s">graphlog=</span>53<span class="s">color=</span>54<span class="s">record=</span>55<span class="s">histedit=</span>56<span class="s">shelve=</span>57<span class="s">strip=</span>58<span class="s">#extdiff =</span>59<span class="s">#mq =</span>60<span class="s">#purge =</span>61<span class="s">#transplant =</span>62<span class="s">#evolve =</span>63<span class="s">#amend =</span>6465<span class="s">[color]</span>66<span class="s">custom.rev = red</span>67<span class="s">custom.author = blue</span>68<span class="s">custom.date = green</span>69<span class="s">custom.branches = red</span>7071<span class="s">[merge-tools]</span>72<span class="s">emacs.args = -q --eval "(ediff-merge-with-ancestor \""$local"\" \""$other"\" \""$base"\" nil \""$output"\")"</span>73<span class="s">EOF</span>7475cat<span class="w"> </span>&gt;&gt;<span class="w"> </span>~/.gitconfig<span class="w"> </span><span class="s">&lt;&lt;EOF</span>76<span class="s">[push]</span>77<span class="s"> default = simple</span>78<span class="s">[alias]</span>79<span class="s"> lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all</span>80<span class="s"> lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all</span>81<span class="s"> lg = !"git lg1"]</span>82<span class="s">EOF</span>8384cat<span class="w"> </span>&gt;&gt;<span class="w"> </span>~/.bash_aliases<span class="w"> </span><span class="s">&lt;&lt;EOF</span>85<span class="s"># Add some customizations for mercurial etc.</span>86<span class="s">. mmf_setup</span>8788<span class="s"># Specified here since .gitconfig will not expand the variables</span>89<span class="s">git config --global user.name "\${LC_GIT_USERNAME}"</span>90<span class="s">git config --global user.email "\${LC_GIT_USEREMAIL}"</span>91<span class="s">EOF</span>9293cat<span class="w"> </span>&gt;&gt;<span class="w"> </span>~/.hgignore<span class="w"> </span><span class="s">&lt;&lt;EOF</span>94<span class="s">syntax: glob</span>9596<span class="s">*.sage-history</span>97<span class="s">*.sage-chat</span>98<span class="s">*.sage-jupyter</span>99<span class="s">EOF</span>100101cat<span class="w"> </span>&gt;&gt;<span class="w"> </span>~/.inputrc<span class="w"> </span><span class="s">&lt;&lt;EOF</span>102<span class="s">"\M-[A": history-search-backward</span>103<span class="s">"\e[A": history-search-backward</span>104<span class="s">"\M-[B": history-search-forward</span>105<span class="s">"\e[B": history-search-forward</span>106<span class="s">EOF</span>107108cat<span class="w"> </span>&gt;&gt;<span class="w"> </span>~/.mrconfig<span class="w"> </span><span class="s">&lt;&lt;EOF</span>109<span class="s"># myrepos (mr) Config File; -*-Shell-script-*-</span>110<span class="s"># dest = ~/.mrconfig # Keep this as the 2nd line for mmf_init_setup</span>111112<span class="s">include = cat "${MMFHG}/mrconfig"</span>113114<span class="s">[DEFAULT]</span>115<span class="s">hg_out = hg out</span>116<span class="s">EOF</span>117118pip<span class="w"> </span>install<span class="w"> </span>--user<span class="w"> </span>mmf_setup119anaconda2019120121<span class="c1"># Should use conda or mamba, but this needs a new</span>122<span class="c1"># environment, so we just use pip for now.</span>123pip<span class="w"> </span>install<span class="w"> </span>--user<span class="w"> </span>mmf_setup<span class="w"> </span>mmfutils124125<span class="c1"># Create a work environment and associate a kernel</span>126mamba<span class="w"> </span>env<span class="w"> </span>create<span class="w"> </span>mforbes/work127mkdir<span class="w"> </span>-p<span class="w"> </span>~/.local/share/jupyter/kernels/128<span class="nb">cd</span><span class="w"> </span>~/.local/share/jupyter/kernels/129cp<span class="w"> </span>-r<span class="w"> </span>/ext/anaconda-2019.03/share/jupyter/kernels/python3<span class="w"> </span>work-py130cat<span class="w"> </span>&gt;<span class="w"> </span>~/.local/share/jupyter/kernels/work-py/kernel.json<span class="w"> </span><span class="s">&lt;&lt;EOF</span>131<span class="s"># kernel.json</span>132<span class="s">{</span>133<span class="s"> "argv": [</span>134<span class="s"> "/home/user/.conda/envs/work/bin/python",</span>135<span class="s"> "-m",</span>136<span class="s"> "ipykernel_launcher",</span>137<span class="s"> "-f",</span>138<span class="s"> "{connection_file}"</span>139<span class="s"> ],</span>140<span class="s"> "display_name": "work",</span>141<span class="s"> "language": "python"</span>142<span class="s">}</span>143<span class="s">EOF</span>144145exit-anaconda146147mkdir<span class="w"> </span>-p<span class="w"> </span>~/repositories148git<span class="w"> </span>clone<span class="w"> </span>git://myrepos.branchable.com/<span class="w"> </span>~/repositories/myrepos149ln<span class="w"> </span>-s<span class="w"> </span>~/repositories/myrepos/mr<span class="w"> </span>~/.local/bin/150</pre></div>151152</div>153</div>154</div>155<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">156</div><div class="inner_cell">157<div class="text_cell_render border-box-sizing rendered_html">158<h2 id="Setup">Setup<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Setup">¶</a></h2>159</div>160</div>161</div>162<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">163</div><div class="inner_cell">164<div class="text_cell_render border-box-sizing rendered_html">165<p><em>Knowledge: To follow these instructions you will need to understand how to work with the linux shell. If you are unfamilliar with the shell, please review the <a href="http://swcarpentry.github.io/shell-novice/">shell novice</a> course. For a discussion of environmental variables see <a href="https://www.digitalocean.com/community/tutorials/how-to-read-and-set-environmental-and-shell-variables-on-a-linux-vps">how to read and set environmental and shell variables</a>.</em></p>166<p>Prior to creating a new project I do the following <strong>on my local computer</strong>:</p>167<ol>168<li><p>Set the following environment variable in one of my startup file. CoCalc automatically sources <code>~/.bash_aliases</code> if it exists (this is specifeid in <code>~/.bashrc</code>) so I use it.:</p>169<div class="highlight"><pre><span></span><span class="c1"># ~/.bash_aliases</span>170...171<span class="c1"># This hack allows one to forward the environmental variables using</span>172<span class="c1"># ssh since LC_* variables are permitted by default.</span>173<span class="nb">export</span><span class="w"> </span><span class="nv">LC_HG_USERNAME</span><span class="o">=</span><span class="s2">"Michael McNeil Forbes &lt;[email protected]&gt;"</span>174<span class="nb">export</span><span class="w"> </span><span class="nv">LC_GIT_USEREMAIL</span><span class="o">=</span><span class="s2">"[email protected]"</span>175<span class="nb">export</span><span class="w"> </span><span class="nv">LC_GIT_USERNAME</span><span class="o">=</span><span class="s2">"Michael McNeil Forbes"</span>176</pre></div>177<p>Then in my <code>~/.hgrc</code> file I include the following:</p>178<div class="highlight"><pre><span></span><span class="c1"># ~/.hgrc</span>179<span class="k">[ui]</span>180<span class="na">username</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">$LC_HG_USERNAME</span>181</pre></div>182<p>This way, you specify your mercurial username in only one spot - the <code>LC_HG_USERNAME</code> environmental variable. (This is the <a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself">DRY</a> principle.)</p>183<p>A similar configuration should be used if you want to use <code>git</code> but variable expansion will <a href="https://stackoverflow.com/a/11262153">not work with git</a>. Instead, we need to set the user and email in the <code>.bash_aliases</code> file with something like:</p>184<div class="highlight"><pre><span></span><span class="c1"># ~/.bash_aliases</span>185git<span class="w"> </span>config<span class="w"> </span>--global<span class="w"> </span>user.name<span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"</span><span class="nv">$LC_GIT_USERNAME</span><span class="s2">"</span>186</pre></div>187</li>188</ol>189<p>git config --global user.name = "$LC_GIT_USEREMAIL"</p>190<pre><code>191*The reason for using a variable name staring with `LC_*` is that these variables are generally allowed by the `sshd` server so that they can be send when one uses ssh to connect to a project (see below).*1921932. Find the `host` and `username` for your CoCalc project (look under the project **Settings** page under the `&gt;_ SSH into your project...` section) and add these to my local ``~/.ssh/config`` file. For example: CoCalc might say to connect to `[email protected]`. This would mean I should add the following to my `~/.ssh/config` file:194195```ini196# ~/.ssh/config197Host smc*198ForwardAgent yes199SendEnv LC_HG_USERNAME200SendEnv LC_GIT_USERNAME201SendEnv LC_GIT_USEREMAIL202203Host smcbec204HostName compute5-us.sagemath.com205User e397631635174e21abaa7c59fa227655206</code></pre>207<p>The <code>SendEnv</code> instruction will then apply to all <code>smc*</code> hosts and sends the <code>LC_HG_USERNAME</code> environmental variable. This allows us to refer to this in the <code>~/.hgrc</code> file so that version control commands will log based on who issues them, which is useful because CoCalc does not provide user-level authentication (only project level). Thus, if a user sends this, then mercurial can use the appropriate username. (A similar setup with git should be possible). See <a href="https://github.com/sagemathinc/smc/issues/370">issue #370</a> for more information.</p>208209</div>210</div>211</div>212<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">213</div><div class="inner_cell">214<div class="text_cell_render border-box-sizing rendered_html">215<ol>216<li><p>Once the project has been created, I add the contents of my <code>~/.ssh/id_rsa.pub</code> to CoCalc using the web interface for SSH Keys. This allows me to login to my projects. <em>(On other systems, this would be the equivalent of adding it to <code>~/.ssh/authorized_keys</code>.)</em></p>217</li>218<li><p>Add any resources for the project. (For example, network access simplifies installing stuff below, and using a fixed host will prevent the compute node from changing so that the alias setup in the next step will keep working. However, you must pay for these upgrades.)</p>219</li>220<li><p>Create a <code>~/.hgrc</code> file like the following:</p>221<div class="highlight"><pre><span></span><span class="k">[ui]</span>222<span class="na">username</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">$LC_HG_USERNAME</span>223<span class="k">[extensions]</span>224225<span class="c1">#####################</span>226<span class="c1"># Builtin extensions:</span>227<span class="na">rebase</span><span class="o">=</span>228<span class="na">graphlog</span><span class="o">=</span>229<span class="na">color</span><span class="o">=</span>230<span class="na">record</span><span class="o">=</span>231<span class="na">histedit</span><span class="o">=</span>232<span class="na">shelve</span><span class="o">=</span>233<span class="na">strip</span><span class="o">=</span>234235<span class="k">[color]</span>236<span class="na">custom.rev</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">red</span>237<span class="na">custom.author</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blue</span>238<span class="na">custom.date</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">green</span>239<span class="na">custom.branches</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">red</span>240</pre></div>241<p>This one enables some extensions I find useful and specifies the username using the <code>$LC_HG_USERNAME</code> environmental variable sent by ssh in the previous step.</p>242</li>243<li><p>Create a <code>~/.gitconfig</code> file like the following:</p>244<div class="highlight"><pre><span></span><span class="k">[user]</span>245<span class="w"> </span><span class="na">name</span><span class="w"> </span><span class="o">=</span>246<span class="w"> </span><span class="na">email</span><span class="w"> </span><span class="o">=</span>247<span class="k">[push]</span>248<span class="w"> </span><span class="na">default</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">simple</span>249<span class="k">[alias]</span>250<span class="w"> </span><span class="na">lg1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all</span>251<span class="w"> </span><span class="na">lg2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all</span>252<span class="w"> </span><span class="na">lg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">!"git lg1"</span>253</pre></div>254<p>This one provide a useful <code>git lg</code> command and specifies the username using the <code>$LC_GIT_USERNAME</code> etc. environmental variable sent by ssh in the previous step.</p>255</li>256<li><p>Install the <a href="https://bitbucket.org/mforbes/mmf_setup"><code>mmf_setup</code></a> package (I do this also in the <code>anaconda3</code> environment):</p>257<div class="highlight"><pre><span></span>pip<span class="w"> </span>install<span class="w"> </span>mmf_setup258anaconda3259pip3<span class="w"> </span>install<span class="w"> </span>mmf_setup260exit-anaconda261</pre></div>262<p>Note: this requires you to have enabled network access in step 2.</p>263</li>264<li><p>(optional) Enable this by adding the following lines to your <code>~/.bash_aliases file</code> on :</p>265<div class="highlight"><pre><span></span>cat<span class="w"> </span>&gt;&gt;<span class="w"> </span>~/.bash_aliases<span class="w"> </span><span class="s">&lt;&lt;EOF</span>266<span class="s"># Add some customizations for mercurial etc.</span>267<span class="s">. mmf_setup</span>268<span class="s">git config --global user.name "\${LC_GIT_USERNAME}"</span>269<span class="s">git config --global user.email "\${LC_GIT_USEREMAIL}"</span>270<span class="s">EOF</span>271</pre></div>272<p>This will set your <code>$HGRCPATH</code> path so that you can use some of the tools I provide in my <a href="https://bitbucket.org/mforbes/mmf_setup"><code>mmf_setup</code></a> package, for example, the <code>hg ccommit</code> command which runs <code>nbstripout</code> to remove output from Jupyter notebooks before committing them.</p>273</li>274<li><p>(optional) I find the following settings very useful for tab completion etc., so I also add the following <code>~/.inputrc</code> file on CoCalc: <em>(The default configuration has <code>LC_ALL=C</code> so I do not need anything else, but see the comment below.)</em></p>275<div class="highlight"><pre><span></span><span class="c1">#~/.inputrc</span>276277<span class="c1"># This file is used by bash to define the key behaviours. The current</span>278<span class="c1"># version allows the up and down arrows to search for history items</span>279<span class="c1"># with a common prefix.</span>280<span class="c1">#</span>281<span class="c1"># Note: For these to be properly intepreted, you need to make sure your locale</span>282<span class="c1"># is properly set in your environment with something like:</span>283<span class="c1"># export LC_ALL=C</span>284285<span class="c1">#</span>286<span class="c1"># Arrow keys in keypad mode</span>287<span class="c1">#"\M-OD": backward-char</span>288<span class="c1">#"\M-OC": forward-char</span>289<span class="c1">#"\M-OA": previous-history</span>290<span class="c1">#"\M-OB": next-history</span>291<span class="c1">#</span>292<span class="c1"># Arrow keys in ANSI mode</span>293<span class="c1">#</span>294<span class="c1">#"\M-[D": backward-char</span>295<span class="c1">#"\M-[C": forward-char</span>296<span class="s2">"\M-[A"</span>:<span class="w"> </span>history-search-backward297<span class="s2">"\M-[B"</span>:<span class="w"> </span>history-search-forward298<span class="c1">#</span>299<span class="c1"># Arrow keys in 8 bit keypad mode</span>300<span class="c1">#</span>301<span class="c1">#"\M-\C-OD": backward-char</span>302<span class="c1">#"\M-\C-OC": forward-char</span>303<span class="c1">#"\M-\C-OA": previous-history</span>304<span class="c1">#"\M-\C-OB": next-history</span>305<span class="c1">#</span>306<span class="c1"># Arrow keys in 8 bit ANSI mode</span>307<span class="c1">#</span>308<span class="c1">#"\M-\C-[D": backward-char</span>309<span class="c1">#"\M-\C-[C": forward-char</span>310<span class="c1">#"\M-\C-[A": previous-history</span>311<span class="c1">#"\M-\C-[B": next-history</span>312</pre></div>313</li>314<li><p>(optional) Update and configure <code>pip</code> to install packages as a user:</p>315<div class="highlight"><pre><span></span>pip<span class="w"> </span>install<span class="w"> </span>--upgrade<span class="w"> </span>pip316<span class="nb">hash</span><span class="w"> </span>-r<span class="w"> </span><span class="c1"># Needed to use new pip before logging in again</span>317318mkdir<span class="w"> </span>-p<span class="w"> </span>~/.config/pip/319cat<span class="w"> </span>&gt;&gt;<span class="w"> </span>~/.config/pip/pip.conf<span class="w"> </span><span class="s">&lt;&lt;EOF</span>320<span class="s">[install]</span>321<span class="s">user = true</span>322<span class="s">find-links = https://bitbucket.org/mforbes/mypi/</span>323<span class="s">EOF</span>324</pre></div>325<p>The configuration uses my personal index which allows me to point to various revisions of my software.</p>326</li>327</ol>328329</div>330</div>331</div>332<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">333</div><div class="inner_cell">334<div class="text_cell_render border-box-sizing rendered_html">335<h2 id="Custom-Environments">Custom Environments<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Custom-Environments">¶</a></h2>336</div>337</div>338</div>339<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">340</div><div class="inner_cell">341<div class="text_cell_render border-box-sizing rendered_html">342<h3 id="TL;DR:">TL;DR:<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#TL;DR:">¶</a></h3>343</div>344</div>345</div>346<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">347</div><div class="inner_cell">348<div class="text_cell_render border-box-sizing rendered_html">349<p>Create an appropriate <code>environment.yml</code> file:</p>350<div class="highlight"><pre><span></span><span class="c1"># environment.yml</span>351name:<span class="w"> </span>_my_environment352channels:353<span class="w"> </span>-<span class="w"> </span>defaults354<span class="w"> </span>-<span class="w"> </span>conda-forge355dependencies:356<span class="w"> </span>-<span class="w"> </span><span class="nv">python</span><span class="o">=</span><span class="m">3</span>357<span class="w"> </span>-<span class="w"> </span>matplotlib358<span class="w"> </span>-<span class="w"> </span>scipy359<span class="w"> </span>-<span class="w"> </span>sympy360361<span class="w"> </span>-<span class="w"> </span>ipykernel362<span class="w"> </span>-<span class="w"> </span>ipython363<span class="w"> </span><span class="c1">#- notebook</span>364<span class="w"> </span><span class="c1">#- numexpr</span>365366<span class="w"> </span>-<span class="w"> </span>pytest367368<span class="w"> </span><span class="c1"># Profiling</span>369<span class="w"> </span>-<span class="w"> </span>line_profiler370<span class="w"> </span><span class="c1">#- psutil</span>371<span class="w"> </span>-<span class="w"> </span>memory_profiler372373<span class="w"> </span>-<span class="w"> </span>pip:374<span class="w"> </span>-<span class="w"> </span>mmf_setup375<span class="w"> </span>-<span class="w"> </span>hg+ssh://[email protected]/mforbes/[email protected]376</pre></div>377378</div>379</div>380</div>381<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">382</div><div class="inner_cell">383<div class="text_cell_render border-box-sizing rendered_html">384<p>We would like to move towards a workflow with custom conda environments. The idea is described here:</p>385<ul>386<li><a href="https://github.com/sagemathinc/cocalc/wiki/Programming#anaconda-sage">https://github.com/sagemathinc/cocalc/wiki/Programming#anaconda-sage</a></li>387</ul>388<div class="highlight"><pre><span></span>ssh<span class="w"> </span>smctov389anaconda2019390conda<span class="w"> </span>create<span class="w"> </span>-n<span class="w"> </span>work3<span class="w"> </span>--clone<span class="w"> </span>base<span class="w"> </span><span class="c1"># Clone the base environment</span>391</pre></div>392<p>Notes:</p>393<ul>394<li>Apparently this will download a whole bunch of stuff even though we are asking for a clone. This is a known issue: <a href="https://github.com/conda/constructor/issues/145">conda/constructor#145</a>, <a href="https://github.com/conda/conda/issues/7398">conda#7398</a>.</li>395</ul>396<p>Once you have a custom environment, you can locate it and make a <a href="https://doc.cocalc.com/howto/custom-jupyter-kernel.html">custom Jupyter kernel</a> for it. First locate the environment:</p>397<div class="highlight"><pre><span></span>$<span class="w"> </span>conda<span class="w"> </span>env<span class="w"> </span>list398<span class="c1"># conda environments:</span>399<span class="c1">#</span>400base<span class="w"> </span>*<span class="w"> </span>/ext/anaconda5-py3401xeus<span class="w"> </span>/ext/anaconda5-py3/envs/xeus402_gpe<span class="w"> </span>/home/user/.conda/envs/_gpe403</pre></div>404<p>Now copy another specification, then edit the <code>kernel.json</code> file. Here is what I ended up with:</p>405<div class="highlight"><pre><span></span>mkdir<span class="w"> </span>-p<span class="w"> </span>~/.local/share/jupyter/kernels/406<span class="nb">cd</span><span class="w"> </span>~/.local/share/jupyter/kernels/407cp<span class="w"> </span>-r<span class="w"> </span>/ext/anaconda2020.02/share/jupyter/kernels/python3<span class="w"> </span>work-py408vi<span class="w"> </span>~/.local/share/jupyter/kernels/work-py/kernel.json409</pre></div>410<p>The name of the directory here <code>work-py</code> matches the name of the kernel on my machine where I use the <code>ipykernel</code> package. This allows me to use the same notebooks going back and forth without changing the kernel.</p>411<div class="highlight"><pre><span></span><span class="err">#</span><span class="w"> </span><span class="err">ker</span><span class="kc">nel</span><span class="err">.jso</span><span class="kc">n</span>412<span class="p">{</span>413<span class="w"> </span><span class="nt">"argv"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span>414<span class="w"> </span><span class="s2">"/home/user/.conda/envs/work/bin/python"</span><span class="p">,</span>415<span class="w"> </span><span class="s2">"-m"</span><span class="p">,</span>416<span class="w"> </span><span class="s2">"ipykernel_launcher"</span><span class="p">,</span>417<span class="w"> </span><span class="s2">"-f"</span><span class="p">,</span>418<span class="w"> </span><span class="s2">"{connection_file}"</span>419<span class="w"> </span><span class="p">],</span>420<span class="w"> </span><span class="nt">"display_name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"work"</span><span class="p">,</span>421<span class="w"> </span><span class="nt">"language"</span><span class="p">:</span><span class="w"> </span><span class="s2">"python"</span>422<span class="p">}</span>423</pre></div>424425</div>426</div>427</div>428<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">429</div><div class="inner_cell">430<div class="text_cell_render border-box-sizing rendered_html">431<h3 id="MayaVi">MayaVi<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#MayaVi">¶</a></h3>432</div>433</div>434</div>435<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">436</div><div class="inner_cell">437<div class="text_cell_render border-box-sizing rendered_html">438<p><a href="https://docs.enthought.com/mayavi/mayavi/">MayaVi</a> is a nice rendering engine for analyzing 3D data-structures, but poses some problems for use on CoCalc. Here we describe these and how to get it working.</p>439<ol>440<li><p>Create an appropriate conda environment and associated kernel as described above. For example:</p>441<ol>442<li><p>Create an <code>environment.yml</code> file:</p>443<pre><code>yml444# environment.mayavi3.yml445name: mayavi3446channels:447- defaults448- conda-forge449dependencies:450- python=3451- ipykernel452- mayavi453- xvfbwrapper454455# jupyter is only needed in the first environment to run456# jupyter nbextension install --py mayavi --user457# Once this is run from an environment with *both* jupyter458# and mayavi, it is not needed in future environments.459- jupyter460</code></pre>461<p><em>We need jupyter here so we can install the appropriate CSS etc. to allow or rendering.</em></p>462</li>463<li><p>Activate anaconda and create the mayavi3 environment:</p>464<div class="highlight"><pre><span></span>anaconda2019465conda<span class="w"> </span>env<span class="w"> </span>create<span class="w"> </span>-f<span class="w"> </span>environment.mayavi3.yml466</pre></div>467</li>468<li><p>Create the appropriate kernel:</p>469<p>Find the location of current kernels:</p>470<div class="highlight"><pre><span></span><span class="c1"># This path is a kludge. Check it! The awk command strips spaces</span>471<span class="c1"># https://unix.stackexchange.com/a/205854</span>472<span class="nv">base_kernel_dir</span><span class="o">=</span><span class="k">$(</span>jupyter<span class="w"> </span>--paths<span class="w"> </span><span class="p">|</span><span class="w"> </span>grep<span class="w"> </span>ext<span class="w"> </span><span class="p">|</span><span class="w"> </span>grep<span class="w"> </span>share<span class="w"> </span><span class="p">|</span><span class="w"> </span>awk<span class="w"> </span><span class="s1">'{$1=$1;print}'</span><span class="k">)</span>473<span class="nb">echo</span><span class="w"> </span><span class="s2">"'</span><span class="nv">$base_kernel_dir</span><span class="s2">'"</span>474</pre></div>475<p>At the time of running, this is: <code>/ext/anaconda-2019.03/share/jupyter</code></p>476<div class="highlight"><pre><span></span>mkdir<span class="w"> </span>-p<span class="w"> </span>~/.local/share/jupyter/kernels/477cp<span class="w"> </span>-r<span class="w"> </span><span class="s2">"</span><span class="nv">$base_kernel_dir</span><span class="s2">"</span>/kernels/python3<span class="w"> </span><span class="se">\</span>478<span class="w"> </span>~/.local/share/jupyter/kernels/conda-env-mayavi3-py479vi<span class="w"> </span>~/.local/share/jupyter/kernels/conda-env-mayavi3-py/kernel.json480</pre></div>481</li>482</ol>483</li>484<li><p>Activate the environment and install the javascript required to render the output:</p>485<div class="highlight"><pre><span></span>anaconda2019486conda<span class="w"> </span>activate<span class="w"> </span>mayavi3487jupyter<span class="w"> </span>nbextension<span class="w"> </span>install<span class="w"> </span>--py<span class="w"> </span>mayavi<span class="w"> </span>--user488jupyter<span class="w"> </span>nbextension<span class="w"> </span><span class="nb">enable</span><span class="w"> </span>mayavi<span class="w"> </span>--user<span class="w"> </span>--py489</pre></div>490<p>This places the javascript etc. in <code>./.local/share/jupyter/nbextensions/mayavi</code> and adds an entry in <code>~/.jupyter/nbconfig/notebook.json</code>:</p>491<div class="highlight"><pre><span></span><span class="p">{</span>492<span class="w"> </span><span class="nt">"load_extensions"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span>493<span class="w"> </span><span class="nt">"mayavi/x3d/x3dom"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span>494<span class="w"> </span><span class="p">}</span>495<span class="p">}</span>496</pre></div>497</li>498<li><p>Start a new notebook with your kernel, run it in the classic notebook server ("switch to classic notebook..." under "File").</p>499</li>500<li><p>Start a virtual frame-buffer and then use MayaVi with something like the following in your notebook:</p>501<div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">xvfbwrapper</span> <span class="kn">import</span> <span class="n">Xvfb</span>502<span class="k">with</span> <span class="n">Xvfb</span><span class="p">()</span> <span class="k">as</span> <span class="n">xvfb</span><span class="p">:</span>503<span class="kn">from</span> <span class="nn">mayavi</span> <span class="kn">import</span> <span class="n">mlab</span>504<span class="n">mlab</span><span class="o">.</span><span class="n">init_notebook</span><span class="p">()</span>505<span class="n">s</span> <span class="o">=</span> <span class="n">mlab</span><span class="o">.</span><span class="n">test_plot3d</span><span class="p">()</span>506<span class="n">display</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>507</pre></div>508<p>Alternatively, you can skip the context and do something like:</p>509<div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">xvfbwrapper</span> <span class="kn">import</span> <span class="n">Xvfb</span>510<span class="n">vdisplay</span> <span class="o">=</span> <span class="n">Xvfb</span><span class="p">()</span>511<span class="n">vdisplay</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>512<span class="kn">from</span> <span class="nn">mayavi</span> <span class="kn">import</span> <span class="n">mlab</span>513<span class="n">mlab</span><span class="o">.</span><span class="n">init_notebook</span><span class="p">()</span>514<span class="n">s</span> <span class="o">=</span> <span class="n">mlab</span><span class="o">.</span><span class="n">test_plot3d</span><span class="p">()</span>515<span class="n">display</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>516<span class="n">vdisplay</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span> <span class="c1"># Calling this becomes a bit more onerous, but might not be critical</span>517</pre></div>518<p>See <a href="https://github.com/cgoldberg/xvfbwrapper">xvfbwrapper</a> for more details.</p>519</li>520</ol>521522</div>523</div>524</div>525<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">526</div><div class="inner_cell">527<div class="text_cell_render border-box-sizing rendered_html">528<h2 id="System-Software">System Software<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#System-Software">¶</a></h2>529</div>530</div>531</div>532<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">533</div><div class="inner_cell">534<div class="text_cell_render border-box-sizing rendered_html">535<p>One can definitely build system software from source, linking it into <code>~/.local/bin/</code> etc. I am not sure if there is a way of using <code>apt-get</code> or other package managers yet.</p>536537</div>538</div>539</div>540<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">541</div><div class="inner_cell">542<div class="text_cell_render border-box-sizing rendered_html">543<h2 id="Synchronization">Synchronization<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Synchronization">¶</a></h2>544</div>545</div>546</div>547<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">548</div><div class="inner_cell">549<div class="text_cell_render border-box-sizing rendered_html">550<p>The automatic synchronization mechansim of CoCalc has some issues. The issue (<a href="https://github.com/sagemathinc/smc/issues/96">#96</a>) is that when you VCS updates the files, it can change the modification date in a way tha triggers the autosave system to revert to a previous version. The symptom is that you initially load the notebook that you want, but within seconds it reverts to an old (or even blank version).</p>551<p>Thus, it is somewhat dangerous to perform a VCS update on CoCalc: you risk losing local work. Note: none of the work is lost - you can navigate to the project page and look for the "Backups" button on the file browser. This will take you to read-only copies of your work which you can use to restore anything lost this way.</p>552<p>Presently, the only safe solution to update files from outside of the UI is to update them in a new directory.</p>553554</div>555</div>556</div>557<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">558</div><div class="inner_cell">559<div class="text_cell_render border-box-sizing rendered_html">560<h2 id="MathJaX">MathJaX<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#MathJaX">¶</a></h2>561</div>562</div>563</div>564<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">565</div><div class="inner_cell">566<div class="text_cell_render border-box-sizing rendered_html">567<p><a href="https://www.mathjax.org/">MathJaX</a> is rather slow, so in 2018 CoCalc has <a href="http://blog.sagemath.com/latex/2018/03/23/cocalc-katex.html">enabled</a> <a href="https://khan.github.io/KaTeX/">KaTeX</a>. Unfortunately, KaTeX is not as feature rich as MathJaX. If you need full MathJaX functionality, then you can revert to MathJaX in your account settings.</p>568569</div>570</div>571</div>572<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">573</div><div class="inner_cell">574<div class="text_cell_render border-box-sizing rendered_html">575<h2 id="RClone-for-Google-Drive-etc.">RClone for Google Drive etc.<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#RClone-for-Google-Drive-etc.">¶</a></h2>576</div>577</div>578</div>579<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">580</div><div class="inner_cell">581<div class="text_cell_render border-box-sizing rendered_html">582<p>The program <a href="http://rclone.org">rclone</a> provides a command-line interface for several applications like Dropbox and Google Drive. Here are some notes about using it:</p>583<ol>584<li><p>Make sure internet access is enabled for you project.</p>585</li>586<li><p><strike>Install it by downloading the binary and installing it in <code>~/.local/bin/rclone</code>.</strike> The <code>rclone</code> software is already installed on CoCalc.</p>587</li>588<li><p>Add a remote by running <code>rclone config</code>. Some notes:</p>589<ul>590<li>For the "Scope" I chose "Full access all files". More secure would be "Access to files created by rclone only" but this will not work if you add files from another device.</li>591<li>If you want to link a specific folder, you can copy the "ID of the root folder" from the last part of the URL when you open the folder in Google Drive. It looks something like "1RAtwfvaJUk4vULw1z1t1qKWJCsJIRqCZ".</li>592<li>When asked for "Auto config" choose no - this is a "headless" configuration.</li>593</ul>594<p>I choose the name <code>gd</code> for the Google Drive remote. Following the provided link and link your account.</p>595</li>596<li><p>You can now explore with:</p>597<pre><code>rclone lsd gd: # Show remote directories598rclone copy gd:PaperQuantumTurbulence . # Copy a folder599rclone check gd:PaperQuantumTurbulence PaperQuantumTurbulence600rclone sync gd:PaperQuantumTurbulence PaperQuantumTurbulence # Like rsync -d601</code></pre>602</li>603</ol>604605</div>606</div>607</div>608<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">609</div><div class="inner_cell">610<div class="text_cell_render border-box-sizing rendered_html">611<h2 id="Notebook-Extensions">Notebook Extensions<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Notebook-Extensions">¶</a></h2>612</div>613</div>614</div>615<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">616</div><div class="inner_cell">617<div class="text_cell_render border-box-sizing rendered_html">618<p>One can use Jupyter notebook extensions (<a href="https://github.com/ipython-contrib/jupyter_contrib_nbextensions">nbextensions</a>) with only the Classic Notebook interface. As per <a href="https://github.com/sagemathinc/smc/issues/985">issue 985</a>, extensions will not be supported with the Modern Notebook interface, but their goal is to independently implement useful extensions, so file an issue if there is something you want. In this section, we discuss how to enable extensions with the Classic Interface.</p>619<ol>620<li>Open your notebook.</li>621<li>At the bottom of the <code>File</code> menu choose <code>File/Switch to classical notebook...</code>. (As per <a href="https://github.com/sagemathinc/cocalc/issues/1537">issue 1537</a>, this will not work with Firefox.)</li>622<li>At the bottom of the <code>Edit</code> menu choose <code>Edit/nbextensions config</code>. This will allow you to enable various extensions.</li>623</ol>624<h3 id="(Old-Procedure:-Not-Needed-Anymore)">(Old Procedure: Not Needed Anymore)<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#(Old-Procedure:-Not-Needed-Anymore)">¶</a></h3><ol>625<li><p>Enable internet access.</p>626</li>627<li><p>Install the code:</p>628<div class="highlight"><pre><span></span>pip<span class="w"> </span>install<span class="w"> </span>--user<span class="w"> </span>https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tarball/master629</pre></div>630<p>Note: this will also install a copy of <code>jupyter</code> which is not ideal and is not the one that is run by default, but it will allow you to configure things.</p>631</li>632<li><p>Symbolically link this to your user directory:</p>633<div class="highlight"><pre><span></span>ln<span class="w"> </span>-s<span class="w"> </span>~/.local/lib/python2.7/site-packages/jupyter_contrib_nbextensions/nbextensions<span class="w"> </span>.jupyter/634</pre></div>635</li>636<li><p>Install the extensions:</p>637<div class="highlight"><pre><span></span>jupyter<span class="w"> </span>contrib<span class="w"> </span>nbextension<span class="w"> </span>install<span class="w"> </span>--user638</pre></div>639<p>This step adds the configuration files.</p>640</li>641<li><p>Restart the server.</p>642</li>643<li><p>Reload your notebooks.</p>644</li>645</ol>646<p>You should now see a new menu item: <code>Edit/nbextensions config</code>. From this you can enable various extensions. You will need to refresh/reload each notebook when you make changes.</p>647<p><em>Note: This is not a proper installation, so some features may be broken. The Table of Contents (2) feature works, however, which is one of my main uses.)</em></p>648649</div>650</div>651</div>652<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">653</div><div class="inner_cell">654<div class="text_cell_render border-box-sizing rendered_html">655<h2 id="Raw-File-Access">Raw File Access<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Raw-File-Access">¶</a></h2>656</div>657</div>658</div>659<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">660</div><div class="inner_cell">661<div class="text_cell_render border-box-sizing rendered_html">662<p>If you want to directly access files such as HTML files without the CoCalc interface, you can. This is <a href="https://github.com/sagemathinc/cocalc/wiki/share#file-sharing-tips">described here</a>.</p>663664</div>665</div>666</div>667<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">668</div><div class="inner_cell">669<div class="text_cell_render border-box-sizing rendered_html">670<h2 id="Configuration-Files">Configuration Files<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Configuration-Files">¶</a></h2>671</div>672</div>673</div>674<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">675</div><div class="inner_cell">676<div class="text_cell_render border-box-sizing rendered_html">677<p>Here are the ultimate contents of the configuration files I have on my computer and on CoCalc. These may get out of date. For up-to-date versions, please see the <a href="https://bitbucket.org/mforbes/configurations/src/trunk/complete_systems/cocalc/">configurations/complete_systems/cocalc</a> folder on my confgurations project.</p>678679</div>680</div>681</div>682<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">683</div><div class="inner_cell">684<div class="text_cell_render border-box-sizing rendered_html">685<h3 id="Your-Computer">Your Computer<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Your-Computer">¶</a></h3>686</div>687</div>688</div>689<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">690</div><div class="inner_cell">691<div class="text_cell_render border-box-sizing rendered_html">692<h4 id="~/.bashrc"><code>~/.bashrc</code><a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.bashrc">¶</a></h4>693</div>694</div>695</div>696<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">697</div><div class="inner_cell">698<div class="text_cell_render border-box-sizing rendered_html">699<div class="highlight"><pre><span></span><span class="c1"># ~/.bashrc</span>700701<span class="nb">export</span><span class="w"> </span><span class="nv">HG_USERNAME</span><span class="o">=</span><span class="s2">"Michael McNeil Forbes &lt;[email protected]&gt;"</span>702<span class="nb">export</span><span class="w"> </span><span class="nv">GIT_USEREMAIL</span><span class="o">=</span><span class="s2">"[email protected]"</span>703<span class="nb">export</span><span class="w"> </span><span class="nv">GIT_USERNAME</span><span class="o">=</span><span class="s2">"Michael McNeil Forbes"</span>704<span class="nb">export</span><span class="w"> </span><span class="nv">LC_HG_USERNAME</span><span class="o">=</span><span class="s2">"</span><span class="si">${</span><span class="nv">HG_USERNAME</span><span class="si">}</span><span class="s2">"</span>705<span class="nb">export</span><span class="w"> </span><span class="nv">LC_GIT_USERNAME</span><span class="o">=</span><span class="s2">"</span><span class="si">${</span><span class="nv">GIT_USERNAME</span><span class="si">}</span><span class="s2">"</span>706<span class="nb">export</span><span class="w"> </span><span class="nv">LC_GIT_USEREMAIL</span><span class="o">=</span><span class="s2">"</span><span class="si">${</span><span class="nv">GIT_USEREMAIL</span><span class="si">}</span><span class="s2">"</span>707</pre></div>708709</div>710</div>711</div>712<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">713</div><div class="inner_cell">714<div class="text_cell_render border-box-sizing rendered_html">715<h4 id="~/.ssh/config"><code>~/.ssh/config</code><a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.ssh/config">¶</a></h4>716</div>717</div>718</div>719<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">720</div><div class="inner_cell">721<div class="text_cell_render border-box-sizing rendered_html">722<div class="highlight"><pre><span></span><span class="c1"># ~/.ssh/config:</span>723Host<span class="w"> </span>smc*724<span class="w"> </span>HostName<span class="w"> </span>ssh.cocalc.com725<span class="w"> </span>ForwardAgent<span class="w"> </span>yes726<span class="w"> </span>SendEnv<span class="w"> </span>LC_HG_USERNAME727<span class="w"> </span>SendEnv<span class="w"> </span>LC_GIT_USERNAME728<span class="w"> </span>SendEnv<span class="w"> </span>LC_GIT_USEREMAIL729730Host<span class="w"> </span>smcbec...<span class="w"> </span><span class="c1"># Some convenient name</span>731<span class="w"> </span>User<span class="w"> </span>01a3...<span class="w"> </span><span class="c1"># Use the code listed on CoCalc</span>732</pre></div>733734</div>735</div>736</div>737<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">738</div><div class="inner_cell">739<div class="text_cell_render border-box-sizing rendered_html">740<h3 id="CoCalc-Project">CoCalc Project<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#CoCalc-Project">¶</a></h3>741</div>742</div>743</div>744<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">745</div><div class="inner_cell">746<div class="text_cell_render border-box-sizing rendered_html">747<h4 id="~/.bash_alias"><code>~/.bash_alias</code><a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.bash_alias">¶</a></h4>748</div>749</div>750</div>751<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">752</div><div class="inner_cell">753<div class="text_cell_render border-box-sizing rendered_html">754<div class="highlight"><pre><span></span><span class="c1"># Bash Alias File; -*-Shell-script-*-</span>755<span class="c1"># dest = ~/.bash_alias # Keep this as the 2nd line for mmf_init_setup</span>756<span class="c1">#</span>757<span class="c1"># On CoCalc, this file is automatically sourced, so it is where you</span>758<span class="c1"># should keep your customizations.</span>759<span class="c1">#</span>760<span class="c1"># LC_* variables:</span>761<span class="c1">#</span>762<span class="c1"># Since each user logs in with the same user-id (specific to the</span>763<span class="c1"># project), I use the following mechanism to keep track of who is</span>764<span class="c1"># logged in for the purposes of using version control like hg and git.</span>765<span class="c1">#</span>766<span class="c1"># You should define the following variables on your home machine and then tell</span>767<span class="c1"># ssh to forward these:</span>768<span class="c1">#</span>769<span class="c1"># ~/.bashrc:</span>770<span class="c1">#</span>771<span class="c1"># export HG_USERNAME="Michael McNeil Forbes &lt;[email protected]&gt;"</span>772<span class="c1"># export GIT_USEREMAIL="[email protected]"</span>773<span class="c1"># export GIT_USERNAME="Michael McNeil Forbes"</span>774<span class="c1"># export LC_HG_USERNAME="${HG_USERNAME}"</span>775<span class="c1"># export LC_GIT_USERNAME="${GIT_USERNAME}"</span>776<span class="c1"># export LC_GIT_USEREMAIL="${GIT_USEREMAIL}"</span>777<span class="c1">#</span>778<span class="c1"># ~/.ssh/config:</span>779<span class="c1">#</span>780<span class="c1"># Host smc*</span>781<span class="c1"># HostName ssh.cocalc.com</span>782<span class="c1"># ForwardAgent yes</span>783<span class="c1"># SendEnv LC_HG_USERNAME</span>784<span class="c1"># SendEnv LC_GIT_USERNAME</span>785<span class="c1"># SendEnv LC_GIT_USEREMAIL</span>786<span class="c1"># Host smc... # Some convenient name</span>787<span class="c1"># User 01a3... # Use the code listed on CoCalc</span>788<span class="c1">#</span>789<span class="c1"># Then you can `ssh smc...` and your username will be forwarded.</span>790791<span class="c1"># This content inserted by mmf_setup</span>792<span class="c1"># Add my mercurial commands like hg ccom for removing output from .ipynb files</span>793.<span class="w"> </span>mmf_setup794795796<span class="c1"># Specified here since .gitconfig will not expand the variables</span>797git<span class="w"> </span>config<span class="w"> </span>--global<span class="w"> </span>user.name<span class="w"> </span><span class="s2">"\${LC_GIT_USERNAME}"</span>798git<span class="w"> </span>config<span class="w"> </span>--global<span class="w"> </span>user.email<span class="w"> </span><span class="s2">"\${LC_GIT_USEREMAIL}"</span>799800<span class="nb">export</span><span class="w"> </span><span class="nv">INPUTRC</span><span class="o">=</span>~/.inputrc801<span class="nb">export</span><span class="w"> </span><span class="nv">SCREENDIR</span><span class="o">=</span>~/.screen802803<span class="c1"># I structure my projects with a top level repositories directory</span>804<span class="c1"># where I include custom repos. The following is installed by:</span>805<span class="c1">#</span>806<span class="c1"># mkdir ~/repositories</span>807<span class="c1"># hg clone ssh://[email protected]/mforbes/mmfhg ~/repositories/mmfhg</span>808<span class="nb">export</span><span class="w"> </span><span class="nv">MMFHG</span><span class="o">=</span>~/repositories/mmfhg809<span class="nb">export</span><span class="w"> </span><span class="nv">HGRCPATH</span><span class="o">=</span><span class="s2">"</span><span class="si">${</span><span class="nv">HGRCPATH</span><span class="si">}</span><span class="s2">"</span>:<span class="s2">"</span><span class="si">${</span><span class="nv">MMFHG</span><span class="si">}</span><span class="s2">"</span>/hgrc810811<span class="nb">export</span><span class="w"> </span><span class="nv">EDITOR</span><span class="o">=</span>vi812813<span class="c1"># Finding stuff</span>814<span class="k">function</span><span class="w"> </span>finda<span class="w"> </span><span class="o">{</span>815<span class="w"> </span>find<span class="w"> </span>.<span class="w"> </span><span class="se">\(</span><span class="w"> </span><span class="se">\</span>816<span class="w"> </span>-name<span class="w"> </span><span class="s2">".hg"</span><span class="w"> </span>-o<span class="w"> </span>-name<span class="w"> </span><span class="s2">".ipynb_checkpoints"</span><span class="w"> </span>-o<span class="w"> </span>-name<span class="w"> </span><span class="s2">"*.sage-*"</span><span class="w"> </span><span class="se">\)</span><span class="w"> </span>-prune<span class="w"> </span><span class="se">\</span>817<span class="w"> </span>-o<span class="w"> </span>-type<span class="w"> </span>f<span class="w"> </span>-print0<span class="w"> </span><span class="p">|</span><span class="w"> </span>xargs<span class="w"> </span>-0<span class="w"> </span>grep<span class="w"> </span>-H<span class="w"> </span><span class="s2">"</span><span class="si">${</span><span class="p">*:</span><span class="nv">1</span><span class="si">}</span><span class="s2">"</span>818<span class="o">}</span>819820<span class="k">function</span><span class="w"> </span>findf<span class="w"> </span><span class="o">{</span>821<span class="w"> </span>find<span class="w"> </span>.<span class="w"> </span><span class="se">\(</span><span class="w"> </span><span class="se">\</span>822<span class="w"> </span>-name<span class="w"> </span><span class="s2">".hg"</span><span class="w"> </span>-o<span class="w"> </span>-name<span class="w"> </span><span class="s2">".ipynb_checkpoints"</span><span class="w"> </span>-o<span class="w"> </span>-name<span class="w"> </span><span class="s2">"*.sage-*"</span><span class="w"> </span><span class="se">\)</span><span class="w"> </span>-prune<span class="w"> </span><span class="se">\</span>823<span class="w"> </span>-o<span class="w"> </span>-type<span class="w"> </span>f<span class="w"> </span>-name<span class="w"> </span><span class="s2">"*.</span><span class="nv">$1</span><span class="s2">"</span><span class="w"> </span>-print0<span class="w"> </span><span class="p">|</span><span class="w"> </span>xargs<span class="w"> </span>-0<span class="w"> </span>grep<span class="w"> </span>-H<span class="w"> </span><span class="s2">"</span><span class="si">${</span><span class="p">*:</span><span class="nv">2</span><span class="si">}</span><span class="s2">"</span>824<span class="o">}</span>825826<span class="c1"># I used to use aliases, but they cannot easily be overrriden by</span>827<span class="c1"># personalzed customizations.</span>828<span class="k">function</span><span class="w"> </span>findpy<span class="w"> </span><span class="o">{</span><span class="w"> </span>findf<span class="w"> </span>py<span class="w"> </span><span class="s2">"</span><span class="si">${</span><span class="p">*</span><span class="si">}</span><span class="s2">"</span><span class="p">;</span><span class="w"> </span><span class="o">}</span>829<span class="k">function</span><span class="w"> </span>findipy<span class="w"> </span><span class="o">{</span><span class="w"> </span>findf<span class="w"> </span>ipynb<span class="w"> </span><span class="s2">"</span><span class="si">${</span><span class="p">*</span><span class="si">}</span><span class="s2">"</span><span class="p">;</span><span class="w"> </span><span class="o">}</span>830<span class="k">function</span><span class="w"> </span>findjs<span class="w"> </span><span class="o">{</span><span class="w"> </span>findf<span class="w"> </span>js<span class="w"> </span><span class="s2">"</span><span class="si">${</span><span class="p">*</span><span class="si">}</span><span class="s2">"</span><span class="p">;</span><span class="w"> </span><span class="o">}</span>831<span class="k">function</span><span class="w"> </span>findcss<span class="w"> </span><span class="o">{</span><span class="w"> </span>findf<span class="w"> </span>css<span class="w"> </span><span class="s2">"</span><span class="si">${</span><span class="p">*</span><span class="si">}</span><span class="s2">"</span><span class="p">;</span><span class="w"> </span><span class="o">}</span>832</pre></div>833834</div>835</div>836</div>837<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">838</div><div class="inner_cell">839<div class="text_cell_render border-box-sizing rendered_html">840<h4 id="~/.inputrc"><code>~/.inputrc</code><a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.inputrc">¶</a></h4>841</div>842</div>843</div>844<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">845</div><div class="inner_cell">846<div class="text_cell_render border-box-sizing rendered_html">847<div class="highlight"><pre><span></span><span class="c1"># Bash Input Init File; -*-Shell-script-*-</span>848<span class="c1"># dest = ~/.inputrc # Keep this as the 2nd line for mmf_init_setup</span>849850<span class="c1"># This file is used by bash to define the key behaviours. The current</span>851<span class="c1"># version allows the up and down arrows to search for history items</span>852<span class="c1"># with a common prefix.</span>853<span class="c1">#</span>854<span class="c1"># Note: For these to be properly intepreted, you need to make sure your locale</span>855<span class="c1"># is properly set in your environment with something like:</span>856<span class="c1"># export LC_ALL=C</span>857858<span class="s2">"\M-[A"</span>:<span class="w"> </span>history-search-backward859<span class="s2">"\M-[B"</span>:<span class="w"> </span>history-search-forward860<span class="s2">"\e[A"</span>:<span class="w"> </span>history-search-backward861<span class="s2">"\e[B"</span>:<span class="w"> </span>history-search-forward862</pre></div>863864</div>865</div>866</div>867<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">868</div><div class="inner_cell">869<div class="text_cell_render border-box-sizing rendered_html">870<h4 id="~/.hgrc"><code>~/.hgrc</code><a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.hgrc">¶</a></h4>871</div>872</div>873</div>874<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">875</div><div class="inner_cell">876<div class="text_cell_render border-box-sizing rendered_html">877<div class="highlight"><pre><span></span><span class="c1"># Mercurial (hg) Init File; -*-Shell-script-*-</span>878<span class="c1"># dest = ~/.hgrc # Keep this as the 2nd line for mmf_init_setup</span>879880<span class="o">[</span>ui<span class="o">]</span>881<span class="nv">username</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">$LC_HG_USERNAME</span>882<span class="nv">merge</span><span class="w"> </span><span class="o">=</span><span class="w"> </span>emacs883<span class="nv">paginate</span><span class="w"> </span><span class="o">=</span><span class="w"> </span>never884885<span class="o">[</span>extensions<span class="o">]</span>886<span class="c1"># Builtin extensions:</span>887<span class="nv">rebase</span><span class="o">=</span>888<span class="nv">graphlog</span><span class="o">=</span>889<span class="nv">color</span><span class="o">=</span>890<span class="nv">record</span><span class="o">=</span>891<span class="nv">histedit</span><span class="o">=</span>892<span class="nv">strip</span><span class="o">=</span>893<span class="c1">#extdiff =</span>894<span class="c1">#mq =</span>895<span class="c1">#purge =</span>896<span class="c1">#transplant =</span>897<span class="c1">#evolve =</span>898<span class="c1">#amend =</span>899900<span class="o">[</span>color<span class="o">]</span>901custom.rev<span class="w"> </span><span class="o">=</span><span class="w"> </span>red902custom.author<span class="w"> </span><span class="o">=</span><span class="w"> </span>blue903custom.date<span class="w"> </span><span class="o">=</span><span class="w"> </span>green904custom.branches<span class="w"> </span><span class="o">=</span><span class="w"> </span>red905906<span class="o">[</span>merge-tools<span class="o">]</span>907emacs.args<span class="w"> </span><span class="o">=</span><span class="w"> </span>-q<span class="w"> </span>--eval<span class="w"> </span><span class="s2">"(ediff-merge-with-ancestor \""</span><span class="nv">$local</span><span class="s2">"\" \""</span><span class="nv">$other</span><span class="s2">"\" \""</span><span class="nv">$base</span><span class="s2">"\" nil \""</span><span class="nv">$output</span><span class="s2">"\")"</span>908</pre></div>909910</div>911</div>912</div>913<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">914</div><div class="inner_cell">915<div class="text_cell_render border-box-sizing rendered_html">916<h4 id="~/.hgignore"><code>~/.hgignore</code><a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.hgignore">¶</a></h4>917</div>918</div>919</div>920<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">921</div><div class="inner_cell">922<div class="text_cell_render border-box-sizing rendered_html">923<div class="highlight"><pre><span></span><span class="c1"># Mercurial (hg) Init File; -*-Shell-script-*-</span>924<span class="c1"># dest = ~/.hgignore # Keep this as the 2nd line for mmf_init_setup</span>925926syntax:<span class="w"> </span>glob927928<span class="se">\.</span>ipynb_checkpoints929*<span class="se">\.</span>sage-jupyter2930</pre></div>931932</div>933</div>934</div>935<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">936</div><div class="inner_cell">937<div class="text_cell_render border-box-sizing rendered_html">938<h4 id="~/.gitconfig"><code>~/.gitconfig</code><a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.gitconfig">¶</a></h4>939</div>940</div>941</div>942<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">943</div><div class="inner_cell">944<div class="text_cell_render border-box-sizing rendered_html">945<div class="highlight"><pre><span></span><span class="c1"># Git Config File; -*-Shell-script-*-</span>946<span class="c1"># dest = ~/.gitconfig # Keep this as the 2nd line for mmf_init_setup</span>947948<span class="o">[</span>push<span class="o">]</span>949<span class="w"> </span><span class="nv">default</span><span class="w"> </span><span class="o">=</span><span class="w"> </span>simple950<span class="o">[</span>alias<span class="o">]</span>951<span class="w"> </span><span class="nv">lg1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span>log<span class="w"> </span>--graph<span class="w"> </span>--abbrev-commit<span class="w"> </span>--decorate<span class="w"> </span>--date<span class="o">=</span>relative<span class="w"> </span>--format<span class="o">=</span>format:<span class="s1">'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'</span><span class="w"> </span>--all952<span class="w"> </span><span class="nv">lg2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span>log<span class="w"> </span>--graph<span class="w"> </span>--abbrev-commit<span class="w"> </span>--decorate<span class="w"> </span>--format<span class="o">=</span>format:<span class="s1">'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'</span><span class="w"> </span>--all953<span class="w"> </span><span class="nv">lg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span>!<span class="s2">"git lg1"</span><span class="o">]</span>954</pre></div>955956</div>957</div>958</div>959<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">960</div><div class="inner_cell">961<div class="text_cell_render border-box-sizing rendered_html">962<h4 id="~/.mrconfig"><code>~/.mrconfig</code><a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#~/.mrconfig">¶</a></h4>963</div>964</div>965</div>966<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">967</div><div class="inner_cell">968<div class="text_cell_render border-box-sizing rendered_html">969<p>Note: Until <a href="https://myrepos.branchable.com/todo/Allow_symlinked_directories">symlinks work again</a>, I can't really used myrepos.</p>970971</div>972</div>973</div>974<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">975</div><div class="inner_cell">976<div class="text_cell_render border-box-sizing rendered_html">977<div class="highlight"><pre><span></span><span class="c1"># myrepos (mr) Config File; -*-Shell-script-*-</span>978<span class="c1"># dest = ~/.mrconfig # Keep this as the 2nd line for mmf_init_setup</span>979<span class="c1">#</span>980<span class="c1"># Requires the myrepos perl script to be installed which you can do with the</span>981<span class="c1"># following commands:</span>982<span class="c1">#</span>983<span class="c1"># mkdir -P ~/repositories</span>984<span class="c1"># git clone git://myrepos.branchable.com/ ~/repositories/myrepos</span>985<span class="c1"># pushd ~/repositories/myrepos; git checkout 52e2de0bdeb8b892c8b83fcad54543f874d4e5b8; popd</span>986<span class="c1"># ln -s ~/repositories/myrepos/mr ~/.local/bin/</span>987<span class="c1">#</span>988<span class="c1"># Also requires the mmfhg package which can be enabled by installing</span>989<span class="c1"># mmf_setup and running . mmf_setup from your .bash_aliases file.</span>990991<span class="nv">include</span><span class="w"> </span><span class="o">=</span><span class="w"> </span>cat<span class="w"> </span><span class="s2">"</span><span class="si">${</span><span class="nv">MMFHG</span><span class="si">}</span><span class="s2">/mrconfig"</span>992993<span class="o">[</span>DEFAULT<span class="o">]</span>994<span class="nv">hg_out</span><span class="w"> </span><span class="o">=</span><span class="w"> </span>hg<span class="w"> </span>out995</pre></div>996997</div>998</div>999</div>1000<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1001</div><div class="inner_cell">1002<div class="text_cell_render border-box-sizing rendered_html">1003<h2 id="References">References<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#References">¶</a></h2><ul>1004<li><a href="https://doc.cocalc.com">CoCalc User Manual</a></li>1005<li><a href="http://mostlyunixish.franzoni.eu/blog/2012/06/21/dropbox-and-mercurial-and-lived-happily-ever-after/">http://mostlyunixish.franzoni.eu/blog/2012/06/21/dropbox-and-mercurial-and-lived-happily-ever-after/</a></li>1006</ul>10071008</div>1009</div>1010</div>1011<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1012</div><div class="inner_cell">1013<div class="text_cell_render border-box-sizing rendered_html">1014<h2 id="Old-Information-(Out-of-Data)">Old Information (Out of Data)<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Old-Information-(Out-of-Data)">¶</a></h2>1015</div>1016</div>1017</div>1018<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1019</div><div class="inner_cell">1020<div class="text_cell_render border-box-sizing rendered_html">1021<p>The following information is recorded for historical purposes. It no longer applies to CoCalc.</p>10221023</div>1024</div>1025</div>1026<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1027</div><div class="inner_cell">1028<div class="text_cell_render border-box-sizing rendered_html">1029<h3 id="Dropbox-no-longer-works!">Dropbox <a href="https://github.com/sagemathinc/cocalc/issues/11">no longer works!</a><a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Dropbox-no-longer-works!">¶</a></h3><p>Dropbox dropped linux support for all file systems except ext4 which is not an option for CoCalc.</p>1030<p>You can <a href="http://ask.sagemath.org/question/10713/is-there-a-way-to-store-and-sync-the-files-from-sage-cloud-on-local-hard-drive/">use Dropbox on CoCalc</a>:</p>1031<div class="highlight"><pre><span></span>dropbox<span class="w"> </span>start<span class="w"> </span>-i1032</pre></div>1033<p>The first time you do this, it will download some files and you will need to provide a username etc. Note, as pointed out in the link, by default, dropbox wants to share <em>everything</em>. I am not sure of the best strategy for this, but chose to create a separate Dropbox account for the particular project I am using, then just adding the appropriate files to that account.</p>1034<p>Once nice think about Dropbox is that it works well with symbolic links, so you can just symlink any files you want into the <code>~/Dropbox</code> folder and everything should work fine, but hold off for a moment - first exclude the appropriate folders, then make the symlinks.</p>1035<p>If you want to run Dropbox everytime you login, then add the following to your <code>~/.bash_aliases</code> on CoCalc:</p>1036<div class="highlight"><pre><span></span>cat<span class="w"> </span>&gt;&gt;<span class="w"> </span>~/.bash_aliases<span class="w"> </span><span class="s">&lt;&lt;EOF</span>10371038<span class="s"># Start Dropbox</span>1039<span class="s">dropbox start</span>1040<span class="s">EOF</span>1041</pre></div>1042<p>This did not link with my dropbox account. I had to manually kill the dropbox process, then run the following:</p>1043<pre><code>.dropbox-dist/dropboxd1044</code></pre>1045<h4 id="Dropbox-and-Version-Control">Dropbox and Version Control<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Dropbox-and-Version-Control">¶</a></h4><p>Although tempting, one should not use Dropbox to share VCS files since corruption might occur. Instead, you can use Dropbox to sync the working directory (for collaborators) but use selective sync to ignore the sensitive VCS files. Here is one way to do this:</p>1046<div class="highlight"><pre><span></span><span class="nb">cd</span><span class="w"> </span>~/Dropbox1047find<span class="w"> </span>-L<span class="w"> </span>.<span class="w"> </span>-name<span class="w"> </span><span class="s2">".hg"</span><span class="w"> </span>-exec<span class="w"> </span>dropbox<span class="w"> </span>exclude<span class="w"> </span>add<span class="w"> </span><span class="o">{}</span><span class="w"> </span><span class="se">\;</span>1048find<span class="w"> </span>-L<span class="w"> </span>.<span class="w"> </span>-name<span class="w"> </span><span class="s2">".git"</span><span class="w"> </span>-exec<span class="w"> </span>dropbox<span class="w"> </span>exclude<span class="w"> </span>add<span class="w"> </span><span class="o">{}</span><span class="w"> </span><span class="se">\;</span>1049</pre></div>1050<p>Note: This will remove the <code>.hg</code> directories! (The behaviour of excluding a file with selective sync is to remove it from the local Dropbox.) Thus, my recommendation is the following:</p>1051<ol>1052<li>First copy the files to the Dropbox folder using <code>cp -r</code>.</li>1053<li>Then run the previous find commands to exclude the <code>.hg</code> directories.</li>1054<li>Check this with <code>dropbox exclude list</code>.</li>1055<li>Turn off dropbox <code>dropbox stop</code></li>1056<li>Now replace the folders with appropriate symlinks.</li>1057<li>Finally, start dropbox again <code>dropbox start</code>.</li>1058</ol>1059<p>Here is a summary for example. I am assuming that you have a version controlled project called <code>~/paper</code> that you want mirrored in your Dropbox folder:</p>1060<div class="highlight"><pre><span></span>dropbox<span class="w"> </span>start1061cp<span class="w"> </span>-r<span class="w"> </span>~/paper<span class="w"> </span>~/Dropbox/1062<span class="nb">pushd</span><span class="w"> </span>Dropbox<span class="p">;</span><span class="w"> </span>find<span class="w"> </span>-L.<span class="w"> </span>-name<span class="w"> </span><span class="s2">".hg"</span><span class="w"> </span>-exec<span class="w"> </span>dropbox<span class="w"> </span>exclude<span class="w"> </span>add<span class="w"> </span><span class="o">{}</span><span class="w"> </span><span class="se">\;</span><span class="w"> </span><span class="p">;</span><span class="w"> </span><span class="nb">popd</span>1063dropbox<span class="w"> </span>exclude<span class="w"> </span>list1064dropbox<span class="w"> </span>stop1065rm<span class="w"> </span>-r<span class="w"> </span>~/Dropbox/paper1066ln<span class="w"> </span>-s<span class="w"> </span>~/paper<span class="w"> </span>~/Dropbox/paper1067dropbox<span class="w"> </span>start1068</pre></div>1069<p>Remember to do the same on your local computer!</p>1070<h4 id="Dropbox-Issues">Dropbox Issues<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/#Dropbox-Issues">¶</a></h4><p>Occasionally there will be issues with dropbox. One of the issues may be when the host for the project changes (this happens for example when you add or remove member hosting for a project). To deal with this you might have to <a href="https://www.dropbox.com/help/mobile/unlink-relink-computer-mobile">unlike or relink</a> the computer to Dropbox:</p>1071<ul>1072<li><strong>Make sure your project has "Internet access" in Settings.</strong></li>1073<li><code>dropbox stop</code> on the CoCalc server.</li>1074<li>Sign into Dropbox with the account you have linked to the project. (Hint: if you can't remember the name, look in your main dropbox project where you should have shared this with the CoCalc project. It can be useful to use Incognito mode or a different browser to sign into an auxilliary account.)</li>1075<li>Go to Settings (top right), then the Security tab.</li>1076<li>In the Devices section, unlink the device.</li>1077<li>Restart dropbox with <code>~/.dropbox-dist/dropboxd</code>. This should give you a link to paste into the browser you have signed into and it will relink.</li>1078</ul>10791080</div>1081</div>1082</div>1083<div class="cell border-box-sizing code_cell rendered">1084<div class="input">1085<div class="prompt input_prompt">In [ ]:</div>1086<div class="inner_cell">1087<div class="input_area">1088<div class=" highlight hl-ipython2"><pre><span></span>1089</pre></div>10901091</div>1092</div>1093</div>10941095</div></description><guid>http://swan.physics.wsu.edu/forbes/public/notes/cocalc-workflow/</guid><pubDate>Thu, 03 Mar 2016 07:20:04 GMT</pubDate></item><item><title>Details about configuring Nikola</title><link>http://swan.physics.wsu.edu/forbes/public/notes/nikola-details/</link><dc:creator>Michael McNeil Forbes</dc:creator><description><div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1096</div><div class="inner_cell">1097<div class="text_cell_render border-box-sizing rendered_html">1098<p>This notebook contains details about various commands and techniques that might obscure the main point in the other documents.</p>10991100</div>1101</div>1102</div>1103<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1104</div><div class="inner_cell">1105<div class="text_cell_render border-box-sizing rendered_html">1106<h2 id="Debugging-Nikola">Debugging Nikola<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/nikola-details/#Debugging-Nikola">¶</a></h2>1107</div>1108</div>1109</div>1110<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1111</div><div class="inner_cell">1112<div class="text_cell_render border-box-sizing rendered_html">1113<p>Here are some tips for debugging Nikola when things go wrong.</p>1114<ul>1115<li><p>Run with pdb support:</p>1116<div class="highlight"><pre><span></span><span class="nv">NIKOLA_DEBUG</span><span class="o">=</span><span class="m">1</span><span class="w"> </span>nikola<span class="w"> </span>build<span class="w"> </span>-v<span class="w"> </span><span class="m">2</span><span class="w"> </span>--pdb1117</pre></div>1118<p>This does not halt some errors though. You can force Nikola to halt on warnings with</p>1119<div class="highlight"><pre><span></span>nikola<span class="w"> </span>build<span class="w"> </span>--strict1120</pre></div>1121<p>This will give tracebacks about the warnings that might be hidden.</p>1122</li>1123</ul>11241125</div>1126</div>1127</div>1128<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1129</div><div class="inner_cell">1130<div class="text_cell_render border-box-sizing rendered_html">1131<h2 id="Clean-Environment">Clean Environment<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/nikola-details/#Clean-Environment">¶</a></h2>1132</div>1133</div>1134</div>1135<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1136</div><div class="inner_cell">1137<div class="text_cell_render border-box-sizing rendered_html">1138<p>To get as clean an environment as possible, I did the following:</p>1139<div class="highlight"><pre><span></span>$<span class="w"> </span>conda<span class="w"> </span>create<span class="w"> </span>-n<span class="w"> </span>blog3<span class="w"> </span><span class="nv">python</span><span class="o">=</span><span class="m">3</span>1140$<span class="w"> </span>conda<span class="w"> </span>activate<span class="w"> </span>blog31141$<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>Nikola11421143<span class="c1"># Trying to run nikola build on my site gave errors requiring</span>1144<span class="c1"># the following</span>1145<span class="c1"># ModuleNotFoundError: No module named 'mmf_setup'</span>1146<span class="c1"># ERROR: Nikola: In order to use this theme, you must install the "jinja2" Python package.</span>1147<span class="c1"># ERROR: Nikola: In order to build this site (compile ipynb), you must install the "notebook&gt;=4.0.0" Python package.</span>11481149$<span class="w"> </span>conda<span class="w"> </span>install<span class="w"> </span>mmf_setup<span class="w"> </span>jinja2<span class="w"> </span>notebook11501151<span class="c1"># Now we clean the environment, installing as much as possible with conda</span>1152$<span class="w"> </span>conda<span class="w"> </span>install<span class="w"> </span>pipdeptree1153$<span class="w"> </span>pipdeptree<span class="w"> </span><span class="p">|</span><span class="w"> </span>perl<span class="w"> </span>-nle<span class="s1">'print if m{^\w+}'</span>1154</pre></div>11551156</div>1157</div>1158</div>1159<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1160</div><div class="inner_cell">1161<div class="text_cell_render border-box-sizing rendered_html">1162<h2 id="Python-2-vs-Python-3">Python 2 vs Python 3<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/nikola-details/#Python-2-vs-Python-3">¶</a></h2>1163</div>1164</div>1165</div>1166<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1167</div><div class="inner_cell">1168<div class="text_cell_render border-box-sizing rendered_html">1169<p>As of 2020, Python 2 support has stopped, and all major libraries now support Python 3. This includes Mercurial as of version 5.2, our main reason for holding back. Thus, at this point, I strongly recommend starting from Python 3. The remaining material here is for historical reasons.</p>1170<p>Discussions here:</p>1171<ul>1172<li><a href="https://wiki.python.org/moin/Python2orPython3">https://wiki.python.org/moin/Python2orPython3</a></li>1173<li><a href="https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/WdS85V816rw">https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/WdS85V816rw</a></li>1174</ul>1175<p>One issue is that <a href="http://mercurial.selenic.com/wiki/SupportedPythonVersions#Python_3.x_support">mercurial requires Python 2</a> and likely will not support Python 3 for some time. This means that we will have to get users to install Mercurial separately as part of their OS.</p>1176<p>Since I often want control of Mercurial, I still would like to install it under conda. Here is how I do it:</p>1177<ol>1178<li><p>Install Miniconda (see below) with <code>python=2</code> into <code>/data/apps/anaconda/bin</code>.</p>1179</li>1180<li><p><code>conda install mercurial</code>. This gives me a working version.</p>1181</li>1182<li><p><code>conda create -n talent2012 python=3 anaconda</code>. This is my python 3 working environment.</p>1183</li>1184<li><p>Make sure that <code>/data/apps/anaconda/bin</code> appears at both the start and end of my path. For example:</p>1185<div class="highlight"><pre><span></span><span class="nb">export</span><span class="w"> </span><span class="nv">PATH</span><span class="o">=</span><span class="s2">"/data/apps/anaconda/bin:</span><span class="nv">$PATH</span><span class="s2">:/data/apps/anaconda/bin/./"</span>1186</pre></div>1187</li>1188</ol>1189<p>This little trick ensures that when I activate a new environment, the default <code>bin</code> directory remains on my path after so that <code>hg</code> can fallback and still work:</p>1190<div class="highlight"><pre><span></span>$<span class="w"> </span>.<span class="w"> </span>activate<span class="w"> </span>talent20151191discarding<span class="w"> </span>/data/apps/anaconda/bin<span class="w"> </span>from<span class="w"> </span>PATH1192prepending<span class="w"> </span>/data/apps/anaconda/envs/talent2015/bin<span class="w"> </span>to<span class="w"> </span>PATH1193<span class="o">(</span>talent2015<span class="o">)</span><span class="w"> </span>$<span class="w"> </span><span class="nb">echo</span><span class="w"> </span><span class="nv">$PATH</span>1194/data/apps/anaconda/envs/talent2015/bin:...:/data/apps/anaconda/bin/./1195</pre></div>11961197</div>1198</div>1199</div>1200<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1201</div><div class="inner_cell">1202<div class="text_cell_render border-box-sizing rendered_html">1203<h2 id="Conda">Conda<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/nikola-details/#Conda">¶</a></h2>1204</div>1205</div>1206</div>1207<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1208</div><div class="inner_cell">1209<div class="text_cell_render border-box-sizing rendered_html">1210<ul>1211<li><code>conda install</code> seems to also do a <code>conda update</code>, so use this in examples if you are not certain the user has installed the package (in which case <code>conda update</code> will fail).</li>1212</ul>12131214</div>1215</div>1216</div>1217<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1218</div><div class="inner_cell">1219<div class="text_cell_render border-box-sizing rendered_html">1220<h3 id="Clean-Environment-(for-Developers)">Clean Environment (for Developers)<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/nikola-details/#Clean-Environment-(for-Developers)">¶</a></h3>1221</div>1222</div>1223</div>1224<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1225</div><div class="inner_cell">1226<div class="text_cell_render border-box-sizing rendered_html">1227<p>If you are developing code, then it is important to have a clean environment so you don't accidentally depend on packages that you forget to tell the students to install. This can be done as follows. (Not everyone needs to add this complication – we just need to make sure that a few people test all the code in a clean environment.) Here is how I am doing this now (MMF):</p>1228<ol>1229<li><p>First I installed a clean version of <a href="http://conda.pydata.org/miniconda.html">Miniconda</a> based on Python 2 so that I can use mercurial. This is the minimal package manager without any additional dependencies. The reason is that any environments you create will have access to the packages installed in the root (default) and I would like to be able to test code <em>without</em> the full anaconda distribution. Since we require the full <a href="https://store.continuum.io/cshop/anaconda/">Anaconda</a> distribution here, it is fine to install it instead if you don't care about testing your code in clean environment.</p>1230<p>I install mine in a global location <code>/data/apps/anaconda</code>. (This path will appear in examples below. Modify to match your installation choice. I believe the default is your home directory <code>~/miniconda</code> or <code>~/anaconda</code>.) To use this, you need to add the appropriate directory to your path. The installer will offer to do this for you but if you customize your startup files, you might need to intervene a little. Make sure that something like this appears in your <code>~/.bash_profile</code> or <code>~/.bashrc</code> file:</p>1231<div class="highlight"><pre><span></span>1232</pre></div>1233</li>1234</ol>1235<p>export PATH="/data/apps/anaconda/bin:$PATH:/data/apps/anaconda/bin/./"1236export DYLD_LIBRARY_PATH "/data/apps/anaconda/anaconda/lib:$DYLD_LIBRARY_PATH"</p>1237<pre><code>1238(The library path is useful if you install shared libraries like the [FFTW](http://www.fftw.org) and want to manage them with ``conda``. *Someone with Linux expertise, please add the appropriate environmental exports for the linux platform.*)12392. Next I create various environments for working with different versions of python, etc. For this project I do:12401241```bash1242conda create -n py2 python=21243conda create -n py3 python=31244conda create -n anaconda2 anaconda1245conda create -n anaconda3 anaconda python=31246conda create -n talent2015 python=3 anaconda1247</code></pre>1248<p>This creates a new full anaconda distribution in the environment named <code>talent2015</code>. To use this you activate it with one of (requires <code>bash</code> or <code>zsh</code>):</p>1249<div class="highlight"><pre><span></span><span class="nb">source</span><span class="w"> </span>activate<span class="w"> </span>talent20151250<span class="c1"># OR</span>1251.<span class="w"> </span>activate<span class="w"> </span>talent2015<span class="w"> </span><span class="c1"># The "." is a shortcut for "source"</span>1252</pre></div>1253<p>All this really does is modify your <code>PATH</code> to point to <code>/data/apps/anaconda/envs/talent2015/bin</code>. When you are finished, you can deactivate this with:</p>1254<div class="highlight"><pre><span></span>.<span class="w"> </span>deactivate1255</pre></div>12561257</div>1258</div>1259</div>1260<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1261</div><div class="inner_cell">1262<div class="text_cell_render border-box-sizing rendered_html">1263<h2 id="New-Posts">New Posts<a class="anchor-link" href="http://swan.physics.wsu.edu/forbes/public/notes/nikola-details/#New-Posts">¶</a></h2>1264</div>1265</div>1266</div>1267<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1268</div><div class="inner_cell">1269<div class="text_cell_render border-box-sizing rendered_html">1270<p>There appears to be no easy way to customize new posts. In particular, as of version 7.7.6 I tried to modify the template to insert <code>&lt;!-- TEASER_END --&gt;</code> after the content. I traced this to line 141 in <code>nikola/plugins/compile/ipynb.py</code> which inserts the <code>content</code>. The actual content is a translated version of "Write your post here." and everything is inserted programatically without any apparent opportunity for customization.</p>1271<p>In order to customize this, I use a custom script for starting new posts:</p>1272<div class="highlight"><pre><span></span><span class="c1"># Creates a new blog post</span>1273<span class="k">function</span><span class="w"> </span>np<span class="w"> </span><span class="o">()</span>1274<span class="o">{</span>1275<span class="w"> </span><span class="nb">cd</span><span class="w"> </span>/Users/mforbes/current/website/posts/private_blog/1276<span class="w"> </span>.<span class="w"> </span>activate<span class="w"> </span>blog1277<span class="w"> </span>nikola<span class="w"> </span>new_post<span class="w"> </span>-i<span class="w"> </span>/Users/mforbes/current/website/new_post_content.md1278<span class="w"> </span>.<span class="w"> </span>activate<span class="w"> </span>work1279<span class="o">}</span>1280</pre></div>1281<p>Then I place the following content in the file <code>/Users/mforbes/current/website/new_post_content.md</code>:</p>1282<div class="highlight"><pre><span></span>1283<span class="gh"># Title</span>1284Write your post here!1285&lt;!-- TEASER_END --&gt;1286</pre></div>1287<p>Note: In order for this to work, I needed to make sure that the markdown compiler was not disabled. To do this, I made sure that in my <code>conf.py</code> file, I had at least one reference to markdown (I did this in my pages list:)</p>1288<div class="highlight"><pre><span></span><span class="o">...</span>1289<span class="n">PAGES</span> <span class="o">=</span> <span class="p">(</span>1290<span class="p">(</span><span class="s2">"pages/*.md"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"story.tmpl"</span><span class="p">),</span>1291<span class="p">(</span><span class="s2">"pages/*.rst"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"story.tmpl"</span><span class="p">),</span>1292<span class="p">(</span><span class="s2">"pages/*.txt"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"story.tmpl"</span><span class="p">),</span>1293<span class="p">(</span><span class="s2">"pages/*.html"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"story.tmpl"</span><span class="p">),</span>1294<span class="p">)</span>1295</pre></div>12961297</div>1298</div>1299</div>1300<div class="cell border-box-sizing code_cell rendered">1301<div class="input">1302<div class="prompt input_prompt">In [ ]:</div>1303<div class="inner_cell">1304<div class="input_area">1305<div class=" highlight hl-ipython2"><pre><span></span>1306</pre></div>13071308</div>1309</div>1310</div>13111312</div></description><guid>http://swan.physics.wsu.edu/forbes/public/notes/nikola-details/</guid><pubDate>Wed, 02 Mar 2016 18:20:04 GMT</pubDate></item><item><title>Installing Nikola</title><link>http://swan.physics.wsu.edu/forbes/public/notes/nikola-install/</link><dc:creator>Michael McNeil Forbes</dc:creator><description><div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">1313</div><div class="inner_cell">1314<div class="text_cell_render border-box-sizing rendered_html">1315<p>Using Nikola to blog with ipython notebooks.</p>1316<p><a href="http://www.damian.oquanta.info/posts/ipython-plugin-for-nikola-updated.html">http://www.damian.oquanta.info/posts/ipython-plugin-for-nikola-updated.html</a></p>1317<p><a href="http://swan.physics.wsu.edu/forbes/public/notes/nikola-install/">Read more…</a> (24 min remaining to read)</p></div></div></div></description><guid>http://swan.physics.wsu.edu/forbes/public/notes/nikola-install/</guid><pubDate>Wed, 02 Mar 2016 18:20:00 GMT</pubDate></item></channel></rss>13181319