<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>A place for thoughts and links by Garret Heaton.</description><title>powdahound's lodge</title><generator>Tumblr (3.0; @powdahound)</generator><link>http://blog.powdahound.com/</link><item><title>Tricky Apache configuration bug</title><description>&lt;p&gt;When using Apache’s &lt;a href="http://httpd.apache.org/docs/2.2/mod/mod_dir.html#directoryindex" target="_blank"&gt;DirectoryIndex&lt;/a&gt; directive make sure you don’t separate the values with commas. If you do, Apache will be looking for filenames ending in commas!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bad:&lt;/strong&gt; &lt;code&gt;DirectoryIndex index.html, index.php, index.cgi&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good:&lt;/strong&gt; &lt;code&gt;DirectoryIndex index.html index.php index.cgi&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This took me longer to figure out than it should have. :\&lt;/p&gt;</description><link>http://blog.powdahound.com/post/239555172</link><guid>http://blog.powdahound.com/post/239555172</guid><pubDate>Tue, 10 Nov 2009 15:01:29 -0800</pubDate></item><item><title>Colorize log output with ack</title><description>&lt;p&gt;Adding color to log files makes them a lot easier to understand, especially when &lt;a href="http://en.wikipedia.org/wiki/Tail_%28Unix%29" target="_blank"&gt;tailing&lt;/a&gt; them. That’s why tools like &lt;a href="http://www.vanheusden.com/multitail" target="_blank"&gt;MultiTail&lt;/a&gt; were created, and &lt;a href="http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4perl/Appender/ScreenColoredLevels.html" target="_blank"&gt;some&lt;/a&gt; &lt;a href="http://wiki.osuosl.org/display/howto/ANSI+Color+logging+with+log4j+for+any+appender" target="_blank"&gt;logging&lt;/a&gt; tools can output in color. Last night I realized color could be added to any log file using &lt;a href="http://betterthangrep.com" target="_blank"&gt;ack&lt;/a&gt;, an awesome &lt;a href="http://en.wikipedia.org/wiki/Grep" target="_blank"&gt;grep&lt;/a&gt; replacement that I &lt;a href="http://blog.powdahound.com/post/191057185/ack-better-than-grep-a-power-search-tool-for" target="_blank"&gt;recently found&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For example, to make 404s red in a standard Apache access log:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tail -f /var/log/apache2/access.log | ack --passthru --color-match=red "^.* 404 .*$"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;--passthru&lt;/code&gt; option makes it so no lines are discarded. You can use multiple colors by piping the output through &lt;code&gt;ack&lt;/code&gt; multiple times. The &lt;code&gt;--flush&lt;/code&gt; option is needed to prevent pipe buffering issues and the &lt;code&gt;--color&lt;/code&gt; option is needed to pass colors through. Here’s an example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tail -f /var/log/apache2/access.log | ack --flush --passthru --color --color-match=green "^.* 200 .*" | ack --flush --passthru --color --color-match=yellow "^.* 302 .*" | ack --flush --passthru --color --color-match=red "^.* 404 .*"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://farm3.static.flickr.com/2433/3998807621_95498f0ba2_o.png" alt="Apache access log colored with ack"/&gt;&lt;/p&gt;

&lt;p&gt;You can use more complex colors like &lt;code&gt;--color="white on_red"&lt;/code&gt; to make errors stand out even more.&lt;/p&gt;

