2020-03-29T03:15:22.677192+00:00 Albert Wang python-feedgen Making pip require a virtualenv 2019-12-05T22:14:56-08:00 Albert Wang <p>Using python pip to install packages without using a virtualenv is generally considered an antipattern. Add this into your <code>~/.bashrc</code> to make pip require an activated virtualenv before running.</p> <pre><code># Do not pip install when not in a virtual environment # export PIP_REQUIRE_VIRTUALENV=true </code></pre> Use the default flake8 ignores 2019-12-14T11:34:04-08:00 Albert Wang <p>Flake8 provides a way to ignore PEP8 rules through its <code>--ignore</code> and <code>--extend-ignore</code> flags. The former overwrites a default list of errors and warnings, including <a href="">W503</a> and <a href="">W504</a> which are mutually incompatible. Therefore, it&#8217;s easier to just use <code>--extend-ignore</code> and not use <code>--ignore</code>.</p> Python Release Support Timesline 2019-12-26T23:38:46-08:00 Albert Wang <p>Since I&#8217;ve had a hard time determining when versions of Python are pre-release, supported, or deprecated, here&#8217;s a table of all recent python versions:</p> <table> <thead> <tr> <th>Version</th> <th>Release</th> <th>End of security fixes</th> </tr> </thead> <tbody> <tr> <td>2.7</td> <td>2010-07</td> <td>2020-01</td> </tr> <tr> <td>3.4</td> <td>2014-03</td> <td>2019-03</td> </tr> <tr> <td>3.5</td> <td>2015-09</td> <td>2020-09</td> </tr> <tr> <td>3.6</td> <td>2016-12</td> <td>2021-12</td> </tr> <tr> <td>3.7</td> <td>2018-06</td> <td>2023-06</td> </tr> <tr> <td>3.8</td> <td>2019-10</td> <td>2024-10</td> </tr> <tr> <td>3.9</td> <td>2020-10</td> <td>2025-10</td> </tr> </tbody> </table> Sendmail wrapper for mailgun 2020-03-01T18:05:00-08:00 Albert Wang <p>If you use the <code>sendmail</code> linux CLI and you want to route outgoing emails through mailgun, write this file, make it executable, and add it to your path before the actual exectuable is found:</p> <div class="codehilite"><pre><span></span><code><span class="ch">#!/bin/bash</span> <span class="c1"># Shim for netdata to send emails through mailgun</span> <span class="c1"># filename: sendmail</span> <span class="c1"># suggested location: /usr/local/bin/</span> <span class="c1"># Installation:</span> <span class="c1"># 1. Write the contents of this script to a file called &quot;sendmail&quot;</span> <span class="c1"># 2. Fill in the mailgun smtp email and password from</span> <span class="c1"># 3. sed -i &#39;s/SENDMAIL_PATH_REPLACE_ME/$(mailgun)/g&#39; sendmail</span> <span class="c1"># 4. `chmod +x sendmail`</span> <span class="c1"># 5. `sudo mv -n sendmail /usr/local/bin`</span> <span class="nv">SENDMAIL_PATH</span><span class="o">=</span><span class="s2">&quot;SENDMAIL_PATH_REPLACE_ME&quot;</span> <span class="nv">MAILGUN_EMAIL</span><span class="o">=</span><span class="s2">&quot;REPLACE_ME&quot;</span> <span class="nv">MAILGUN_PASSWORD</span><span class="o">=</span><span class="s2">&quot;REPLACE_ME&quot;</span> <span class="c1"># shellcheck disable=SC2068</span> <span class="s2">&quot;</span><span class="nv">$SENDMAIL_PATH</span><span class="s2">&quot;</span> <span class="se">\</span> -S <span class="se">\</span> -au <span class="s2">&quot;</span><span class="nv">$MAILGUN_EMAIL</span><span class="s2">&quot;</span> <span class="se">\</span> -ap <span class="s2">&quot;</span><span class="nv">$MAILGUN_PASSWORD</span><span class="s2">&quot;</span> <span class="se">\</span> <span class="nv">$@</span> </code></pre></div> Quote 2020-03-05T00:58:51-08:00 Albert Wang <p>Shamelessly stealing off of <a href="">Hacker News</a></p> <p><img src="/static/notes/20200305-0858.jpg" alt="Microservices are a design philosophy that people confuse as a deployment strategy" /></p>