# gist

  • WIP: Python Markdown prettypre extension

        <span class="k">def</span> <span class="nf">extendMarkdown</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">md</span><span class="p">,</span> <span class="n">md_globals</span><span class="p">)</span><span class="p">:</span>
            <span class="n">md</span><span class="o">.</span><span class="n">registerExtension</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">processor</span> <span class="o">=</span> <span class="n">PreTreeprocessor</span><span class="p">(</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">processor</span><span class="o">.</span><span class="n">md</span> <span class="o">=</span> <span class="n">md</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">processor</span><span class="o">.</span><span class="n">config</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getConfigs</span><span class="p">(</span><span class="p">)</span><span class="o">&lt;</span><span class="o">/</span><span class="n">pre</span><span class="o">&gt;</span></code></pre></div>
    
    <span class="k">def</span> <span class="nf">extendMarkdown</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">md</span><span class="p">,</span> <span class="n">md_globals</span><span class="p">)</span><span class="p">:</span>
        <span class="n">md</span><span class="o">.</span><span class="n">registerExtension</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">processor</span> <span class="o">=</span> <span class="n">PreTreeprocessor</span><span class="p">(</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">processor</span><span class="o">.</span><span class="n">md</span> <span class="o">=</span> <span class="n">md</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">processor</span><span class="o">.</span><span class="n">config</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getConfigs</span><span class="p">(</span><span class="p">)</span>
    

    </code></pre>

  • Hyperlinks with Unicode in ReST

  • Automatically compile LESS files

  • Extracting values from a Cherokee configuration file

    Some Python functions to extract the maximum vserver id and the maximum source id from a Cherokee configuration file.
  • Find a random unbound port

    find_unbound_port returns a (pseudo-)random unbound port on localhost.
  • GitHub Gists