<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="/css/rss-browser.css" ?>
<rss version="2.0">
	<channel>
		<title>Perturb.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/1086/</guid>
			<title>IPTables rule generator</title>
			<link>http://www.perturb.org/display/entry/1086/</link>
			<description>&lt;p&gt;I just wrote a quick tool to generate &lt;a href=&quot;http://www.perturb.org/content/iptables-rules.html&quot;&gt;iptables rules&lt;/a&gt; so I won't have to read the man page every time.&lt;/p&gt;
		</description>
			<pubDate>Mon, 16 Jan 2012 10:43:30 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1085/</guid>
			<title>How floating point numbers are stored</title>
			<link>http://www.perturb.org/display/entry/1085/</link>
			<description>&lt;p&gt;A float in C++ is either 4 or 8 bits. A 4 bit float can hold a number up to 38 digits! I wasn't sure how a computer stores a number that large in such a small amount of ram so I did some research. I found that it's stored using a method called &lt;a href=&quot;http://en.wikipedia.org/wiki/IEEE_754-1985&quot;&gt;IEEE 754-1985&lt;/a&gt; which Wikipedia has a very explanatory article on.&lt;/p&gt;
		</description>
			<pubDate>Wed, 11 Jan 2012 11:05:00 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1084/</guid>
			<title>Iterate over arguments in bash</title>
			<link>http://www.perturb.org/display/entry/1084/</link>
			<description>&lt;p&gt;Here is how you iterate over the list of command line arguments (ARGV) in bash&lt;/p&gt;
		
		&lt;pre&gt;&lt;code&gt;for var in &quot;$@&quot;
		do
		    echo &quot;$var&quot;
		done
		&lt;/code&gt;&lt;/pre&gt;
		</description>
			<pubDate>Sat, 07 Jan 2012 10:36:20 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1083/</guid>
			<title>Books of 2012</title>
			<link>http://www.perturb.org/display/entry/1083/</link>
			<description>Also see the list of &lt;a href=&quot;http://www.perturb.org/display/1027_Books_of_2011.html&quot;&gt;2011&lt;/a&gt;. The date indicated denotes the date I started reading the book.&lt;br /&gt;
		&lt;br /&gt;
		2012-01-03 - &lt;a href=&quot;http://books.google.com/books?q=isbn:0836218833&quot;&gt;Attack of the Deranged Mutant Killer Monster Snow Goons&lt;/a&gt; - 127 pages&lt;br /&gt;
		2012-01-04 - &lt;a href=&quot;http://books.google.com/books?q=isbn:0740721356&quot;&gt;Calvin and Hobbes&lt;/a&gt; - 95 pages&lt;br /&gt;
		2012-01-06 - &lt;a href=&quot;http://books.google.com/books?q=isbn:1401201253&quot;&gt;Batman: Terror&lt;/a&gt; - 128 pages&lt;br /&gt;
		2011-01-09 - &lt;a href=&quot;http://books.google.com/books?q=isbn:9781416586654&quot;&gt;Just After Sunset&lt;/a&gt; - 539 pages&lt;br /&gt;
		2011-01-19 - &lt;a href=&quot;http://books.google.com/books?q=isbn:0060575913&quot;&gt;Coraline&lt;/a&gt; - 194 pages&lt;br /&gt;
		2012-01-23 - &lt;a href=&quot;http://books.google.com/books?q=isbn:9780374103705&quot;&gt;Alphabetter juice&lt;/a&gt; - 283 pages&lt;br /&gt;
		2012-01-30 - &lt;a href=&quot;http://books.google.com/books?q=isbn:9780307595089&quot;&gt;The Last Werewolf&lt;/a&gt; - 293 pages&lt;br /&gt;
		
		</description>
			<pubDate>Wed, 04 Jan 2012 23:04:00 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1082/</guid>
			<title>Control Linux sound volume via the command line</title>
			<link>http://www.perturb.org/display/entry/1082/</link>
			<description>&lt;p&gt;I want to set the volume at the command line to 40% before I run a game. I found that amixer does a pretty good job of this:&lt;/p&gt;
		
		&lt;pre&gt;&lt;code&gt;amixer --card 0 sset 'Master' 26
		&lt;/code&gt;&lt;/pre&gt;
		
		&lt;p&gt;The volume number is on a scale of 0 to 64 (which seems weird).&lt;/p&gt;
		</description>
			<pubDate>Tue, 03 Jan 2012 18:52:40 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1081/</guid>
			<title>sshfs input/output error</title>
			<link>http://www.perturb.org/display/entry/1081/</link>
			<description>&lt;p&gt;If you're getting an error like this from &lt;a href=&quot;http://permalink.gmane.org/gmane.comp.file-systems.fuse.sshfs/1189&quot;&gt;sshfs 2.3&lt;/a&gt;:&lt;/p&gt;
		
		&lt;pre&gt;&lt;code&gt;ls: cannot access sshfs_dir: Input/output error
		&lt;/code&gt;&lt;/pre&gt;
		
		&lt;p&gt;It's most likely because you forgot to mount the remote directory with a trailing slash. After I added the trailing slash my sshfs mount work again.&lt;/p&gt;
		</description>
			<pubDate>Thu, 29 Dec 2011 13:40:11 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1080/</guid>
			<title>MySQL date addition</title>
			<link>http://www.perturb.org/display/entry/1080/</link>
			<description>&lt;p&gt;Here is an example of doing date addition/subtraction in a MySQL query.&lt;/p&gt;
		
		&lt;pre&gt;&lt;code&gt;SELECT * FROM Table WHERE DateField &amp;gt; (now() - INTERVAL 1 year)
		&lt;/code&gt;&lt;/pre&gt;
		</description>
			<pubDate>Fri, 23 Dec 2011 10:06:34 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1079/</guid>
			<title>PHP Function: linkify</title>
			<link>http://www.perturb.org/display/entry/1079/</link>
			<description>&lt;p&gt;I needed a function to take a chunk of text and turn all the URLs inside of it to hyperlinks. Here is the &lt;a href=&quot;http://stackoverflow.com/questions/507436/how-do-i-linkify-urls-in-a-string-with-php&quot;&gt;solution&lt;/a&gt; I came up with:&lt;/p&gt;
		
		&lt;pre&gt;&lt;code&gt;function linkify($str) {
		    $new_str = preg_replace(&quot;@[http|https|ftp]+://[^&amp;lt;&amp;gt;[:space:]]+[[:alnum:]/]@&quot;,&quot;&amp;lt;a href=\&quot;\\0\&quot;&amp;gt;\\0&amp;lt;/a&amp;gt;&quot;, $str);
		    return $new_str;
		}
		&lt;/code&gt;&lt;/pre&gt;
		</description>
			<pubDate>Fri, 16 Dec 2011 10:58:00 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1078/</guid>
			<title>Start time of a Linux process</title>
			<link>http://www.perturb.org/display/entry/1078/</link>
			<description>&lt;p&gt;I needed to find the start time of a Linux process. Luckily the kernel tracks all that for you in /proc. Look at the ctime of the directory for the pid you want,&lt;/p&gt;
		
		&lt;pre&gt;&lt;code&gt;stat -c %Z /proc/15237
		&lt;/code&gt;&lt;/pre&gt;
		
		&lt;p&gt;You can also use ps to get the same information, but then you have to parse/scrape the ps output.&lt;/p&gt;
		
		&lt;pre&gt;&lt;code&gt;ps -p 12345 -o &quot;%t&quot;
		&lt;/code&gt;&lt;/pre&gt;
		</description>
			<pubDate>Tue, 13 Dec 2011 14:42:02 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1077/</guid>
			<title>Close approximation of Pi</title>
			<link>http://www.perturb.org/display/entry/1077/</link>
			<description>&lt;p&gt;&lt;strong&gt;3+(16/113)&lt;/strong&gt; is a close approximation of Pi. It can also be written as &lt;strong&gt;355/113&lt;/strong&gt;.&lt;/p&gt;
		</description>
			<pubDate>Tue, 06 Dec 2011 20:54:00 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1076/</guid>
			<title>StartSSL Free SSL Certificates</title>
			<link>http://www.perturb.org/display/entry/1076/</link>
			<description>&lt;p&gt;I can't speak highly enough of &lt;a href=&quot;http://www.startssl.com/&quot;&gt;StartSSL&lt;/a&gt;. They give away &lt;strong&gt;free&lt;/strong&gt; personal SSL certificates. This site is available via SSL thanks to them. Their website is fantastic, everything is automated and works well. For personal SSL stuff there is no reason to look anywhere else.&lt;/p&gt;
		</description>
			<pubDate>Thu, 17 Nov 2011 15:55:00 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1075/</guid>
			<title>MySQL: Rpms needed for mysqlcc</title>
			<link>http://www.perturb.org/display/entry/1075/</link>
			<description>&lt;p&gt;I still run mysqlcc as a fast and simple MySQL client. It's kind of a pain to get working on modern Linux. These are the RPMs needed to run mysqlcc on Fedora 16 box.&lt;/p&gt;
		
		&lt;pre&gt;&lt;code&gt;yum install glibc.i686 mesa-libGL.i686 libXmu.i686 libXrender.i686 libXrandr.i686 libXcursor.i686 libXft.i686
		&lt;/code&gt;&lt;/pre&gt;
		</description>
			<pubDate>Thu, 17 Nov 2011 11:41:00 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1074/</guid>
			<title>Reading Watchmen again</title>
			<link>http://www.perturb.org/display/entry/1074/</link>
			<description>&lt;p&gt;I'm re-reading &lt;a href=&quot;http://en.wikipedia.org/wiki/Watchmen&quot;&gt;Watchmen&lt;/a&gt; again and listening to the &lt;em&gt;footnotes&lt;/em&gt; &lt;a href=&quot;http://www.comicgeekspeak.com/episodes.php?podcast=FOOTNOTES&quot;&gt;ComicGeekSpeek&lt;/a&gt; podcast of each issue. I forgot how amazing this story is, and the additional backstory supplied by the ComicGeekSpeak podcast really serves to flush out the story all the more.&lt;/p&gt;
		</description>
			<pubDate>Thu, 10 Nov 2011 11:46:00 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1073/</guid>
			<title>MySQL: Include arbitrary count in SELECT</title>
			<link>http://www.perturb.org/display/entry/1073/</link>
			<description>&lt;p&gt;Recently I had some data that I needed to add an arbitrary &lt;em&gt;count&lt;/em&gt; column to. MySQL lets you use &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/user-variables.html&quot;&gt;user defined variables&lt;/a&gt; in your queries to augment your output. Here is an example that I ended up using to add a sequence number to a CSV I was generating.&lt;/p&gt;
		
		&lt;pre&gt;&lt;code&gt;set @num := 10;
		SELECT First, Last, @num := @num+1 AS SequencNumber FROM CustInfo c;
		&lt;/code&gt;&lt;/pre&gt;
		</description>
			<pubDate>Fri, 28 Oct 2011 11:26:00 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1072/</guid>
			<title>Javascript array/object shortcuts</title>
			<link>http://www.perturb.org/display/entry/1072/</link>
			<description>&lt;p&gt;I always forget the syntax to make a new object or array in Javascript.&lt;/p&gt;
		
		&lt;pre&gt;&lt;code&gt;var my_array = new Array();
		my_array.push(1);
		my_array.push(2);
		my_array.push(3);
		&lt;/code&gt;&lt;/pre&gt;
		
		&lt;p&gt;Or you can simplify the whole process:&lt;/p&gt;
		
		&lt;pre&gt;&lt;code&gt;var my_array = [1,2,3];
		&lt;/code&gt;&lt;/pre&gt;
		
		&lt;p&gt;This is the syntax to make a new Object (hash) in Javascript:&lt;/p&gt;
		
		&lt;pre&gt;&lt;code&gt;var my_obj = new Object();
		my_obj['foo'] = 'bar';
		my_obj['apple'] = 'red';
		&lt;/code&gt;&lt;/pre&gt;
		
		&lt;p&gt;But can be shortened this way:&lt;/p&gt;
		
		&lt;pre&gt;&lt;code&gt;var my_obj = { 'foo':'bar' , 'apple':'red' }
		&lt;/code&gt;&lt;/pre&gt;
		
		&lt;p&gt;Just remember that arrays are initialized with [] and objects are initialized with {}. This is the same syntax as Perl's array and hash references.&lt;/p&gt;
		</description>
			<pubDate>Mon, 17 Oct 2011 08:55:00 -0700</pubDate>
		</item>
		
	</channel>
</rss>