&lt;p&gt;I wonder what other cool things ack can do…&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You could also &lt;a href="http://fixunix.com/unix/83044-tail-color.html" target="_blank"&gt;do this with perl&lt;/a&gt;, but it looks a lot less maintainable.&lt;/p&gt;</description><link>http://blog.powdahound.com/post/209624101</link><guid>http://blog.powdahound.com/post/209624101</guid><pubDate>Sat, 10 Oct 2009 16:52:19 -0700</pubDate></item><item><title>RegExhibit</title><description>&lt;a href="http://homepage.mac.com/roger_jolly/software/#regexhibit"&gt;RegExhibit&lt;/a&gt;: &lt;p&gt;Nice OSX app for testing regular expressions.&lt;/p&gt;</description><link>http://blog.powdahound.com/post/207713227</link><guid>http://blog.powdahound.com/post/207713227</guid><pubDate>Thu, 08 Oct 2009 11:25:02 -0700</pubDate></item><item><title>Sublime Text: The text editor you'll fall in love with</title><description>&lt;a href="http://www.sublimetext.com/"&gt;Sublime Text: The text editor you'll fall in love with&lt;/a&gt;: &lt;p&gt;This looks like a great editor, or at least the start of one.&lt;/p&gt;</description><link>http://blog.powdahound.com/post/197747127</link><guid>http://blog.powdahound.com/post/197747127</guid><pubDate>Sat, 26 Sep 2009 14:55:43 -0700</pubDate></item><item><title>The Truth About EPA City / Highway MPG Estimates</title><description>&lt;a href="http://www.caranddriver.com/features/09q3/the_truth_about_epa_city_highway_mpg_estimates-feature"&gt;The Truth About EPA City / Highway MPG Estimates&lt;/a&gt;: &lt;p&gt;What a bizarre system…&lt;/p&gt;</description><link>http://blog.powdahound.com/post/191939177</link><guid>http://blog.powdahound.com/post/191939177</guid><pubDate>Sat, 19 Sep 2009 12:23:37 -0700</pubDate></item><item><title>ack -- better than grep, a power search tool for programmers</title><description>&lt;a href="http://betterthangrep.com/"&gt;ack -- better than grep, a power search tool for programmers&lt;/a&gt;: &lt;p&gt;Another awesome tool I wish I’d found earlier.&lt;/p&gt;</description><link>http://blog.powdahound.com/post/191057185</link><guid>http://blog.powdahound.com/post/191057185</guid><pubDate>Fri, 18 Sep 2009 08:49:32 -0700</pubDate></item><item><title>mkscript - test script creator</title><description>&lt;p&gt;I usually do something wrong when I create test scripts (typo in shebang, not executable, missing open PHP tag, etc) so I wrote a small tool called mkscript that can create them for me.&lt;/p&gt;

&lt;p&gt;Basically, instead of doing:&lt;/p&gt;

&lt;pre&gt;echo '#!/usr/bin/python' &gt; test.py
chmod a+x test.py&lt;/pre&gt;

&lt;p&gt;You just do:&lt;/p&gt;

&lt;pre&gt;mkscript test.py&lt;/pre&gt;

