https://www.albertyw.com/atom.xml albertyw.com 2020-03-29T03:15:22.677192+00:00 Albert Wang me@albertyw.com python-feedgen https://www.albertyw.com/note/pip-require-virtualenv Making pip require a virtualenv 2019-12-05T22:14:56-08:00 Albert Wang me@albertyw.com <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 # https://docs.python-guide.org/dev/pip-virtualenv/#requiring-an-active-virtual-environment-for-pip export PIP_REQUIRE_VIRTUALENV=true </code></pre> https://www.albertyw.com/note/default-flake8-ignores Use the default flake8 ignores 2019-12-14T11:34:04-08:00 Albert Wang me@albertyw.com <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="https://lintlyci.github.io/Flake8Rules/rules/W503.html">W503</a> and <a href="https://lintlyci.github.io/Flake8Rules/rules/W504.html">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> https://www.albertyw.com/note/python-releases Python Release Support Timesline 2019-12-26T23:38:46-08:00 Albert Wang me@albertyw.com <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> https://www.albertyw.com/note/sendmail-mailgun Sendmail wrapper for mailgun 2020-03-01T18:05:00-08:00 Albert Wang me@albertyw.com <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 https://app.mailgun.com/app/sending/domains/albertyw.com/credentials</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 smtp.mailgun.org <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> https://www.albertyw.com/note/quote Quote 2020-03-05T00:58:51-08:00 Albert Wang me@albertyw.com <p>Shamelessly stealing off of <a href="https://news.ycombinator.com/item?id=22475496">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>