<?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>Geekality &#187; Tools</title>
	<atom:link href="http://www.geekality.net/tag/tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geekality.net</link>
	<description>With a hint of Social Ineptitude</description>
	<lastBuildDate>Thu, 26 Aug 2010 17:44:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>PHP: Generating transparent PNG fillers</title>
		<link>http://www.geekality.net/2010/06/13/php-generating-transparent-png-fillers/</link>
		<comments>http://www.geekality.net/2010/06/13/php-generating-transparent-png-fillers/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 13:45:38 +0000</pubDate>
		<dc:creator>Torleif</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[GD]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Snippet]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.geekality.net/?p=1003</guid>
		<description><![CDATA[So, I was fooling around the other day with an HTML table and wanted to make the odd rows slightly darker. Figured I could use for example an 80% transparent black PNG to do that (or could have just assigned &#8230; <a href="http://www.geekality.net/2010/06/13/php-generating-transparent-png-fillers/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So, I was fooling around the other day with an HTML table and wanted to make the odd rows slightly darker. Figured I could use for example an 80% transparent black PNG to do that (or could have just assigned a darker color, but where&#8217;s the fun in that?). Either way, ended up making a little something that I thought I could share just for the fun of it. I learned a few things, so maybe someone else can too <img src='http://www.geekality.net/wp-includes/images/blank.gif' alt=':)' title=':)' class='wp-smiley smiley-1' /> </p>
<p>So, here&#8217;s how to make a small transparent PNG filler image on-the-fly using PHP <img src='http://www.geekality.net/wp-includes/images/blank.gif' alt=':)' title=':)' class='wp-smiley smiley-1' /> </p>
<p><span id="more-1003"></span></p>
<p>I called the script <em>fill.php</em>, and the first line looks like this:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-type: image/png'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>This starts the php script and sets the content-type to image/png which means the web browser will that we are an image and not an html file which usually is the default.</p>
<p>Next up we get the parameters from the user:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$p</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span> <span style="color: #339933;">+</span> <span style="color: #990000;">array</span><br />
<span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'r'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'g'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'b'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'a'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><br />
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Here I create an array with default values and merge it with the <code class="codecolorer php default"><span class="php"><span style="color: #000088;">$_GET</span></span></code> array so that values from the user will override the default values. This means we are sure we have all the values we need and that the user only have to specify the ones he want to.</p>
<p>The r, g and b values should be a number between 0 and 255 and the alpha value should be between 0 and 127. So, next up we need to make sure that that is the case so we don&#8217;t use some other bogus we might have gotten:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #990000;">array_walk</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$p</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$item</span><span style="color: #339933;">,</span> <span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span> <br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$item</span> <span style="color: #339933;">=</span> <span style="color: #990000;">min</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">max</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'a'</span> ? <span style="color: #cc66cc;">127</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>This goes through each parameter and makes sure it is a number between 0 and 255 (or 127 for the alpha).</p>
<p>Since we have what we need now, we can start with creating our image:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$img</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">imagecreatetruecolor</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">15</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Cannot Initialize new GD image stream'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>We also need to set a flag that we want to use full alpha channel information (as opposed to single-color transparency) in this image:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #990000;">imagesavealpha</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>We are now ready to fill our image with the color we are asked for:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$color</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecolorallocatealpha</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #000088;">$p</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'r'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #000088;">$p</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'g'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #000088;">$p</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'b'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #000088;">$p</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #990000;">imagefill</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$color</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>And finally output the result and destroy the image resource we have been working with:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #990000;">imagepng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #990000;">imagedestroy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>And that&#8217;s actually all there is to it!</p>
<p>The complete code looks like this:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-type: image/png'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<br />
<span style="color: #666666; font-style: italic;">// Replace default parameters with user input</span><br />
<span style="color: #000088;">$p</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span> <span style="color: #339933;">+</span> <span style="color: #990000;">array</span><br />
<span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'r'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'g'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'b'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'a'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><br />
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Make sure they are within limits</span><br />
<span style="color: #666666; font-style: italic;">// (colors: 0-255, alpha: 0-127)</span><br />
<span style="color: #990000;">array_walk</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$p</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$val</span><span style="color: #339933;">,</span> <span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span> <br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$val</span> <span style="color: #339933;">=</span> <span style="color: #990000;">min</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">max</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'a'</span> ? <span style="color: #cc66cc;">127</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
<br />
<span style="color: #666666; font-style: italic;">// Create image</span><br />
<span style="color: #000088;">$img</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">imagecreatetruecolor</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">15</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Cannot Initialize new GD image stream'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Use full alpha channel information</span><br />
<span style="color: #990000;">imagesavealpha</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Fill image</span><br />
<span style="color: #000088;">$color</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecolorallocatealpha</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #000088;">$p</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'r'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #000088;">$p</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'g'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #000088;">$p</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'b'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; <span style="color: #000088;">$p</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #990000;">imagefill</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$color</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<br />
<span style="color: #666666; font-style: italic;">// Output result</span><br />
<span style="color: #990000;">imagepng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #990000;">imagedestroy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>If you want to check out a working demo version of this, you can test out my little testing tool I created while having fun with this at <a href="http://tools.geekality.net/filling-factory/">tools.geekality.net/filling-factory</a></p>
<p>Let me know what you think! And as usual, please let me know if you see something that is wrong or could be improved or anything like that  <img src='http://www.geekality.net/wp-includes/images/blank.gif' alt=':)' title=':)' class='wp-smiley smiley-1' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekality.net/2010/06/13/php-generating-transparent-png-fillers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP Latex test page</title>
		<link>http://www.geekality.net/2009/09/24/wp-latex-test-page/</link>
		<comments>http://www.geekality.net/2009/09/24/wp-latex-test-page/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 16:28:41 +0000</pubDate>
		<dc:creator>Torleif</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Latex]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.geekality.net/?p=497</guid>
		<description><![CDATA[So, as my brother noticed in my last post, I have some cool equations here. The brilliance behind it is something called LaTeX, which can be used in WordPress blogs thanks to the WP LaTeX plugin. I am a total &#8230; <a href="http://www.geekality.net/2009/09/24/wp-latex-test-page/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So, as my brother noticed in my last post, I have some cool equations here. The brilliance behind it is something called <a href="http://www.latex-project.org/">LaTeX</a>, which can be used in WordPress blogs thanks to the <a href="http://wordpress.org/extend/plugins/wp-latex/">WP LaTeX</a> plugin.</p>
<p>I am a total LaTeX newbie though, so I often struggle a bit with&#8230; getting it right. Trying it out by previewing WordPress posts is sloooow, so I decided to create myself a simple test-rig. A simple web page with a form and a button.</p>
<p>Let me know if you like it: <a href="http://tools.geekality.net/wp-latex/">tools.geekality.net/wp-latex</a> <img src='http://www.geekality.net/wp-includes/images/blank.gif' alt='8)' title='8)' class='wp-smiley smiley-3' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekality.net/2009/09/24/wp-latex-test-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Helpful Unix and Mac commands</title>
		<link>http://www.geekality.net/2008/12/27/helpful-unix-and-mac-commands/</link>
		<comments>http://www.geekality.net/2008/12/27/helpful-unix-and-mac-commands/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 16:30:35 +0000</pubDate>
		<dc:creator>Torleif</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Command line]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.geekality.net/?p=77</guid>
		<description><![CDATA[I am for the most part a Windows user. I was kind of moving towards Linux, Ubuntu in particular, but that ship pretty much sailed when I got my hands on Windows 7. Awesome, awesome operating system. But, I still &#8230; <a href="http://www.geekality.net/2008/12/27/helpful-unix-and-mac-commands/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am for the most part a Windows user. I was <em>kind</em> of moving towards Linux, Ubuntu in particular, but that ship pretty much sailed when I got my hands on Windows 7. Awesome, awesome operating system. But, I still have to use some Unix and Mac systems once in a while. And then there are certain commands that I often use, but always forget since it usually goes a bit of time between times I do it. So, what follows is basically just a list of commands that I keep forgetting, but keep having to look up again.</p>
<p><span id="more-77"></span></p>
<h2>Remove .DS_Store files</h2>
<p>Removes all those <del datetime="2010-03-09T15:21:10+00:00">stupid</del>annoying DS_Store files that Mac litters around wherever it goes. Works in the current directory and downwards.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-name</span> <span style="color: #000000; font-weight: bold;">*</span>DS_Store <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</div></div>
<h2>Recursivly download a whole website</h2>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-T</span> <span style="color: #000000;">5</span> <span style="color: #660033;">-t</span> <span style="color: #000000;">0</span> <span style="color: #660033;">-m</span> <span style="color: #660033;">-np</span> <span style="color: #660033;">-w</span> <span style="color: #000000;">5</span> <span style="color: #660033;">--random-wait</span> <span style="color: #660033;">-E</span> <span style="color: #660033;">-k</span> <span style="color: #660033;">-p</span> <span style="color: #660033;">-P</span> output<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">dir</span> http:<span style="color: #000000; font-weight: bold;">//</span>website</div></div>
<h2>Show hidden files on in OS X</h2>
<p>Swap TRUE with FALSE to hide them again. The second line kills and relaunches Finder.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">defaults <span style="color: #c20cb9; font-weight: bold;">write</span> com.apple.Finder AppleShowAllFiles TRUE<br />
<span style="color: #c20cb9; font-weight: bold;">killall</span> Finder <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> open <span style="color: #000000; font-weight: bold;">/</span>System<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>CoreServices<span style="color: #000000; font-weight: bold;">/</span>Finder.app</div></div>
<h2>Redirect std error to std out</h2>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-ld</span> <span style="color: #000000; font-weight: bold;">/</span>home <span style="color: #000000; font-weight: bold;">/</span>qwerty <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">&gt;</span>log <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span></div></div>
<h2>Compress and decompress files</h2>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># Compress</span><br />
<span style="color: #c20cb9; font-weight: bold;">tar</span> czvf archive.tar.gz filedir filedir<br />
<span style="color: #c20cb9; font-weight: bold;">tar</span> cjvf archive.tar.bz2 filedir filedir<br />
<br />
<span style="color: #666666; font-style: italic;"># Decompress</span><br />
<span style="color: #c20cb9; font-weight: bold;">tar</span> xzvf archive.tar.gz<br />
<span style="color: #c20cb9; font-weight: bold;">tar</span> xjvf archive.tar.bz2</div></div>
<h2>Find open files</h2>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">lsof <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> filename</div></div>
<h2>SSH filesystem on Mac</h2>
<p>First download and install <a href="http://pqrs.org/macosx/sshfs/">sshfs for Mac OS X</a>. Then to mount</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> ~<span style="color: #000000; font-weight: bold;">/</span>sshfs<span style="color: #000000; font-weight: bold;">/</span>server1<br />
<span style="color: #000000; font-weight: bold;">/</span>Applications<span style="color: #000000; font-weight: bold;">/</span>sshfs<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mount_sshfs server1_hostname: ~<span style="color: #000000; font-weight: bold;">/</span>sshfs<span style="color: #000000; font-weight: bold;">/</span>server1</div></div>
<p>And to unmount (and uninstall the sshfs)</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">umount</span> ~<span style="color: #000000; font-weight: bold;">/</span>sshfs<span style="color: #000000; font-weight: bold;">/</span>server1<br />
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>Applications<span style="color: #000000; font-weight: bold;">/</span>sshfs<span style="color: #000000; font-weight: bold;">/</span>uninstall.sh</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.geekality.net/2008/12/27/helpful-unix-and-mac-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
