<?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>Michael Hartog &#187; linux</title>
	<atom:link href="http://www.michaelhartog.com/blog/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.michaelhartog.com/blog</link>
	<description>Detailing random internet junk since 2008</description>
	<lastBuildDate>Sun, 30 May 2010 20:25:43 +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>Redoing my Computers</title>
		<link>http://www.michaelhartog.com/blog/2009/04/redoing-my-computers/</link>
		<comments>http://www.michaelhartog.com/blog/2009/04/redoing-my-computers/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 18:40:01 +0000</pubDate>
		<dc:creator>Michael Hartog</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[lappy]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[nerd]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.apocryblog.com/?p=152</guid>
		<description><![CDATA[So, a few weeks ago I decided it was time to change my software setup. At the time I had the Windows 7 beta running on my desktop and laptop and FreeBSD running on my server. I switched it up by putting OS X back on my laptop (yay hackintosh!) and this time with sound [...]]]></description>
			<content:encoded><![CDATA[<p>So, a few weeks ago I decided it was time to change my software setup. At the time I had the Windows 7 beta running on my desktop and laptop and FreeBSD running on my server. I switched it up by putting OS X back on my laptop (yay hackintosh!) and this time with sound working.</p>
<p>I also brought my server into my room and have started using it for TV and such. I realized that it was being used almost exclusively for storage and since it had a lot more power than that I wanted to use it for something else. That combined with my problem with a few games not liking dual-monitors made me recommission it as a Debian box which is sitting in my room now. Whenever I&#8217;m playing games or other things on my desktop I use that box for TV. Apart from that it still serves the exact same purpose as before, but it&#8217;s also easier to maintain with Debian.<br />
<span id="more-152"></span></p>
<p>But because I only had one cable coming into my room my desktop had get connectivity through my server. This was a real pain in the ass because it meant that nothing on the rest of the network (wireless, which means my laptop) could connect to my desktop anymore and I had to move everything through the server if I needed it. I also needed to have the server on if I wanted a connection on my desktop. This really wasn&#8217;t working for me so I dropped some cash earlier this week for a nice gigabit 8 port switch, couple of cat6 and I hooked everything up faster than before.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelhartog.com/blog/2009/04/redoing-my-computers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shell script to extract isos from a folder</title>
		<link>http://www.michaelhartog.com/blog/2008/05/shell-script-to-extract-isos-from-a-folder/</link>
		<comments>http://www.michaelhartog.com/blog/2008/05/shell-script-to-extract-isos-from-a-folder/#comments</comments>
		<pubDate>Wed, 28 May 2008 02:34:48 +0000</pubDate>
		<dc:creator>Michael Hartog</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[iso]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.apocryblog.com/?p=59</guid>
		<description><![CDATA[I had to do this repeatedly manually at work so it took me like 2 minutes to make my first script to do it for me. It was horribly messy and looked something this: for x in $(ls -1 .); do mount -t iso9660 -o loop $x temp/; cp -r temp/* .; umount temp/; done; [...]]]></description>
			<content:encoded><![CDATA[<p>I had to do this repeatedly manually at work so it took me like 2 minutes to make my first script to do it for me. It was horribly messy and looked something this:</p>
<blockquote><p>for x in $(ls -1 .); do<br />
mount -t iso9660 -o loop $x temp/;<br />
cp -r temp/* .;<br />
umount temp/;<br />
done;</p></blockquote>
<p>Which did the job but was horribly messing on doing it more than once with tons of errors and stuff.</p>
<p>When I came home I decided to make it much better. I even included how long it takes to do the whole process, which was harder than the process itself.<br />
<span id="more-59"></span></p>
<p>So right now it looks like:</p>
<blockquote><p>before=$(date +%s);<br />
mkdir temp/;#tempdir<br />
for x in $(ls -1 ./*.iso); do<br />
echo Currently unpacking $x | sed -e &#8216;s/.\///; s/.iso//&#8217;; #remove extra output<br />
mount -t iso9660 -o loop $x temp/; #mounts iso<br />
cp -ru temp/* .;<br />
umount temp/;<br />
done;<br />
rmdir temp/; #cleanup<br />
after=$(date +%s);<br />
elapsed=$(expr $after &#8211; $before); #time calculations<br />
((hour=$elapsed/60/60));<br />
((min=$elapsed/60-hour*60));<br />
((sec=$elapsed-hour*60*60-$min*60));<br />
echo &#8220;Elapsed time: &#8220;`printf &#8220;%02d&#8221; $hour`&#8221;:&#8221;`printf &#8220;%02d&#8221; $min`&#8221;:&#8221;`printf &#8220;%02d&#8221; $sec`;</p></blockquote>
<p>Which does everything I want it too, even the pain in the ass zero-padding of the times. Remember to chmod +x &lt;filename&gt; if you want to use it <img src='http://www.michaelhartog.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>Edit: Well, I messed up a few things, I only tested in under one minute times and the shell on that server only contains sh and ash. Here is the revised edition:</p>
<blockquote><p>#! /bin/sh<br />
before=$(date +%s);<br />
mkdir temp/;#tempdir<br />
for x in $(ls -1 ./*.iso); do<br />
echo Currently unpacking $x | sed -e &#8216;s/.\///; s/.iso//&#8217;; #remove extra output<br />
mount -t iso9660 -o loop $x temp/; #mounts iso<br />
cp -ru temp/* .;<br />
umount temp/;<br />
done;<br />
rmdir temp/; #cleanup<br />
after=$(date +%s);<br />
elapsed=$(expr $after &#8211; $before); #time calculations<br />
hour=&#8221;$(expr &#8220;$elapsed&#8221; &#8216;/&#8217; &#8217;60&#8242; &#8216;/&#8217; &#8217;60&#8242;)&#8221;<br />
min=&#8221;$(expr &#8220;$elapsed&#8221; &#8216;/&#8217; &#8217;60&#8242; &#8216;-&#8217; &#8216;$hour&#8217; &#8216;*&#8217; &#8217;60&#8242;)&#8221;<br />
sec=&#8221;$(expr &#8220;$elapsed&#8221; &#8216;-&#8217; &#8216;$hour&#8217; &#8216;*&#8217; &#8217;60&#8242; &#8216;*&#8217; &#8217;60&#8242; &#8216;-&#8217; &#8216;$min&#8217; &#8216;*&#8217; &#8217;60&#8242;)&#8221;<br />
echo &#8220;Elapsed time: &#8220;`printf &#8220;%02d&#8221; $hour`&#8221;:&#8221;`printf &#8220;%02d&#8221; $min`&#8221;:&#8221;`printf &#8220;%02d&#8221; $sec`;</p></blockquote>
<p>And now I know that sh is *really* annoying to do math in.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelhartog.com/blog/2008/05/shell-script-to-extract-isos-from-a-folder/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
