<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jason Seifer &#187; Programming</title>
	<atom:link href="http://jasonseifer.com/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://jasonseifer.com</link>
	<description></description>
	<lastBuildDate>Mon, 30 Jan 2012 14:41:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Automatically updating your IP with DNSimple</title>
		<link>http://jasonseifer.com/2011/04/04/auto-update-ip-dnsimple</link>
		<comments>http://jasonseifer.com/2011/04/04/auto-update-ip-dnsimple#comments</comments>
		<pubDate>Mon, 04 Apr 2011 12:53:05 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[dns]]></category>

		<guid isPermaLink="false">http://jasonseifer.com/?p=548</guid>
		<description><![CDATA[I&#8217;ve been using DNSimple for most a lot of my domain hosting lately. It&#8217;s a great service and I highly recommend checking them out for domain hosting. Recently I went out of town but wanted some way to be able to SSH home if I needed to. Luckily, DNSimple has a nice REST API that [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dnsimple.com"><img src="http://jasonseifer.com/assets/dnsimple.png" alt="DNSimple" class="alignright" width="240" height="90" /></a></p>
<p>
I&#8217;ve been using <a href="https://DNSimple.com">DNSimple</a> for most a lot of my domain hosting lately. It&#8217;s a great service and I highly recommend checking them out for domain hosting. Recently I went out of town but wanted some way to be able to SSH home if I needed to. Luckily, DNSimple has a nice REST API that lets me update records easily. I created a &quotp;home&quot; record for one of my domains and created a script to auto update:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #007800;">LOGIN</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #007800;">PASSWORD</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #007800;">DOMAIN_ID</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #007800;">RECORD_ID</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #007800;">IP</span>=”<span style="color: #000000; font-weight: bold;">`</span>curl http:<span style="color: #000000; font-weight: bold;">//</span>jsonip.com <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-Eo</span> ‘<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">0</span>-<span style="color: #000000;">9</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">1</span>,<span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>\.<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">0</span>-<span style="color: #000000;">9</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">1</span>,<span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>’<span style="color: #000000; font-weight: bold;">`</span>”
&nbsp;
curl <span style="color: #660033;">-H</span> <span style="color: #ff0000;">&quot;Accept: application/json&quot;</span> \
     <span style="color: #660033;">--basic</span> <span style="color: #660033;">-u</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$LOGIN</span>:<span style="color: #007800;">$PASSWORD</span>&quot;</span> \
     <span style="color: #660033;">-H</span> <span style="color: #ff0000;">&quot;Content-Type: application/json&quot;</span> \
     <span style="color: #660033;">-i</span> <span style="color: #660033;">-X</span> PUT https:<span style="color: #000000; font-weight: bold;">//</span>DNSimple.com<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DOMAIN_ID</span><span style="color: #000000; font-weight: bold;">/</span>records<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$RECORD_ID</span>.json \
     <span style="color: #660033;">-d</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">&quot;record&quot;</span>:<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">&quot;content&quot;</span>:<span style="color: #ff0000;">&quot;<span style="color: #007800;">$IP</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>It uses the awesome new <a href="http://jsonip.com">jsonip</a> service to grab your ip. It then does a quick sed parsing on that output to grab just your ip. Finally it does a put to the record in DNSimple updating it with the new information. You must have already created a record and domain in order for this to work. I saved this script as <code>dnsimple_update.sh</code> in my <code>~/bin</code> directory.</p>
<p>Fill in your login and password credentials (or set some environment variables) and domain and record ids and you&#8217;re good to go. You can get your domain and record ids by hovering over the edit link in the advanced editor in DNSimple for the record you want and copying and pasting the domain and record ids.</p>
<p>Finally, I set it to run as a cronjob every 15 minutes:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># m h  dom mon dow   command</span>
<span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">15</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>my_user<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>DNSimple_update.sh</pre></div></div>

<p>This worked out very well and with some port forwarding on my home router I was able to ssh in to my home machines without any problems.</p>
<p>
  <strong>Update:</strong> <a href="http://kristopher.biz/">Kristopher Murata</a> gave a correction to the script in the comments since jsonip changed their format. Twice!! Thanks, Kris!</p>
]]></content:encoded>
			<wfw:commentRss>http://jasonseifer.com/2011/04/04/auto-update-ip-dnsimple/feed</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Textmate Next and Previous Tab Keys</title>
		<link>http://jasonseifer.com/2010/11/13/textmate-next-and-previous-tab-keys</link>
		<comments>http://jasonseifer.com/2010/11/13/textmate-next-and-previous-tab-keys#comments</comments>
		<pubDate>Sat, 13 Nov 2010 22:27:02 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://jasonseifer.com/?p=538</guid>
		<description><![CDATA[If you&#8217;ve just upgraded to Revision 1616 of Textmate, you may be wondering why your next and previous file tab keys stopped working. The author of Textmate recently changed the next and previous file tab key shortcuts to the universal mac application equivalents. Here it is in the release notes: [CHANGED] Change next/previous file tab [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve just upgraded to Revision 1616 of Textmate, you may be wondering why your next and previous file tab keys stopped working. The author of Textmate recently changed the next and previous file tab key shortcuts to the universal mac application equivalents. Here it is in the release notes:</p>
<p>
<code><strong>[CHANGED]</strong> Change next/previous file tab key equivalents to shift command [ and ]. This has become the de facto standard.</code>
</p>
<p>I tried to deal with this for a few days but that keyboard shortcut is  just too ingrained in my brain.  You can fix this, though, by going in to your Keyboard preference pane, then the &quot;Keyboard Shortcuts&quot; tab. Under &quot;Application Shortcuts&quot; click the plus button, find TextMate, and add the following:</p>
<p><img style="display:block; margin-left:auto; margin-right:auto;" src="http://jasonseifer.com/assets/textmate-keyboard.png" alt="TextMate Keyboard Shortcuts" border="0" width="600" height="536" /></p>
<p>Voila. Fixed! Now you can get back to coding at the speed of thought.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasonseifer.com/2010/11/13/textmate-next-and-previous-tab-keys/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>On Passwords</title>
		<link>http://jasonseifer.com/2010/03/21/on-passwords</link>
		<comments>http://jasonseifer.com/2010/03/21/on-passwords#comments</comments>
		<pubDate>Sun, 21 Mar 2010 10:00:11 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[passwords]]></category>

		<guid isPermaLink="false">http://jasonseifer.com/?p=355</guid>
		<description><![CDATA[On a recent episode of The Dev Show Dan and I talked about passwords. In particular, the topic of password hashing came up. I&#8217;d like to say up front that I&#8217;m not a security guy and most definitely not a cryptographer. However, I don&#8217;t have to be because there are much smarter people who have [...]]]></description>
			<content:encoded><![CDATA[<p>On a recent episode of <a href="http://5by5.tv/devshow/4">The Dev Show</a> Dan and I talked about passwords. In particular, the topic of password hashing came up. I&#8217;d like to say up front that I&#8217;m not a security guy and most definitely not a cryptographer. However, I don&#8217;t <em>have</em> to be because there are much smarter people who have already done a lot of work on encryption schemes and have done it much better than I ever could.</p>
<div class="image_caption"><img src="http://jasonseifer.com/assets/2010/03/9EB3D76B-FB9C-43A5-B23D-CB6EB6EB28F9.jpg" alt="Spaceballs" border="0" width="360" height="240" /><br />
Above: discussion of best practices in passwords.
</div>
<p></p>
<p>This should go without saying: you shouldn&#8217;t be storing your passwords in plain text in your database. Unless you need to be able to retrieve the password later, it should be stored in the database in a hashed format. Thomas Ptacek, a very highly respected security professional, explains all you need to know about passwords in <a href="http://chargen.matasano.com/chargen/2007/9/7/enough-with-the-rainbow-tables-what-you-need-to-know-about-s.html">this blog post</a>. I&#8217;ll save you the trouble of reading the whole thing: just use <a href="http://en.wikipedia.org/wiki/Bcrypt">bcrypt</a> as your encryption scheme. It&#8217;s the slowest to generate the encrypted hash. By virtue of being slow to generate, it would also take a <em>very</em> long time to perform a successful lookup using <a href="http://en.wikipedia.org/wiki/Rainbow_tables">rainbow tables</a>. See that blog post linked for much more information and a thorough explanation.</p>
<p>Just how much longer does it take to generate? The following is a quick ruby program I whipped up to benchmark. It uses each encryption scheme to generate a password 50 times.  The following was how long it took to run on my macbook using ruby 1.9.1-p378.  You can grab the script <a href="http://gist.github.com/339346">here</a> if you&#8217;d like to run it locally. It contains absolutely no tests which makes my inner <a href="http://www.coreyhaines.com/">Corey Haines</a> frown:</p>
<pre>
  Password to hash: password
                    user     system      total        real
  MD5           0.000000   0.000000   0.000000 (  0.001443)
  SHA1          0.000000   0.000000   0.000000 (  0.001679)
  SHA256        0.000000   0.000000   0.000000 (  0.001308)
  bcrypt (3)    0.080000   0.000000   0.080000 (  0.086532)
  bcrypt (10)   4.550000   0.010000   4.560000 (  4.601996)
</pre>
<p>The differences between the (3) and (10) are the &quot;cost&quot; of generating the password. The documentation for the bcrypt gem summarizes that very well:</p>
<blockquote><p>
    Takes an optional :cost option, which is a logarithmic variable which determines how computational expensive the hash is to calculate (a :cost of 4 is twice as much work as a :cost of 3). The higher the :cost the harder it becomes for attackers to try to guess passwords (even if a copy of your database is stolen), but the slower it is to check users’ passwords.
  </p></blockquote>
<p>But I&#8217;m getting off topic. The reason I wanted to write this post was to create a list of popular open source software and see what kind of passwords hashing schemes are in use.  Here&#8217;s the list I&#8217;ve compiled so far:</p>
<ul>
<li>
<p><strong><a href="http://www.djangoproject.com/">Django</a></strong><br />
    <strong>Encryption Scheme: </strong>SHA1, MD5, or crypt<br />
    <strong>Notes: </strong>Previous Django versions, such as 0.90, used simple MD5 hashes without password salts. For backwards compatibility, those are still supported; they&#8217;ll be converted automatically to the new style the first time check_password() works correctly for a given user. More info:<br />
    <a href="http://docs.djangoproject.com/en/dev/topics/auth/">http://docs.djangoproject.com/en/dev/topics/auth/</a><br />
    <a href="http://docs.python.org/library/crypt.html">http://docs.python.org/library/crypt.html</a></td>
</p>
</li>
<li>
<p>
    <strong><a href="http://dev.mysql.com/">MySQL</a></strong><br />
    <strong>Encryption Scheme: </strong>Double SHA1
   </p>
</li>
<li>
<p>
        <strong><a href="http://wordpress.org">WordPress</a></strong><br />
        <strong>Encryption Scheme: <a href="http://www.openwall.com/phpass/">PHPass</a></strong><br />
        <strong>Notes</strong> The awkwardly named PHPass library defaults to bcrypt (awesome) and falls back to DES or MD5 based salted hashes depending on the php version and supported features.
      </p>
</li>
<li>
<p>
        <strong><a href="http://expressionengine.com/">Expression Engine</a></strong><br />
        <strong>Encryption Scheme: </strong> SHA1</p>
</li>
<li>
<p>
      <strong><a href="http://www.joomla.org/">Joomla</a></strong><br />
      <strong>Encryption Scheme: </strong> MD5
    </p>
</li>
<li>
<p>
      <strong><a href="http://phpbb.com">phpBB</a></strong><br />
      <strong>Encryption Scheme: </strong> Proprietary hash method using /dev/urandom and md5
    </p>
</li>
<li>
<p>
      <strong>ASP.Net Authentication</strong><br />
      <strong>Encryption Scheme: </strong> Uses a concept of &quot;<a href="http://msdn.microsoft.com/en-us/library/eeyk640h.aspx">providers</a>&quot;.<br />
      <strong>Notes: </strong> There&#8217;s a <a href="http://derekslager.com/blog/posts/2007/10/bcrypt-dotnet-strong-password-hashing-for-dotnet-and-mono.ashx">BCrypt</a> open source option available.</p>
</li>
<li>
<p>
      <strong>Rails: <a href="http://github.com/technoweenie/restful-authentication">restful-authentication</a></strong><br />
      <strong>Encryption Scheme: </strong> SHA1<br />
      <strong>Notes: </strong> This was the defacto standard for a long time in the Rails world as far as authentication goes. Changing the encryption scheme in an application would be a <em>relatively</em> painless process.
    </p>
</li>
<li>
<p>
      <strong>Rails: <a href="http://github.com/binarylogic/authlogic">Authlogic</a></strong><br />
      <strong>Encryption Scheme: </strong> bcrypt, aes256, md5, sha1, sha256, sha512<br />
      <strong>Notes: </strong> This is configurable to any of the listed options. Default is SHA512. The author doesn&#8217;t recommend using MD5 or SHA1 in the README but provides the options for migration and compaitiblity. How awesome is that?
    </p>
</li>
<li>
<p>
          <strong><a href="http://drupal.org/">Drupal</a></strong><br />
          <strong>Encryption Scheme: </strong> MD5 by default<br />
          <strong>Notes:</strong> Christefano points out in the comments that MD5 is used by default but PHPass and AES are available via third party modules.
       </p>
</li>
</ul>
<p>If you don&#8217;t see your favorite software here, either leave it in the comments or <a href="http://jasonseifer.com/contact">contact me</a> and I&#8217;ll add it to the list. These are in no particular order, so I&#8217;m not trying to favor anything in particular (though we all know I&#8217;m mostly a Ruby developer).</p>
]]></content:encoded>
			<wfw:commentRss>http://jasonseifer.com/2010/03/21/on-passwords/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Using Concentrate for the Pomodoro Technique on OS X</title>
		<link>http://jasonseifer.com/2010/02/08/using-concentrate-for-pomodoro</link>
		<comments>http://jasonseifer.com/2010/02/08/using-concentrate-for-pomodoro#comments</comments>
		<pubDate>Mon, 08 Feb 2010 20:21:28 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[pomodoro]]></category>
		<category><![CDATA[technique]]></category>

		<guid isPermaLink="false">http://jasonseifer.com/?p=322</guid>
		<description><![CDATA[Concentrate is a Mac only app. It lets you do a number of things like block web sites, launch apps, play sounds, etc. Combinations of these things can be configured to go on for varying amounts of time. I use it for the Pomodoro Technique when programming. Corey Haines introduced me to Tomatoist when I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://getconcentrating.com/"><img src="http://jasonseifer.com/assets/2010/02/concentrate.png" alt="concentrate.png" border="0" width="325" height="158" class="alignright" /></a></p>
<p><a href="http://getconcentrating.com/">Concentrate</a> is a Mac only app. It lets you do a number of things like block web sites, launch apps, play sounds, etc. Combinations of these things can be configured to go on for varying amounts of time. I use it for the <a href="http://www.pomodorotechnique.com/">Pomodoro Technique</a> when programming. <a href="http://coreyhaines.com/">Corey Haines</a> introduced me to <a href="http://tomatoi.st">Tomatoist</a> when I paired with him during one of his journeyman tours. While that site is awesome, I prefer using the Mac app to force eliminate distractions.</p>
<h3>The Pomodoro Technique</h3>
<p>The root of the idea is that you program for 25 minutes straight and then break for 5 minutes. This seems like a pretty simple idea but when you&#8217;re working by yourself things can happen. For example, maybe you want to send a quick email to someone but want to refer to something in their Facebook account you can&#8217;t quite remember. So then you look it up. While looking it up you notice something else interesting by another one of your friends and the distractions start. By the end of the distractions you&#8217;ve ordered enough parts for a fully functional robot suit off eBay. If you only had 5 minutes to do this stuff, maybe that wouldn&#8217;t have happened.</p>
<h3>Setting Up Concentrate</h3>
<p><a href="http://jasonseifer.com/assets/2010/02/concentrate-newtask.png"><img  class="alignright" src="http://jasonseifer.com/assets/2010/02/concentrate-newtask-300x291.png" alt="Concentrate New Task" border="0" width="300" height="291" /></a></p>
<p>Concentrate is actually a very simple application to use. Click on the &#8220;New Activity Button&#8221; and set your options. I called mine &quot;Program Pomodoro.&quot; It&#8217;s set to block any site that could potentially distract me, Growl a message, and play a sound on completion. The typical Pomodoro technique lasts 25 minutes so drag the location slider over until you see 25 minutes. Boom, good to go. Now you can&#8217;t look at anyone&#8217;s Facebook account or respond to any threads on <a href="http://news.ycombinator.com">hacker news</a> for a good 25 minutes.  You&#8217;ll get to that during your break.
</p>
<p><a href="ttp://jasonseifer.com/assets/2010/02/concentrate-activities.png"><img class="alignright" src="http://jasonseifer.com/assets/2010/02/concentrate-activities-300x236.png" alt="Concentrate Activities" border="0" width="300" height="236" /></a></p>
<p>The next task you&#8217;ll want to set up is the break. This is the most rewarding task. I just have this one Growl a message (&quot;Get back to work!&quot;) and play a sound when it&#8217;s done. The duration slider should be set to 5 minutes.
</p>
<h3>Get To It!</h3>
<p>That&#8217;s about it. It&#8217;s simple software and well worth the $30 to eliminate distractions. I use it only for those two techniques listed above and have been very happy. Special thanks to <a href="http://coreyhaines.com">Corey Haines</a> for introducing me to the Pomodoro technique.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasonseifer.com/2010/02/08/using-concentrate-for-pomodoro/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

