<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="/css/rss-browser.css" ?>
<rss version="2.0">
	<channel>
		<title>Perturg.org - Scott's Geek Stuff</title>
		<link>http://www.perturb.org/</link>
		<description>Just Geek Stuff</description>

		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/887/</guid>
			<title>Perlfunc: extract_ip()</title>
			<link>http://www.perturb.org/display/entry/887/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		Pull an IP address from a string of text.&lt;br /&gt;
		&lt;br /&gt;
		&lt;h4 class=&quot;code_header&quot;&gt;Code:&lt;/h4&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class=&quot;code&quot;&gt;sub extract_ip {
		        my $txt = shift();
		
		        # 4 octets surrounded by some word boundary
		        if ($txt =~ /\b((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}))\b/) {
		                if ($2 &amp;gt; 255 || $3 &amp;gt; 255 || $4 &amp;gt; 255 || $5 &amp;gt; 255) { return ''; }
		
		                return $1;
		        }
		
		        return '';
		}&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
		</description>
			<pubDate>Thu, 09 Oct 2008 09:38:28 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/886/</guid>
			<title>Election 2008 Poll is online</title>
			<link>http://www.perturb.org/display/entry/886/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		&lt;table style=&quot;height: 202px; width: 500px; padding: 4px; border: 1px solid black; background: url(http://www.perturb.org/election/flag_background.jpg); color: black;&quot;&gt;&lt;tr&gt;&lt;td&gt;&lt;img src=&quot;http://www.perturb.org/election/obama.jpg&quot; alt=&quot;Obama&quot; style=&quot;border: 1px solid black; margin-right: 5px;&quot; /&gt;&lt;/td&gt;&lt;td&gt;&lt;div style=&quot;color: black; font-size: 10pt; font-family: sans-serif; line-height: 125%;&quot;&gt;You preferred Obama's statements &lt;b&gt;67%&lt;/b&gt; of the time&lt;br /&gt;You preferred McCain's statements &lt;b&gt;33%&lt;/b&gt; of the time&lt;br /&gt;&lt;br /&gt;Voting purely on the issues you should vote &lt;b&gt;Obama&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Who would &lt;b&gt;you&lt;/b&gt; vote for if you voted on the issues?&lt;br /&gt;&lt;br /&gt;Find out &lt;a href=&quot;http://www.perturb.org/election/&quot; style=&quot;color: #001491;&quot;&gt;&lt;b&gt;now&lt;/b&gt;&lt;/a&gt;!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
		</description>
			<pubDate>Wed, 08 Oct 2008 15:55:48 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/885/</guid>
			<title>Perlfun: in_array()</title>
			<link>http://www.perturb.org/display/entry/885/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		&lt;h4 class=&quot;code_header&quot;&gt;Code:&lt;/h4&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class=&quot;code&quot;&gt;sub in_array {
		        my $item = shift();
		        my @list = @_;
		
		        foreach my $l(@list) {
		                #print &amp;quot;$l =&amp;gt; $item\n&amp;quot;;
		                if ($l == $item) { return $item; }
		        }
		
		        return 0;
		}&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
		</description>
			<pubDate>Wed, 27 Aug 2008 15:50:00 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/884/</guid>
			<title>Slashdot on brute force password cracking</title>
			<link>http://www.perturb.org/display/entry/884/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		&lt;i&gt;Do you have even a basic understanding of maths? There are 2^2048 possible 2048-bit keys. If you split it between 2 computers, each has to do 2^2047. If you split it between 256 (2^8) then each has to do 2^2040. Split it between 1024 (2^10)? Each is still doing 2^2038. Maybe you've got over four billion computers. In that case, you only need to do around 2^2006 on each one.&lt;br /&gt;
		&lt;br /&gt;
		In case you still have no concept of how big this number is, there are estimated to be around 10^80 atoms in the universe, which is around 2^266. That means that each of your four billion computers is having try 2^1740 keys for every atom in the universe.&lt;br /&gt;
		&lt;br /&gt;
		To put it another way: Let's assume each of your four billion computers is a few orders of magnitude faster than anything I know of and can try four billion keys a second, giving you a total of around 2^64 keys tried per second. This means you can do around 2^76 per day. At this rate (and don't forget that we are assuming that you have almost as many computers that are orders of magnitude faster than anything real as there are people in the world) it will take you 2^1972 days to do an exhaustive search (although on average it will only take you 2^1971 days to find the key). For those following at home, that's around 2^1962 years. For reference, the universe is approximately 13.7 billion years old, which is a shade under 2^34 years.&lt;br /&gt;
		&lt;br /&gt;
		In summary, if every atom in the universe was a computer that ran orders of magnitude faster than anything we can build today, and it ran for the life of the universe to date, you would not be able to crack a single 2048-bit message. If, however, you have a quantum computer, then you might be able to.&lt;/i&gt; - &lt;a href=&quot;http://yro.slashdot.org/comments.pl?sid=390178&amp;amp;cid=21713264&quot;&gt;TheRaven64&lt;/a&gt;
		</description>
			<pubDate>Tue, 19 Aug 2008 17:52:00 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/883/</guid>
			<title>Perl: redirecting STDERR to STDOUT</title>
			<link>http://www.perturb.org/display/entry/883/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		I had occasion that I needed to redirect all STDERR output (die statements) to STDOUT. A webapp I wrote only looks at STDOUT, so this code causes STDERR to merge with STDOUT.&lt;br /&gt;
		&lt;br /&gt;
		&lt;h4 class=&quot;code_header&quot;&gt;Code:&lt;/h4&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class=&quot;code&quot;&gt;open(STDERR, &amp;quot;&amp;gt;&amp;amp;STDOUT&amp;quot;);&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
		&lt;br /&gt;
		Alternately you can also do it by reassigning the raw file handles:&lt;br /&gt;
		&lt;br /&gt;
		&lt;h4 class=&quot;code_header&quot;&gt;Code:&lt;/h4&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class=&quot;code&quot;&gt;*STDERR = *STDOUT;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
		&lt;br /&gt;
		You can get fancy and redirect all output to a log file:&lt;br /&gt;
		&lt;br /&gt;
		&lt;h4 class=&quot;code_header&quot;&gt;Code:&lt;/h4&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class=&quot;code&quot;&gt;open(LOG,&amp;quot;&amp;gt;/tmp/foo.log&amp;quot;);
		
		*STDERR = *LOG;
		*STDOUT = *LOG;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
		</description>
			<pubDate>Mon, 14 Jul 2008 19:17:00 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/882/</guid>
			<title>Detailed look at fonts</title>
			<link>http://www.perturb.org/display/entry/882/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		I had no idea font display was so detailed, and complicated. Maxim Shemanarev wrote an extremely &lt;a href=&quot;http://www.antigrain.com/research/font_rasterization/&quot;&gt;detailed analysis&lt;/a&gt; of how modern computers display fonts on a screen. I found the section on moving fonts 1/10th of a pixel horizontally fascinating. Interesting read if you like fonts and typography.
		</description>
			<pubDate>Fri, 04 Jul 2008 08:32:00 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/881/</guid>
			<title>Perl output buffering on files</title>
			<link>http://www.perturb.org/display/entry/881/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		To turn off output buffering in Perl you just do:&lt;br /&gt;
		&lt;br /&gt;
		&lt;h4 class=&quot;code_header&quot;&gt;Code:&lt;/h4&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class=&quot;code&quot;&gt;$| = 1;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
		&lt;br /&gt;
		To do it on an &lt;a href=&quot;http://perldoc.perl.org/perlfaq5.html#How-do-I-flush%2funbuffer-an-output-filehandle%3f--Why-must-I-do-this%3f&quot;&gt;open filehandle&lt;/a&gt; (so the file gets written right away) you have to do:&lt;br /&gt;
		&lt;br /&gt;
		&lt;h4 class=&quot;code_header&quot;&gt;Code:&lt;/h4&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class=&quot;code&quot;&gt;open(LOG,&amp;quot;&amp;gt;&amp;gt;$log&amp;quot;);
		LOG-&amp;gt;autoflush(1);&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
		</description>
			<pubDate>Tue, 01 Jul 2008 14:36:00 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/512/</guid>
			<title>Piers Anthony - Xanth</title>
			<link>http://www.perturb.org/display/entry/512/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		Here is a &lt;a href=&quot;http://www.hipiers.com/bibliography.html&quot;&gt;borrowed&lt;/a&gt; list of Xanth books.&lt;br /&gt;
		&lt;br /&gt;
		&lt;ol&gt;&lt;br /&gt;
			&lt;li&gt;A Spell for Chameleon&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;The Source of Magic&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Castle Roogna&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Centaur Aisle&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Ogre, Ogre&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Night Mare&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Dragon on a Pedastal&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Crewel Lye&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Golem in the Gears&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Valey of the Vole&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Heaven Cent&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Man from Mundania&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Isle of View&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Quesiton Quest&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Color of her Panties&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Demons Don't Dream&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Harpy Time&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Geis of the Gargoyle&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Roc and Hard Place&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Yon Ill Wind&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Faun and Games&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Zombie Lover&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Xone of Contention&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Smell Foop&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Up in a Heaval&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Cube Route Tor&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Currant Events&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Pet Peeve&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Stork Naked&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Air Apparent&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Two to the Fifth&lt;/li&gt;&lt;br /&gt;
			&lt;li&gt;Jumper Cable&lt;/li&gt;&lt;br /&gt;
		&lt;/ol&gt;
		</description>
			<pubDate>Mon, 30 Jun 2008 13:57:00 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/880/</guid>
			<title>Perlfunc: get_file_perm()</title>
			<link>http://www.perturb.org/display/entry/880/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		Quick function to get the permissions of a file with Perl.&lt;br /&gt;
		&lt;br /&gt;
		&lt;h4 class=&quot;code_header&quot;&gt;Code:&lt;/h4&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class=&quot;code&quot;&gt;sub get_file_perm {
			my $file = shift();
		
			# Permissions are the second element of stat
			my $mode = (stat($file))[2];
			my $perm = sprintf(&amp;quot;%04o&amp;quot;,$mode &amp;amp; 07777);
		
			return $perm;
		}&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
		</description>
			<pubDate>Thu, 26 Jun 2008 11:53:00 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/879/</guid>
			<title>Bash reading a file line by line</title>
			<link>http://www.perturb.org/display/entry/879/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		Here are the directions borrowed from the &lt;a href=&quot;http://wooledge.org:8000/BashFAQ/001&quot;&gt;BashFAQ&lt;/a&gt;.&lt;br /&gt;
		&lt;br /&gt;
		&lt;h4 class=&quot;code_header&quot;&gt;Code:&lt;/h4&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class=&quot;code&quot;&gt;cat /tmp/foo.txt | while read line; do echo $line; done;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
		</description>
			<pubDate>Tue, 20 May 2008 13:56:00 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/878/</guid>
			<title>Linux date manipulation</title>
			<link>http://www.perturb.org/display/entry/878/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		The date command in Linux is very powerful for converting dates and times. If you have a given time in another timezone, or even UTC, you can convert it to your local timezone with this command:&lt;br /&gt;
		&lt;br /&gt;
		&lt;h4 class=&quot;code_header&quot;&gt;Code:&lt;/h4&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class=&quot;code&quot;&gt;date -d '2008-05-13 14:00 UTC'&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
		&lt;br /&gt;
		If you want to convert a given time into unixtime just use a date format:&lt;br /&gt;
		&lt;br /&gt;
		&lt;h4 class=&quot;code_header&quot;&gt;Code:&lt;/h4&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class=&quot;code&quot;&gt;date +%s -d '2008-05-13 14:00 UTC'&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
		</description>
			<pubDate>Mon, 12 May 2008 09:54:00 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/877/</guid>
			<title>Free SSL Cert</title>
			<link>http://www.perturb.org/display/entry/877/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		I just got a free SSL certificate for this site from &lt;a href=&quot;http://www.startcom.org/&quot;&gt;StartCom&lt;/a&gt;. They have limited &lt;a href=&quot;http://cert.startcom.org/?app=140&quot;&gt;browser support&lt;/a&gt;, but Firefox is in the list. Not perfect, but not bad for free.
		</description>
			<pubDate>Fri, 09 May 2008 14:23:00 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/876/</guid>
			<title>Wii/Friend Codes</title>
			<link>http://www.perturb.org/display/entry/876/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		Wii code: &lt;b&gt;2166-1639-8425-8450&lt;/b&gt;&lt;br /&gt;
		Mario Kart Friend code: &lt;b&gt;2191-8139-1611&lt;/b&gt;
		</description>
			<pubDate>Fri, 09 May 2008 09:11:00 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/875/</guid>
			<title>ImageMagick borders and shadows</title>
			<link>http://www.perturb.org/display/entry/875/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		I borrowed &lt;a href=&quot;http://lisas.de/blog/adrian/2008-04-21-spring&quot;&gt;this&lt;/a&gt; simple ImageMagick hack to make images have a small border and drop shadow.&lt;br /&gt;
		&lt;br /&gt;
		Original:&lt;br /&gt;
		&lt;img src=&quot;/images/1/legos.jpg&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
		&lt;br /&gt;
		&lt;h4 class=&quot;code_header&quot;&gt;Code:&lt;/h4&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class=&quot;code&quot;&gt;convert foo.jpg -resize 200 -bordercolor white -border 1 -bordercolor black -border 1 -background black bar.jpg&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
		&lt;img src=&quot;/images/1/legos-border.jpg&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
		&lt;br /&gt;
		&lt;h4 class=&quot;code_header&quot;&gt;Code:&lt;/h4&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class=&quot;code&quot;&gt;convert foo.jpg -resize 200 -bordercolor white -border 1 -bordercolor black -border 1 \
		-background black \( +clone -shadow 80x1+1+1 \) +swap -background white -flatten bar.jpg&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
		&lt;img src=&quot;/images/1/legos-border-shadow.jpg&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
		&lt;br /&gt;
		The drop shadow example needs a white background to look decent.
		</description>
			<pubDate>Mon, 21 Apr 2008 09:52:00 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/874/</guid>
			<title>Save The Developers</title>
			<link>http://www.perturb.org/display/entry/874/</link>
			<description>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/css/rss-feed.css&quot; title=&quot;Default&quot; /&gt;
		My good buddy &lt;a href=&quot;http://intuitiveye.com/&quot;&gt;Dave&lt;/a&gt; just pointed out a cool site: &lt;a href=&quot;http://www.savethedevelopers.org/&quot;&gt;SaveTheDevelopers.com&lt;/a&gt;. They have a cool little javascript script that detects if you're running IE6 (an old browser) and prompts you to upgrade to a newer and more current browser. The code is now live on most perturb.org pages.
		</description>
			<pubDate>Fri, 28 Mar 2008 12:16:00 -0700</pubDate>
		</item>
		
	</channel>
</rss>