&lt;p&gt;It knows how to create scripts for bash, perl, php, python, and ruby based on the extension you provide. You can get it &lt;a href="http://gist.github.com/188362" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Pair it with &lt;a href="http://blog.powdahound.com/post/124883176/execute-current-file-in-vim" target="_blank"&gt;this vim function to execute the current file&lt;/a&gt; and you have a really quick way to create and run test scripts!&lt;/p&gt;</description><link>http://blog.powdahound.com/post/189982500</link><guid>http://blog.powdahound.com/post/189982500</guid><pubDate>Wed, 16 Sep 2009 22:50:00 -0700</pubDate></item><item><title>Read It Later: Save Your One Read Wonders</title><description>&lt;a href="http://readitlaterlist.com/"&gt;Read It Later: Save Your One Read Wonders&lt;/a&gt;: &lt;p&gt;Not sure how I didn’t find this until now, but it seems very cool.&lt;/p&gt;</description><link>http://blog.powdahound.com/post/180486324</link><guid>http://blog.powdahound.com/post/180486324</guid><pubDate>Sat, 05 Sep 2009 09:55:47 -0700</pubDate></item><item><title>Tahoe has Shut Down the Cloud Seeding Program</title><description>&lt;a href="http://thewinterlife.com/2009/08/18/tahoe-has-shut-down-the-cloud-seeding-program/"&gt;Tahoe has Shut Down the Cloud Seeding Program&lt;/a&gt;: &lt;p&gt;Hopefully we have a good natural snow year so I can make good use of that season pass!&lt;/p&gt;</description><link>http://blog.powdahound.com/post/173087697</link><guid>http://blog.powdahound.com/post/173087697</guid><pubDate>Thu, 27 Aug 2009 09:53:46 -0700</pubDate></item><item><title>MarIrssi is a great alternative to other Mac IRC clients.</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_kowvq779sD1qz50ono1_250.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a href="http://www.sysctl.co.uk/projects/macirssi/" target="_blank"&gt;MarIrssi&lt;/a&gt; is a great alternative to other Mac IRC clients.&lt;/p&gt;</description><link>http://blog.powdahound.com/post/170962455</link><guid>http://blog.powdahound.com/post/170962455</guid><pubDate>Mon, 24 Aug 2009 19:46:53 -0700</pubDate></item><item><title>Video: Douglas Crockford — The JSON Saga</title><description>&lt;a href="http://developer.yahoo.com/yui/theater/video.php?v=crockford-json"&gt;Video: Douglas Crockford — The JSON Saga&lt;/a&gt;: &lt;p&gt;Learned a lot from this talk.&lt;/p&gt;</description><link>http://blog.powdahound.com/post/169232042</link><guid>http://blog.powdahound.com/post/169232042</guid><pubDate>Sat, 22 Aug 2009 16:14:52 -0700</pubDate></item><item><title>The launch years of today’s most popular websites | Royal...</title><description>&lt;img src="http://28.media.tumblr.com/fWmrTRsPNqj625akZd8pUQhQo1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a href="http://royal.pingdom.com/2009/07/27/the-launch-years-of-today%e2%80%99s-most-popular-websites/" target="_blank"&gt;The launch years of today’s most popular websites | Royal Pingdom&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.powdahound.com/post/152300295</link><guid>http://blog.powdahound.com/post/152300295</guid><pubDate>Thu, 30 Jul 2009 08:09:35 -0700</pubDate></item><item><title>trickle</title><description>&lt;a href="http://monkey.org/~marius/pages/?page=trickle"&gt;trickle&lt;/a&gt;: &lt;p&gt;Comes in handy when you have to upload a bunch of files over a slower connection.&lt;/p&gt;</description><link>http://blog.powdahound.com/post/139690966</link><guid>http://blog.powdahound.com/post/139690966</guid><pubDate>Sat, 11 Jul 2009 09:11:52 -0700</pubDate></item><item><title>Mac's DigitalColor Meter.app</title><description>&lt;a href="http://www.macosxtips.co.uk/index_files/digital-color-meter-tips.html"&gt;Mac's DigitalColor Meter.app&lt;/a&gt;: &lt;p&gt;This is a great tool to learn if you’re on a Mac. It’s also an easy replacement for the &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/271" target="_blank"&gt;ColorZilla Firefox addon&lt;/a&gt;.&lt;/p&gt;</description><link>http://blog.powdahound.com/post/139081098</link><guid>http://blog.powdahound.com/post/139081098</guid><pubDate>Fri, 10 Jul 2009 08:16:35 -0700</pubDate></item><item><title>"According to the Audi, the automaker’s three main tenets are Value, Precision, and..."</title><description>“According to the Audi, the automaker’s three main tenets are Value, Precision, and Fascination, and they all add up to Quality.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;&lt;p&gt;Three great things to strive for in software development as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.autoblog.com/2009/07/05/what-goes-into-german-engineering-audis-techday-quality/" target="_blank"&gt;VIDEO: What goes into German engineering - Audi’s TechDay Quality&lt;/a&gt;&lt;/p&gt;&lt;/em&gt;</description><link>http://blog.powdahound.com/post/136136122</link><guid>http://blog.powdahound.com/post/136136122</guid><pubDate>Sun, 05 Jul 2009 19:14:31 -0700</pubDate></item><item><title>Velocity 09: Adam Jacob and Ezra Zygmuntowicz, "Infrastructure in the Cloud Era"</title><description>&lt;a href="http://velocityconference.blip.tv/file/2285124/"&gt;Velocity 09: Adam Jacob and Ezra Zygmuntowicz, "Infrastructure in the Cloud Era"&lt;/a&gt;: &lt;p&gt;Great talk on server bootstrapping and configuration in the cloud.&lt;/p&gt;</description><link>http://blog.powdahound.com/post/134208908</link><guid>http://blog.powdahound.com/post/134208908</guid><pubDate>Thu, 02 Jul 2009 08:53:48 -0700</pubDate></item><item><title>Focus first empty input element using jQuery</title><description>&lt;p&gt;It’s often helpful to auto-focus form elements for users of your site so they don’t have to manually select them with the mouse. I’d been using the following code on a few sites:&lt;/p&gt;

&lt;script src="http://gist.github.com/153203.js"&gt;&lt;/script&gt;&lt;p&gt;It will focus the first input element on the page that is visible, enabled, doesn’t contain any text, and doesn’t have the class ‘nofocus’ (so you can avoid search fields or other secondary inputs). One of the cool things about &lt;a href="http://jquery.com" target="_blank"&gt;jQuery&lt;/a&gt; is that you can write some really short code to do very powerful things. Here’s my jQuery implementation of the above code:&lt;/p&gt;

&lt;script src="http://gist.github.com/153214.js"&gt;&lt;/script&gt;&lt;p&gt;The only functionality that is lost is focusing of text and password fields only. jQuery’s &lt;a href="http://docs.jquery.com/Selectors" target="_blank"&gt;selectors&lt;/a&gt; make it easy to select all input elements, just text, or just password, but not “text OR password” as far as I can tell. If you can make it any shorter please let me know!&lt;/p&gt;</description><link>http://blog.powdahound.com/post/132559120</link><guid>http://blog.powdahound.com/post/132559120</guid><pubDate>Mon, 29 Jun 2009 16:39:00 -0700</pubDate></item><item><title>Using Gmail as Sendmail's relay</title><description>&lt;p&gt;Comcast just started &lt;a href="http://news.zdnet.com/2100-3513_22-136518.html" target="_blank"&gt;blocking port 25&lt;/a&gt; at my house which caused sendmail to be unable to connect to external mail servers to deliver mail. Some people have been able to convince Comcast to open up the port for them but we weren’t so lucky. Instead, I changed sendmail to use Gmail’s SMTP server as its relay server.&lt;/p&gt;

