<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Python on galvanist</title>
    <link>/tags/python/</link>
    <description>Recent content in Python on galvanist</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Wed, 13 May 2020 22:13:52 +0000</lastBuildDate>
    <atom:link href="/tags/python/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Django SECRET_KEY generation</title>
      <link>/posts/2020-05-14-django_secret_key_generation/</link>
      <pubDate>Wed, 13 May 2020 22:13:52 +0000</pubDate>
      <guid>/posts/2020-05-14-django_secret_key_generation/</guid>
      <description>&lt;h1 id=&#34;generate-django-secret_keys-on-the-command-line-using-this-one-liner-django-not-required&#34;&gt;Generate django &lt;code&gt;SECRET_KEY&lt;/code&gt;s on the command line using this &amp;ldquo;one-liner&amp;rdquo; (django not required)&lt;/h1&gt;&#xA;&lt;h3 id=&#34;background&#34;&gt;Background&lt;/h3&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.djangoproject.com/&#34;&gt;Django&lt;/a&gt; is a Python web framework with a lot of nice features including an exceptional ORM and &lt;a href=&#34;https://docs.djangoproject.com&#34;&gt;high quality documentation&lt;/a&gt;. Most of my experience with django has been deploying and debugging other people&amp;rsquo;s projects - during the course of which I often want to regenerate the &lt;code&gt;SECRET_KEY&lt;/code&gt; that underpins most of the security of every deployment.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&#34;https://docs.djangoproject.com/en/3.0/ref/settings/#std:setting-SECRET_KEY&#34;&gt;django settings docs&lt;/a&gt; describe the &lt;code&gt;SECRET_KEY&lt;/code&gt;:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Better Documentation of Data with Markdown Tables</title>
      <link>/posts/2019-04-28-markdown-tables-from-dicts/</link>
      <pubDate>Sun, 28 Apr 2019 10:16:33 -0700</pubDate>
      <guid>/posts/2019-04-28-markdown-tables-from-dicts/</guid>
      <description>&lt;h1 id=&#34;documentation--markdown-tables&#34;&gt;Documentation &amp;amp; Markdown Tables&lt;/h1&gt;&#xA;&lt;p&gt;Documentation is a vital part of almost any technical project. However, maintaining good documentation is hard for many reasons, one being that the time needed to document things is time you&amp;rsquo;re &lt;em&gt;not&lt;/em&gt; spending on the &amp;ldquo;building / fixing / operating / assisting&amp;rdquo; aspects of your work &amp;ndash; this is especially painful when you have lots of other urgent or important work to do.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, an important value of any documentation system is to make it  &lt;strong&gt;as easy as possible&lt;/strong&gt; for the would-be documenter to access, create, and edit content at any time. This includes enabling the documenter to express their ideas without requiring excessive authentication, cumbersome markup, or slow / complex UI interactions.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Non-privileged Python Package Installs on OS X</title>
      <link>/posts/2014-12-10-non-privileged-python-package-installs-on-os-x/</link>
      <pubDate>Wed, 10 Dec 2014 04:35:00 +0000</pubDate>
      <guid>/posts/2014-12-10-non-privileged-python-package-installs-on-os-x/</guid>
      <description>&lt;p&gt;Sometimes a virtualenv isn&amp;rsquo;t what you want. I often want my account to have a particular python package (like bpython), but I also like to keep things clean and compartmentalized. One answer is installing the package to a standard place within your user account&amp;rsquo;s home folder. Python is already setup for this, as you can see if you run &lt;code&gt;python -m site&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;sys&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;path&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s1&#34;&gt;&amp;#39;/Users/someuser&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s1&#34;&gt;&amp;#39;/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s1&#34;&gt;&amp;#39;/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s1&#34;&gt;&amp;#39;/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s1&#34;&gt;&amp;#39;/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s1&#34;&gt;&amp;#39;/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s1&#34;&gt;&amp;#39;/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s1&#34;&gt;&amp;#39;/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s1&#34;&gt;&amp;#39;/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s1&#34;&gt;&amp;#39;/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s1&#34;&gt;&amp;#39;/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s1&#34;&gt;&amp;#39;/Library/Python/2.7/site-packages&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;USER_BASE&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;/Users/someuser/Library/Python/2.7&amp;#39;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;doesn&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;t exist)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;USER_SITE&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;/Users/someuser/Library/Python/2.7/lib/python/site-packages&amp;#39;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;doesn&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;t exist)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;ENABLE_USER_SITE&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;True&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You&amp;rsquo;ll see that python is looking for USER_BASE and USER_SITE directories in particular locations. Let&amp;rsquo;s create them:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Giving Your Ancient Robot Arm A Storage Upgrade</title>
      <link>/posts/2014-10-09-giving-your-ancient-robot-arm-a-storage-upgrade/</link>
      <pubDate>Thu, 09 Oct 2014 02:06:04 +0000</pubDate>
      <guid>/posts/2014-10-09-giving-your-ancient-robot-arm-a-storage-upgrade/</guid>
      <description>&lt;p&gt;&lt;img src=&#34;oldsite_inline_nd5dhnJ5VO1rziekg.gif&#34; alt=&#34;YASNAC Motoman K10S side view diagram&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve been hacking on a &lt;a href=&#34;https://sudoroom.org/wiki/Giant_robot_arm&#34;&gt;Giant Robot Arm&lt;/a&gt; at a great hackerspace called &lt;a href=&#34;https://sudoroom.org/&#34;&gt;sudoroom&lt;/a&gt;. I&amp;rsquo;m doing so under the expert tutelage of an &lt;a href=&#34;https://github.com/jerkey&#34;&gt;amazing genius&lt;/a&gt; or &lt;a href=&#34;https://github.com/treeherder&#34;&gt;two&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-enemy&#34;&gt;The Enemy&lt;/h2&gt;&#xA;&lt;p&gt;Below you will see the YASNAC FC1 pictured. It is an incredibly slow of speed, minuscule of capacity, short of reliability, and large of footprint external floppy drive. It connects to the various robot brain parts by a standard RS-232 serial connection. That whole giant device is just the floppy drive.&lt;/p&gt;</description>
    </item>
    <item>
      <title>json2csv</title>
      <link>/posts/2014-06-15-json2csv/</link>
      <pubDate>Sun, 15 Jun 2014 19:26:50 +0000</pubDate>
      <guid>/posts/2014-06-15-json2csv/</guid>
      <description>&lt;p&gt;Do you have a JSON file, like the &lt;a href=&#34;http://staticsitegenerators.net/list.json&#34;&gt;staticsitegenerators.net list of static site generator software&lt;/a&gt;, which you want to convert into CSV format? I created &lt;a href=&#34;https://github.com/glvnst/json2csv/&#34;&gt;json2csv&lt;/a&gt; for just this purpose. Check it out.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Switch Statement Emulation in Python</title>
      <link>/posts/2014-03-08-switch-statement-emulation-in-python/</link>
      <pubDate>Sat, 08 Mar 2014 02:39:00 +0000</pubDate>
      <guid>/posts/2014-03-08-switch-statement-emulation-in-python/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve typically enjoyed having &lt;a href=&#34;http://en.wikipedia.org/wiki/Switch_statement&#34;&gt;fall through switch statements&lt;/a&gt; in my programming languages. Not everyone loves em. They&amp;rsquo;re not always the right answer and they can be a bit dangerous; you miss a &amp;ldquo;break&amp;rdquo; and you &amp;ldquo;goto fail&amp;rdquo;. But they are easy to read and easy to understand &amp;ndash; for me the switch statement is about readability (and to a lesser extent reducing the number of times you have to type the switched variable).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Javascript Date from Python datetime string representation</title>
      <link>/posts/2014-03-06-javascript-date-from-python-datetime-string-representation/</link>
      <pubDate>Thu, 06 Mar 2014 06:17:00 +0000</pubDate>
      <guid>/posts/2014-03-06-javascript-date-from-python-datetime-string-representation/</guid>
      <description>&lt;p&gt;In a recent project I needed to convert the string representation of a Python datetime.datetime into a Javascript Date object. Here&amp;rsquo;s what I came up with. JavaScript isn&amp;rsquo;t my best language so if you have any suggestions for improvement, please let me know.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;datetimeToDate&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;datetime_str&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;use_utc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// Return a JS Date object from the given python datetime_str string.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;  &lt;span class=&#34;c1&#34;&gt;// if the optional boolean use_utc argument is given, the datetime_str&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;  &lt;span class=&#34;c1&#34;&gt;// will be treated as a UTC datetime_str&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;  &lt;span class=&#34;s2&#34;&gt;&amp;#34;use strict&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;datetime_parts&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;datetime_str&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;split&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34; &amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;date_parts&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;datetime_parts&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;].&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;split&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;-&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;time_parts&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;datetime_parts&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;].&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;split&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;:&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;second_parts&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;time_parts&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;].&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;split&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;.&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;mkdate&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;s2i&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;smu2ims&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nx&#34;&gt;use_utc&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;use_utc&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;===&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;undefined&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;?&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;false&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;use_utc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#x9;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// The Date constructors don&amp;#39;t work with .apply(), so lambdas&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;  &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;use_utc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;mkdate&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;y&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;m&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;d&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;hr&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;min&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;sec&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;ms&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;new&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;Date&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;Date&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;UTC&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;y&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;m&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;d&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;hr&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;min&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;sec&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;ms&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;));&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;};&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;else&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;mkdate&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;y&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;m&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;d&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;hr&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;min&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;sec&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;ms&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;new&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;Date&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;y&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;m&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;d&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;hr&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;min&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;sec&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;ms&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;};&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#x9;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// string to int with radix 10&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;  &lt;span class=&#34;nx&#34;&gt;s2i&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;i_str&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;parseInt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;i_str&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;};&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#x9;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// string microsecond (aka mu) to int millisecond (aka ms)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;  &lt;span class=&#34;nx&#34;&gt;smu2ims&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;f_str&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;Math&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;round&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;parseFloat&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;f_str&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;*&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1000&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;};&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#x9;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;mkdate&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;s2i&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;date_parts&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]),&lt;/span&gt; &lt;span class=&#34;c1&#34;&gt;// year&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;                &lt;span class=&#34;nx&#34;&gt;s2i&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;date_parts&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;])&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;c1&#34;&gt;// month &#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;                &lt;span class=&#34;nx&#34;&gt;s2i&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;date_parts&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]),&lt;/span&gt; &lt;span class=&#34;c1&#34;&gt;// day&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;                &lt;span class=&#34;nx&#34;&gt;s2i&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;time_parts&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]),&lt;/span&gt; &lt;span class=&#34;c1&#34;&gt;// hour&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;                &lt;span class=&#34;nx&#34;&gt;s2i&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;time_parts&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]),&lt;/span&gt; &lt;span class=&#34;c1&#34;&gt;// minute&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;                &lt;span class=&#34;nx&#34;&gt;s2i&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;second_parts&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]),&lt;/span&gt; &lt;span class=&#34;c1&#34;&gt;// second&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;                &lt;span class=&#34;nx&#34;&gt;smu2ims&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;.&amp;#34;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;second_parts&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]));&lt;/span&gt; &lt;span class=&#34;c1&#34;&gt;// millisecond&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>Fixing bpython&#39;s delete</title>
      <link>/posts/2014-02-21-fixing-bpythons-delete/</link>
      <pubDate>Fri, 21 Feb 2014 00:21:00 +0000</pubDate>
      <guid>/posts/2014-02-21-fixing-bpythons-delete/</guid>
      <description>&lt;p&gt;A guy named Shironoo &lt;a href=&#34;http://blog.shironoo.org/2012/04/03/216&#34;&gt;found one solution&lt;/a&gt; (&lt;a href=&#34;http://translate.google.com/translate?u=http%3A%2F%2Fblog.shironoo.org%2F2012%2F04%2F03%2F216&amp;amp;act=url&#34;&gt;which I read in english&lt;/a&gt;) to a problem I&amp;rsquo;d been having with &lt;a href=&#34;https://bitbucket.org/bobf/bpython&#34;&gt;bpython&lt;/a&gt; over SSH. Namely that using the delete key &lt;strong&gt;ruins the world&lt;/strong&gt;, or at least kills the current line.&lt;/p&gt;&#xA;&lt;p&gt;My slightly modified (temporary) solution is to make this change:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;in &lt;code&gt;bpython/cli.py&lt;/code&gt;:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;in &lt;code&gt;def p_key(self, key):&lt;/code&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;replace &lt;code&gt;if platform.system() == &#39;Windows&#39;:&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;with &lt;code&gt;if platform.system() in (&#39;Windows&#39;, &#39;Linux&#39;):&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You can find your bpython install with this kinda thing:&lt;/p&gt;</description>
    </item>
    <item>
      <title>txtscan</title>
      <link>/posts/2014-01-27-txtscan/</link>
      <pubDate>Mon, 27 Jan 2014 22:56:12 +0000</pubDate>
      <guid>/posts/2014-01-27-txtscan/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve created a small command-line program called &amp;ldquo;txtscan&amp;rdquo; for scanning the contexts of text files and reporting on the interesting characters and the line endings. It is useful for finding and identifying damage/garbage/exploit attempts in files that are basically just supposed to be ASCII.&lt;/p&gt;&#xA;&lt;p&gt;&amp;ldquo;&lt;a href=&#34;https://github.com/glvnst/txtscan&#34;&gt;txtscan&lt;/a&gt;&amp;rdquo; is available on github.&lt;/p&gt;</description>
    </item>
    <item>
      <title>wikitext</title>
      <link>/posts/2014-01-23-wikitext/</link>
      <pubDate>Thu, 23 Jan 2014 21:35:28 +0000</pubDate>
      <guid>/posts/2014-01-23-wikitext/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve written a small command-line program that downloads the raw wikipedia markup text of the specified article. It does not download images or other supporting media. It does not follow links.&lt;/p&gt;&#xA;&lt;p&gt;It is designed as a shortcut to using &lt;code&gt;curl&lt;/code&gt; or &lt;code&gt;wget&lt;/code&gt; in situations where you want article &lt;strong&gt;markup&lt;/strong&gt;. For example, to get the raw markup for the &amp;ldquo;Abraham Lincoln&amp;rdquo; article, you&amp;rsquo;d normally run &lt;code&gt;wget &#39;http://en.wikipedia.org/w/index.php?title=Abraham_Lincoln&amp;amp;action=raw&#39;&lt;/code&gt;; that&amp;rsquo;s lame. Instead use wikitext, and just run &lt;code&gt;wikitext &amp;quot;Abraham Lincoln&amp;quot;&lt;/code&gt; If you want the markup for the &amp;ldquo;Baberaham Lincoln&amp;rdquo; article, you&amp;rsquo;ll have to write your own program.&lt;/p&gt;</description>
    </item>
    <item>
      <title>taskpaper2busycal</title>
      <link>/posts/2014-01-13-taskpaper2busycal/</link>
      <pubDate>Mon, 13 Jan 2014 13:53:10 +0000</pubDate>
      <guid>/posts/2014-01-13-taskpaper2busycal/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve created a small command-line utility called &lt;a href=&#34;https://github.com/cruft/tree/master/glvnst/time_management/&#34;&gt;taskpaper2busycal&lt;/a&gt; for converting &lt;a href=&#34;http://www.hogbaysoftware.com/products/taskpaper&#34;&gt;TaskPaper&lt;/a&gt; todo lists into &lt;a href=&#34;http://www.busymac.com/busycal/&#34;&gt;BusyCal&lt;/a&gt; events. It&amp;rsquo;s incredibly small and easy because it leverages BusyCal&amp;rsquo;s nice URL handlers and OS X&amp;rsquo;s &amp;ldquo;open&amp;rdquo; command. It&amp;rsquo;s nice when things just work. You can find it on github (at the link above).&lt;/p&gt;</description>
    </item>
    <item>
      <title>&#34;Delete Above&#34; for Inkscape</title>
      <link>/posts/2014-01-07-delete-above-for-inkscape/</link>
      <pubDate>Tue, 07 Jan 2014 11:37:20 +0000</pubDate>
      <guid>/posts/2014-01-07-delete-above-for-inkscape/</guid>
      <description>&lt;p&gt;Just before Christmas, I created an &lt;a href=&#34;http://www.inkscape.org/&#34;&gt;Inkscape&lt;/a&gt; extension called &amp;ldquo;&lt;a href=&#34;https://github.com/glvnst/cruft/tree/master/delete_above&#34;&gt;Delete Above&lt;/a&gt;&amp;rdquo; to help solve a problem that I was having converting a print-formatted map into something more suitable for a GPS app. The extension makes it easier to delete items and everything that appears to be on top of them while preserving what appears to be below. You can find it and more information about how it works &lt;a href=&#34;https://github.com/glvnst/cruft/tree/master/delete_above&#34;&gt;on github&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>OS X Quick Look Preview on the Command-line</title>
      <link>/posts/2013-11-18-os-x-quick-look-preview-on-the-command-line/</link>
      <pubDate>Mon, 18 Nov 2013 20:56:41 +0000</pubDate>
      <guid>/posts/2013-11-18-os-x-quick-look-preview-on-the-command-line/</guid>
      <description>&lt;p&gt;The &lt;code&gt;qlmanage&lt;/code&gt; command has a &lt;code&gt;-p&lt;/code&gt; argument which lets you create &lt;a href=&#34;http://en.wikipedia.org/wiki/Quick_Look&#34;&gt;Quick Look&lt;/a&gt; previews on the command line. So something like this can be nice to have in your shell profile: &lt;code&gt;alias ql=&#39;qlmanage -p&#39;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I decided I needed something a little more featurey than an alias (because &lt;code&gt;qlmanage -p README&lt;/code&gt; is useless). So, I made a &lt;a href=&#34;https://github.com/glvnst/shelltools/blob/master/ql.py&#34;&gt;quick python implementation of ql&lt;/a&gt; which has special treatment for &lt;code&gt;README&lt;/code&gt;, &lt;code&gt;LICENSE&lt;/code&gt;, &lt;code&gt;Makefile&lt;/code&gt; and probably eventually other extension-less file names.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Revisiting Shell Concurrency (this time in ZSH)</title>
      <link>/posts/2013-11-15-revisiting-shell-concurrency-this-time-in-zsh/</link>
      <pubDate>Fri, 15 Nov 2013 23:08:00 +0000</pubDate>
      <guid>/posts/2013-11-15-revisiting-shell-concurrency-this-time-in-zsh/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve been thinking about &lt;a href=&#34;http://galvanist.com/post/51134915590/managed-concurrency-in-the-bash-shell&#34;&gt;concurrency in the command shell&lt;/a&gt; again. This was prompted by my ongoing transition from Bash to ZSH. I&amp;rsquo;ve decided to re-implement my &lt;code&gt;conc&lt;/code&gt; and &lt;code&gt;xconc&lt;/code&gt; functions in a slightly different way.&lt;/p&gt;&#xA;&lt;h2 id=&#34;intro&#34;&gt;Intro&lt;/h2&gt;&#xA;&lt;p&gt;Lets say you have 50 data files to compress. Here&amp;rsquo;s one way:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;% xz *.dat&#xA;&amp;lt;&amp;lt; completed in 2 minutes, 4 seconds &amp;gt;&amp;gt;          &#xA;%&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That&amp;rsquo;s not bad, but it doesn&amp;rsquo;t really take advantage of all those fancy cores we have in our computers these days. Let&amp;rsquo;s run multiple &lt;code&gt;xz&lt;/code&gt; jobs as-parallel-as-possible, so that each file gets its own &lt;code&gt;xz&lt;/code&gt; process.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Sort du intelligently </title>
      <link>/posts/2013-10-22-sort-du-intelligently/</link>
      <pubDate>Tue, 22 Oct 2013 17:14:00 +0000</pubDate>
      <guid>/posts/2013-10-22-sort-du-intelligently/</guid>
      <description>&lt;p&gt;The &lt;code&gt;du&lt;/code&gt; command is a nice tool for telling you the disk usage of your files:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-txt&#34; data-lang=&#34;txt&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;$ du *&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;[...]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;1928&#x9;system.log&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;136&#x9;system.log.0.bz2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;112&#x9;system.log.1.bz2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;0&#x9;uucp&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;552&#x9;vnetlib&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;[...]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I find that adding the &lt;code&gt;-h&lt;/code&gt; flag (which produces more human-readable output) is often very helpful for me:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-txt&#34; data-lang=&#34;txt&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;$ du -h *&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;[...]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;964K&#x9;system.log&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; 68K&#x9;system.log.0.bz2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; 56K&#x9;system.log.1.bz2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  0B&#x9;uucp&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;276K&#x9;vnetlib&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;[...]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now if I could just sort that&amp;hellip;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Solving The Secret Santa Selection &#34;Problem&#34;</title>
      <link>/posts/2013-10-21-solving-the-secret-santa-selection-problem/</link>
      <pubDate>Mon, 21 Oct 2013 20:05:00 +0000</pubDate>
      <guid>/posts/2013-10-21-solving-the-secret-santa-selection-problem/</guid>
      <description>&lt;p&gt;My girlfriend&amp;rsquo;s family does a variation of &lt;a href=&#34;http://en.wikipedia.org/wiki/Secret_Santa&#34;&gt;secret santa&lt;/a&gt; for Christmas every year instead of the more traditional American &amp;ldquo;gift armageddon&amp;rdquo; strategy. I&amp;rsquo;m a fan because it encourages gift creativity and thoughtfulness while eliminating the crazy holiday consumerism that is prevalent here.&lt;/p&gt;&#xA;&lt;p&gt;Every year the selection of giver-receiver pairs must be made and this can be a challenge because &lt;strong&gt;there are strict rules&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;everyone gives once, everyone receives once&lt;/li&gt;&#xA;&lt;li&gt;you can&amp;rsquo;t give to your partner&lt;/li&gt;&#xA;&lt;li&gt;you can&amp;rsquo;t give a gift to someone who is giving a gift to you&lt;/li&gt;&#xA;&lt;li&gt;it should be a secret until gift-giving time&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Last year the selections were made by my girlfriend&amp;rsquo;s sister and Christmas was absolutely delightful. But then at some point afterward I opened my big fat mouth and said that a computer program should do the selections. The response was more or less &amp;ldquo;make it so.&amp;rdquo; Here&amp;rsquo;s my Pythonic attempt. For the web I&amp;rsquo;ve blanked out the PARTNERS map and my SMTP information. The rest is as I ran it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Tail-Recursive Function Transformation in Python</title>
      <link>/posts/2013-08-22-tail-recursive-function-transformation-in-python/</link>
      <pubDate>Thu, 22 Aug 2013 19:57:00 +0000</pubDate>
      <guid>/posts/2013-08-22-tail-recursive-function-transformation-in-python/</guid>
      <description>&lt;h2 id=&#34;intro&#34;&gt;Intro&lt;/h2&gt;&#xA;&lt;p&gt;In 1986, Hal Abelson and Gerald Jay Sussman recorded some videos for their M.I.T. EECS course on the &lt;a href=&#34;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/&#34;&gt;Structure and Interpretation of Computer Programs&lt;/a&gt;. Twenty-seven years later, these videos are still a great resource. But the language featured is the &lt;a href=&#34;http://en.wikipedia.org/wiki/Scheme_%28programming_language%29&#34;&gt;Scheme&lt;/a&gt;&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; dialect of Lisp and while I can/do follow along in &amp;ldquo;edwin&amp;rdquo;, sometimes it&amp;rsquo;s nice to play in a (language (with (less (parens)))), like python.&lt;/p&gt;&#xA;&lt;p&gt;One of the early challenges that I faced while trying to follow a scheme course using python was Scheme&amp;rsquo;s heavily tail-recursive programming idiom. Here&amp;rsquo;s a toy example from the videos where we define a &lt;a href=&#34;http://en.wikipedia.org/wiki/Peano_axioms&#34;&gt;Peano addition&lt;/a&gt; operation that only uses increment and decrement.&lt;/p&gt;</description>
    </item>
    <item>
      <title>The Birdometer v0.1a</title>
      <link>/posts/2013-08-14-the-birdometer/</link>
      <pubDate>Wed, 14 Aug 2013 02:18:02 +0000</pubDate>
      <guid>/posts/2013-08-14-the-birdometer/</guid>
      <description>&lt;h1 id=&#34;the-birdometer-v01a&#34;&gt;The Birdometer v0.1a&lt;/h1&gt;&#xA;&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;There&amp;rsquo;s an old Russian proverb: &amp;ldquo;Make a birdometer, it will be really fun.&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;So I did.&lt;/p&gt;&#xA;&lt;p&gt;My amazing girlfriend and I like birds. We have some hummingbird feeders. We have two &lt;a href=&#34;http://arduino.cc/&#34;&gt;Arduinos&lt;/a&gt;. We want to start taking data about our bird guests. So, we bought some sensors from the amazing &lt;a href=&#34;http://allashers.com/&#34;&gt;Al Lasher&amp;rsquo;s Electronics Store&lt;/a&gt; in Berkeley. Then we made our &amp;ldquo;birdometer&amp;rdquo; by connecting an arduino to a &lt;a href=&#34;http://www.parallax.com/Store/Sensors/ObjectDetection/tabid/176/CategoryID/51/List/0/SortField/0/Level/a/ProductID/83/Default.aspx&#34;&gt;passive infrared sensor&lt;/a&gt;, a &lt;a href=&#34;https://www.sparkfun.com/products/9868&#34;&gt;small microphone&lt;/a&gt;, a Canon EOS 5D camera, and a PC. We then wrote some code to make the arduino trigger the camera shutter when the infrared sensor detects motion. We are also recording audio samples of the birds from the mic and sending them to the PC via USB.&lt;/p&gt;</description>
    </item>
    <item>
      <title>MapStack</title>
      <link>/posts/2013-08-08-mapstack/</link>
      <pubDate>Thu, 08 Aug 2013 01:02:30 +0000</pubDate>
      <guid>/posts/2013-08-08-mapstack/</guid>
      <description>&lt;p&gt;In the San Francisco Bay Area, you have to write a bunch of code to even &lt;em&gt;apply&lt;/em&gt; for I.T. jobs. It doesn&amp;rsquo;t bother me because there is no time pressure and I usually get to work in a language I enjoy on jobs that have tidy solutions.&lt;/p&gt;&#xA;&lt;p&gt;The annoying part is that your work just goes into the bit-bucket, even if (lucky you) you get the job. You can&amp;rsquo;t just publish your solution because then the company would have to come up with a new code challenge. But if you&amp;rsquo;re using the proper level of abstraction, you should be able to publish the reusable bits of your code without spoiling their code challenge.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Arduino &amp; OS X Notes</title>
      <link>/posts/2013-08-05-arduino-os-x-notes/</link>
      <pubDate>Mon, 05 Aug 2013 23:25:46 +0000</pubDate>
      <guid>/posts/2013-08-05-arduino-os-x-notes/</guid>
      <description>&lt;p&gt;My girlfriend and I spent last weekend building &lt;a href=&#34;http://www.arduino.cc/&#34;&gt;Arduino&lt;/a&gt;-controlled devices. Here are some random notes about working with Arduino (in an OSX environment)&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;splurge on a long USB device cable. also a &lt;a href=&#34;https://www.sparkfun.com/products/11317&#34;&gt;breadboard&lt;/a&gt; and &lt;a href=&#34;https://www.sparkfun.com/products/11026&#34;&gt;jumper wires&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://stackoverflow.com/questions/3918032/bash-serial-i-o-and-arduino&#34;&gt;use stty to change baud &amp;amp; other settings on a device file&lt;/a&gt; - having access to the usual unix tools e.g. &lt;code&gt;cat /dev/ttyUSB0&lt;/code&gt; is a really nice thing&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://pyserial.sourceforge.net&#34;&gt;pyserial&lt;/a&gt; is always your friend. seriously it is fantastic.&lt;/li&gt;&#xA;&lt;li&gt;the &lt;a href=&#34;http://arduino.cc/en/Reference/HomePage&#34;&gt;official Arduino docs&lt;/a&gt; are really good&lt;/li&gt;&#xA;&lt;li&gt;don&amp;rsquo;t miss the docs for your specific model, for example, these are the specs for my old-timey &lt;a href=&#34;http://arduino.cc/en/Main/ArduinoBoardDiecimila&#34;&gt;diecimila&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;don&amp;rsquo;t miss the part about Arduino ints being 16-bits. Arduinos are &lt;a href=&#34;http://en.wikipedia.org/wiki/Endianness#Little-endian&#34;&gt;little-endian&lt;/a&gt; but it rarely comes into play. the ADC produces 10-bit values.&lt;/li&gt;&#xA;&lt;li&gt;this &lt;a href=&#34;https://www.sparkfun.com/tutorials/119&#34;&gt;sparkfun article about using Arduino with relays&lt;/a&gt; will be useful to me soon&lt;/li&gt;&#xA;&lt;li&gt;the OS X &lt;a href=&#34;http://www.ftdichip.com/Drivers/VCP.htm&#34;&gt;drivers for the FTDI chip&lt;/a&gt; on old Arduinos like mine are terrible. I&amp;rsquo;ve had 6 kernel panics in the last three days. i finally uninstalled them. luckily ubuntu has native support, so I currently program my old Arduino on the linux machine. My girlfriend&amp;rsquo;s Arduino uno doesn&amp;rsquo;t use this chip and working with it on OS X is fantastic.&lt;/li&gt;&#xA;&lt;li&gt;the digital pin&amp;rsquo;s output mode high/low is enough to operate the coil in &lt;a href=&#34;http://www.radioshack.com/product/index.jsp?productId=2062480&#34;&gt;small low-voltage relays like this&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;this guy is doing interesting things with &lt;a href=&#34;https://sites.google.com/site/measuringstuff/the-arduino#TOC-Yeah-Well-One-Hundred-Samples-Seems-a-Bit-Limiting-and-That-Timing-Thing&#34;&gt;Arduino data acquisition&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;now &lt;a href=&#34;http://beagleboard.org/Products/BeagleBone%20Black&#34;&gt;i want one of these&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;</description>
    </item>
    <item>
      <title>chroot jails on OS X</title>
      <link>/posts/2013-07-31-chroot-jails-on-os-x/</link>
      <pubDate>Wed, 31 Jul 2013 01:09:00 +0000</pubDate>
      <guid>/posts/2013-07-31-chroot-jails-on-os-x/</guid>
      <description>&lt;p&gt;Recently my free time has mostly been dedicated to learning more about parallel computing. But I did take a little detour into the world of old-timey chroot(8) jails on OS X. They work, even on 10.8.4, even running a shell. The big trick on OS X is that you need to &lt;strong&gt;include the dynamic link editor &lt;code&gt;/usr/lib/dyld&lt;/code&gt; in the jail&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Of course you also need to include the programs you want to run in the jail and their dependencies. The &lt;code&gt;otool -L&lt;/code&gt; operation on OS X and the &lt;code&gt;ldd&lt;/code&gt; command on linux are key to finding these dependencies. There are a lot, and you&amp;rsquo;ll need to recursively resolve them. Additionally on OS X, when you are recursively finding the dependencies, you&amp;rsquo;ll need to account for Mach-O&amp;rsquo;s &lt;code&gt;@executable_path&lt;/code&gt;, &lt;code&gt;@loader_path&lt;/code&gt;, and &lt;code&gt;@rpath&lt;/code&gt; variables. This can get a little tricky. On Linux, the libraries are easier but things like PAM can be tricky. This is why you want software like &lt;a href=&#34;http://olivier.sessink.nl/jailkit/&#34;&gt;jailkit&lt;/a&gt;, which can help automate the process of creating and running jails.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Python Reverse Enumerate</title>
      <link>/posts/2013-06-21-python-reverse-enumerate/</link>
      <pubDate>Fri, 21 Jun 2013 00:51:00 +0000</pubDate>
      <guid>/posts/2013-06-21-python-reverse-enumerate/</guid>
      <description>&lt;p&gt;I want to save this thing I came across for future reference&amp;hellip; a nice way to enumerate over an iterable in python in reverse order while retaining the proper indexes.&lt;/p&gt;&#xA;&lt;p&gt;Here&amp;rsquo;s the issue. This code:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;ch&#34;&gt;#!/usr/bin/python&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;WORDS&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;zero&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;one&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;two&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;index&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;string&lt;/span&gt; &lt;span class=&#34;ow&#34;&gt;in&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;enumerate&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;reversed&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;WORDS&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)):&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nb&#34;&gt;print&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;index&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;string&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&amp;hellip; prints this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-txt&#34; data-lang=&#34;txt&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;0 two&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;1 one&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;2 zero&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&amp;hellip; which is &amp;ldquo;wrong&amp;rdquo; for our purposes. words[0] is not &amp;ldquo;two&amp;rdquo;, it is &amp;ldquo;zero&amp;rdquo;. So a quick web search for an elegant solution turned up a comment from &amp;ldquo;&lt;a href=&#34;http://www.blogger.com/profile/07123532353472970521&#34;&gt;ΤΖΩΤΖΙΟΥ&lt;/a&gt;&amp;rdquo; on &lt;a href=&#34;http://christophe-simonis-at-tiny.blogspot.com/2008/08/python-reverse-enumerate.html&#34;&gt;Christophe Simonis&amp;rsquo; 2008 blog entry about reverse enumeration&lt;/a&gt; that has some code I really like:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Task Focus The Dock</title>
      <link>/posts/2013-06-08-task-focus-the-dock/</link>
      <pubDate>Sat, 08 Jun 2013 04:52:00 +0000</pubDate>
      <guid>/posts/2013-06-08-task-focus-the-dock/</guid>
      <description>&lt;h2 id=&#34;the-problem&#34;&gt;The Problem&lt;/h2&gt;&#xA;&lt;p&gt;I was just thinking about my signal-to-noise ratio during coding and I noticed that my OS X dock has lots of stuff in it. I like this stuff. I want to keep this stuff. Also I hate a dock that hides. But I thought this: it would be nice to have an icon to click on that switches the dock between &amp;ldquo;only show running apps&amp;rdquo;-mode and normal mode.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Benchmarking Python Algorithms</title>
      <link>/posts/2013-05-31-benchmarking-python-algorithms/</link>
      <pubDate>Fri, 31 May 2013 00:39:00 +0000</pubDate>
      <guid>/posts/2013-05-31-benchmarking-python-algorithms/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m trying to figure out a fast way to compare the speed of different implementations of a single python algorithm. One option is the &lt;a href=&#34;http://docs.python.org/2.7/library/timeit.html&#34;&gt;timeit module&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;m not sure the best way to setup these comparisons, so I made a function for each implementation: &lt;code&gt;divceil1&lt;/code&gt; &amp;hellip; &lt;code&gt;divceil6&lt;/code&gt;. Then, I made a function to run each and check its output: &lt;code&gt;test1&lt;/code&gt; &amp;hellip; &lt;code&gt;test6&lt;/code&gt;. Finally, I&amp;rsquo;m running the test functions with timeit, e.g.: &lt;code&gt;timeit.timeit(test6, number=5000)&lt;/code&gt;. The output goes to STDOUT, which I&amp;rsquo;m redirecting to a CSV file, for processing in a spreadsheet tool. (I know, I know).&lt;/p&gt;</description>
    </item>
    <item>
      <title>PIL/PIP/Homebrew Problems</title>
      <link>/posts/2013-04-24-pilpiphomebrew-problems/</link>
      <pubDate>Wed, 24 Apr 2013 22:42:00 +0000</pubDate>
      <guid>/posts/2013-04-24-pilpiphomebrew-problems/</guid>
      <description>&lt;p&gt;I have PIL installed via pip. I have libjpeg installed via homebrew. I have the system python.&lt;/p&gt;&#xA;&lt;p&gt;I was having problems with PIL&amp;rsquo;s jpeg module. It was giving the error message: &amp;ldquo;&lt;code&gt;ImportError: The _imaging C module is not installed&lt;/code&gt;&amp;rdquo;. It &lt;em&gt;was&lt;/em&gt; installed, but it was broken. Telling python to &lt;code&gt;import _imaging&lt;/code&gt; gave me the better message: &amp;ldquo;&lt;code&gt;Symbol not found: _jpeg_resync_to_restart&lt;/code&gt;&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;So I had a look: &lt;code&gt;dyldinfo -dylibs /Library/Python/2.7/site-packages/PIL/_imaging.so&lt;/code&gt;&#xA;and saw this:&lt;/p&gt;</description>
    </item>
    <item>
      <title>The VAX MTH$RANDOM Generator in Python</title>
      <link>/posts/2013-04-23-the-vax-mthrandom-generator-in-python/</link>
      <pubDate>Tue, 23 Apr 2013 15:36:00 +0000</pubDate>
      <guid>/posts/2013-04-23-the-vax-mthrandom-generator-in-python/</guid>
      <description>&lt;p&gt;So I needed the ole&amp;rsquo; VAX &lt;code&gt;MTH$RANDOM&lt;/code&gt; for a puzzle. I like python. Here&amp;rsquo;s what I came up with after reading &lt;a href=&#34;http://www.gnu.org/software/gsl/manual/html_node/Other-random-number-generators.html&#34;&gt;some gsl docs&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;def&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;vax_rand&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;seed&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;a&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;69069&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;c&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;m&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;**&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;32&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;while&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;True&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;n&#34;&gt;seed&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;divmod&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;a&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;*&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;seed&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;m&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]&lt;/span&gt; &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;k&#34;&gt;yield&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;seed&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To use it (with a seed of 6), do this: &lt;code&gt;v = vax_rand(6)&lt;/code&gt; and to get a number out of it, you could do &lt;code&gt;print v.next()&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Some Saw-Sharpening Python Resources</title>
      <link>/posts/2013-02-25-saw-sharpening-python-resources/</link>
      <pubDate>Mon, 25 Feb 2013 07:04:01 +0000</pubDate>
      <guid>/posts/2013-02-25-saw-sharpening-python-resources/</guid>
      <description>&lt;h1 id=&#34;some-saw-sharpening-python-resources&#34;&gt;Some Saw-Sharpening Python Resources&lt;/h1&gt;&#xA;&lt;p&gt;I&amp;rsquo;m coding more lately. This weekend I knocked off some rust using these resources on python hacking:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;A &amp;ldquo;&lt;a href=&#34;http://stackoverflow.com/questions/101268/hidden-features-of-python&#34;&gt;Hidden features of Python&lt;/a&gt;&amp;rdquo; question on Stack Overflow doesn&amp;rsquo;t fit the site well but the answers are so much geeky fun.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://docs.python-guide.org/en/latest/&#34;&gt;The Hitchhiker’s Guide to Python&lt;/a&gt; is a work in progress, but is already a valuable resource.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://www.jeffknupp.com/blog/2012/10/24/starting-a-django-14-project-the-right-way/&#34;&gt;Starting a Django 1.4 Project the Right Way&lt;/a&gt; involves using git/hg,  virtualenv,  virtualenvwrapper, pip, south, and fabric.&lt;/p&gt;</description>
    </item>
    <item>
      <title>VectorDesigner: The Resurrection</title>
      <link>/posts/2012-12-15-vectordesigner-the-resurrection/</link>
      <pubDate>Sat, 15 Dec 2012 06:11:00 +0000</pubDate>
      <guid>/posts/2012-12-15-vectordesigner-the-resurrection/</guid>
      <description>&lt;h2 id=&#34;the-problem-vectordesigner-dead&#34;&gt;The Problem: VectorDesigner Dead&lt;/h2&gt;&#xA;&lt;p&gt;A few years ago I bought a vector drawing app called &lt;a href=&#34;http://www.macupdate.com/app/mac/26676/vectordesigner&#34;&gt;VectorDesigner&lt;/a&gt; and then I used it to make a bunch of stuff. Beautiful. Stuff. Then VectorDesigner and it&amp;rsquo;s developer kinda disappeared from the Internet. Time moved on, MacOS 10.7 and 10.8 came out, and the old VectorDesigner app that I still have on my Mac stopped working. It would just fail to launch, bouncing in the dock for a few moments then sagging into an apparent coma without ever showing a window or menubar. This new behavior meant that the many works of beautiful stuff that I lovingly crafted in VectorDesigner were completely inaccessible to me.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Easy JPEG Transcoding</title>
      <link>/posts/2011-10-07-easy-jpeg-transcoding/</link>
      <pubDate>Fri, 07 Oct 2011 07:00:00 +0000</pubDate>
      <guid>/posts/2011-10-07-easy-jpeg-transcoding/</guid>
      <description>&lt;p&gt;&lt;strong&gt;2011-10-07&lt;/strong&gt; : &lt;em&gt;Amundsen-Scott South Pole Station&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&#34;http://ijg.org/&#34;&gt;Independent JPEG Group&lt;/a&gt; is responsible for a C-based JPEG library that is used by lots of software. Their library distribution also includes the very useful binary executables &amp;ldquo;cjpeg&amp;rdquo; and &amp;ldquo;djpeg&amp;rdquo;. When combined, they can be used to transcode JPEGs. I&amp;rsquo;ve used these programs gainfully to transcode JPEGs to 14% of their original size with no visible change in picture quality.&lt;/p&gt;&#xA;&lt;p&gt;To prove the point, I&amp;rsquo;m including the difference between the original seven megabyte version and the transcoded version. A completely black image means there are zero differences. In this one you might be able to make out faint shades of color:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Disjointed &amp; Rebound</title>
      <link>/posts/2011-09-16-disjointed-rebound/</link>
      <pubDate>Fri, 16 Sep 2011 07:00:00 +0000</pubDate>
      <guid>/posts/2011-09-16-disjointed-rebound/</guid>
      <description>&lt;p&gt;&lt;strong&gt;2011-09-16&lt;/strong&gt; : &lt;em&gt;Amundsen-Scott South Pole Station&lt;/em&gt;&lt;/p&gt;&#xA;&lt;!-- raw HTML omitted --&gt;&#xA;&lt;p&gt;So I&amp;rsquo;ve been at the &lt;a href=&#34;http://www.usap.gov/videoclipsandmaps/spWebCam.cfm&#34;&gt;South Pole&lt;/a&gt; for a while. In fact, it has almost been a year now. It has been a challenging winter in some ways and I&amp;rsquo;m feeling more than a little &amp;ldquo;&lt;a href=&#34;http://www.sciencestorm.com/award/9418466.html&#34;&gt;toasty&lt;/a&gt;&amp;rdquo;. I&amp;rsquo;m not sure what else to say about it, so I&amp;rsquo;m going to write about some other stuff&amp;hellip;&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;m switching from &lt;a href=&#34;http://www.assembla.com/spaces/fraise/wiki&#34;&gt;Fraise&lt;/a&gt; to &lt;a href=&#34;http://code.google.com/p/macvim/&#34;&gt;MacVim&lt;/a&gt;. I&amp;rsquo;m also changing shells from bash to zsh. I&amp;rsquo;m changing from &lt;a href=&#34;http://code.google.com/p/macfuse/&#34;&gt;MacFuse&lt;/a&gt; to &lt;a href=&#34;http://osxfuse.github.com/&#34;&gt;OSXFuse&lt;/a&gt;. I&amp;rsquo;m sticking to Firefox for most of my browsing (&lt;a href=&#34;http://noscript.net/&#34;&gt;NoScript&lt;/a&gt; and &lt;a href=&#34;http://adblockplus.org/&#34;&gt;AdBlock Plus&lt;/a&gt; are entirely indispensable). I&amp;rsquo;m giving &lt;a href=&#34;http://www.gpgtools.org/&#34;&gt;GPGTools&lt;/a&gt; a try. &lt;a href=&#34;http://www.boxee.tv/&#34;&gt;Boxee&lt;/a&gt; has been really nice to have in my berthing room. I&amp;rsquo;ve never been a big fan of &lt;a href=&#34;http://www.gnu.org/s/screen/&#34;&gt;GNU screen&lt;/a&gt;, but I&amp;rsquo;m interested in &lt;a href=&#34;http://tmux.sourceforge.net/&#34;&gt;tmux&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