&lt;p&gt;Before making these changes I’d see lots of errors in /var/log/mail.log ending in &lt;em&gt;stat=Deferred: Connection timed out with aspmx2.googlemail.com.&lt;/em&gt; or something similar. Trying to &lt;code&gt;telnet aspmx2.googlemail.com 25&lt;/code&gt; would result in a timeout.&lt;/p&gt;

&lt;p&gt;I found all the information on how to do this in these two articles; &lt;a href="http://elliotli.blogspot.com/2007/08/gmail-fetchmail-and-sendmail-on.html" target="_blank"&gt;Yan Li’s Words: Gmail, Fetchmail and Sendmail on UNIX/Linux&lt;/a&gt; and &lt;a href="http://www.linuxha.com/other/sendmail/gmail.html" target="_blank"&gt;Linux, Sendmail and Gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;All of this was done on a server running Ubuntu 8.04.2 and sendmail 8.14.2.&lt;/p&gt;

&lt;h3&gt;Step 1&lt;/h3&gt;

&lt;p&gt;Edit your /etc/mail/sendmail.mc and add the following above the &lt;em&gt;MAILER_DEFINITIONS&lt;/em&gt; block at the bottom. I tried putting these lines at the very bottom of the file the first time and it didn’t work. I suggest copy/pasting because the quotes are very strange.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;define(`SMART_HOST',`smtp.gmail.com')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Step 2&lt;/h3&gt;

&lt;p&gt;Create the /etc/mail/auth/client-info file by running:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;% mkdir -p /etc/mail/auth
% chmod 700 /etc/mail/auth
% touch /etc/mail/auth/client-info
% chmod 600 client-info
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Step 3&lt;/h3&gt;

&lt;p&gt;Edit /etc/mail/auth/client-info and fill it with the lines below. Replace &lt;strong&gt;user_id&lt;/strong&gt; with your Gmail user id (&lt;strong&gt;user_id&lt;/strong&gt;@gmail.com) and &lt;strong&gt;password&lt;/strong&gt; with your password. Make sure there is a blank line at the end of the file.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;AuthInfo:smtp.gmail.com "U:smmsp" "I:user_id" "P:password" "M:PLAIN"
AuthInfo:smtp.gmail.com:587 "U:smmsp" "I:user_id" "P:**password" "M:PLAIN"
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Step 4&lt;/h3&gt;

&lt;p&gt;Compile the client-info file.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;% cd /etc/mail/auth
% makemap -r hash client-info.db &lt; client-info
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Step 5&lt;/h3&gt;

&lt;p&gt;Compile update sendmail.cf with our sendmail.mc changes.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;% cd /etc/mail
% make
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Step 6&lt;/h3&gt;

&lt;p&gt;Reload the sendmail configuration.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/etc/init.d/sendmail reload
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now if you check your /var/log/mail.log you should see any queued messages being sent properly. You should see &lt;em&gt;relay=smtp.gmail.com&lt;/em&gt; and &lt;em&gt;stat=Sent&lt;/em&gt;. If not, make sure you didn’t miss a step above.&lt;/p&gt;</description><link>http://blog.powdahound.com/post/130820931</link><guid>http://blog.powdahound.com/post/130820931</guid><pubDate>Fri, 26 Jun 2009 14:02:34 -0700</pubDate></item><item><title>Keeping a website's footer at the bottom of the page</title><description>&lt;p&gt;I was trying to do this and found these two links very helpful:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page" target="_blank"&gt;Get down! How to keep footers at the bottom of the page&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.themaninblue.com/writing/perspective/2005/08/29/" target="_blank"&gt;footerStickAlt: A more robust method of positioning a footer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><link>http://blog.powdahound.com/post/129620956</link><guid>http://blog.powdahound.com/post/129620956</guid><pubDate>Wed, 24 Jun 2009 16:07:50 -0700</pubDate></item><item><title>RRD Tools</title><description>&lt;a href="http://rrdtools.appspot.com/"&gt;RRD Tools&lt;/a&gt;: &lt;p&gt;I made this small tool to help calculate values needed when creating RRAs for RRD files and put it on &lt;a href="http://code.google.com/appengine/" target="_blank"&gt;Google App Engine&lt;/a&gt;. Will probably add more utilities later as I find myself wanting them.&lt;/p&gt;</description><link>http://blog.powdahound.com/post/128857592</link><guid>http://blog.powdahound.com/post/128857592</guid><pubDate>Tue, 23 Jun 2009 11:17:09 -0700</pubDate></item></channel></rss>
