<?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>The Computer Guy &#187; Linux</title>
	<atom:link href="http://compguyaug.com/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://compguyaug.com</link>
	<description>Get more out of your computer</description>
	<lastBuildDate>Thu, 03 Mar 2011 06:20:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>XFS PVR/DVR maintenance</title>
		<link>http://compguyaug.com/2010/09/xfs-pvrdvr-maintenance/</link>
		<comments>http://compguyaug.com/2010/09/xfs-pvrdvr-maintenance/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 00:49:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[tv]]></category>

		<guid isPermaLink="false">http://compguyaug.com/?p=572</guid>
		<description><![CDATA[Last year, I purchased an HDTV tuner card and started using my computer as a Personal Video Recorder, or PVR. Basically, a small program records a tv show to the hard drive. This did quite well until March when it would stop recording after 5 seconds to 15 minutes for no apparent reason.
After about a [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Last year, I purchased an HDTV tuner card and started using my computer as a Personal Video Recorder, or PVR. Basically, a small program records a tv show to the hard drive. This did quite well until March when it would stop recording after 5 seconds to 15 minutes for no apparent reason.</p>
<p>After about a month of research, I had ruled out just about everything under the sun. Then, it hit me &#8230; the file system might need defraging. The file system I am using is XFS, and they can get fragmented over time, especially if you have big files (HD-MPEGs) and little free space.</p>
<p>The command to defrag all mounted (and keeps them read-write) XFS filesystems is:</p>
<pre>xfs_fsr -v
</pre>
<p>After running this, shows started recording better, but still stopped. So, I wanted to see just how fragmented everything was. I found this command:</p>
<pre>xfs_db -r /dev/sda3
</pre>
<p>That starts an interactive XFS debug session for sda3, my XFS partition. Three useful commands are freesp, frag and quit. frag reported over 15% fragmentation and freesp reported a lot of small blocks and very few large blocks.</p>
<p>Finally, I got to the heart of the matter: defrag programs do not operate efficiently with less than a certain amount of free space. My drive had 20GB free out of 250GB total. I deleted a few HD shows to bring it up to 45GB free and ran the defrag command again.</p>
<p>Voila! Less than 6% fragmentation and plenty of free big blocks. My recordings are almost flawless now. At least they don&#8217;t stop for no reason. So, if you&#8217;ve got an XFS file system:</p>
<ul>
<li>make sure to run the xfs_fsr command regularly</li>
<li>if you&#8217;re filesystem is still fragmented, burn/remove some junk and repeat</li>
</ul>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://compguyaug.com/2010/09/xfs-pvrdvr-maintenance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GCC 4.5</title>
		<link>http://compguyaug.com/2010/06/gcc-4-5/</link>
		<comments>http://compguyaug.com/2010/06/gcc-4-5/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 16:54:26 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[gcc gentoo eeepc]]></category>

		<guid isPermaLink="false">http://compguyaug.com/?p=569</guid>
		<description><![CDATA[Over the last week, I&#8217;ve been updating my eeePC&#8217;s Gentoo linux to run GCC 4.5 and recompiling every package. The main reason is that now almost all my software is fully optimized for the Intel Atom processor. With only 1 relatively small hack, the rebuild went fairly smooth and my CFLAGS now contain &#8220;-march=atom -mtune=atom&#8221; [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Over the last week, I&#8217;ve been updating my eeePC&#8217;s Gentoo linux to run GCC 4.5 and recompiling every package. The main reason is that now almost all my software is fully optimized for the Intel Atom processor. With only 1 relatively small hack, the rebuild went fairly smooth and my <a title="Safe CFLAGS for Intel Atom" href="http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel#Atom" target="_blank">CFLAGS</a> now contain &#8220;-march=atom -mtune=atom&#8221; !</p>
<p>The one small hack was placing a sed command inside the gcc 4.5 ebuild. It will build the first time without the command, but all subsequent builds will fail with an error that stage 2 and stage 3 are different. Here&#8217;s the line added to the src_unpack part of the ebuild: (Note: wrapping added)</p>
<pre>[[ ${CFLAGS} == *-march=atom* ]] &amp;&amp; sed -i
    -e 's/(INSN_P/(NONDEBUG_INSN_P/g'
    -e 's/!INSN_P/!NONDEBUG_INSN_P/g'
    gcc/config/i386/i386.c
</pre>
<p>To keep it safe, the line check if you $CFLAGS has -march=atom in it. If so, then it runs the following sed command. Originally issued as <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43921" target="_blank">a patch for gcc</a> for all of us running an Atom processor(s), I swapped it around to a sed command, as a few forum posts pointed out.</p>
<p>Beyond making the &#8216;overlay ebuild&#8217;, there was only 1 other snag, and that was binutils. Using the new gcc, binutils just wouldn&#8217;t compile. The error was about the movbe instruction. Upgrading from 2.18 to 2.19 using the old gcc compiler did the trick. After that it was just a matter of waiting for all the packages to recompile.</p>
<p>If anyone is thinking about upgrading to gcc 4.5 on gentoo, it&#8217;s not all that bad. Make sure to read the <a href="http://www.gentoo.org/doc/en/gcc-upgrading.xml" target="_blank">Gentoo GCC Upgrading Guide</a> before you do anything. Also, run a &#8220;cat /proc/cpuinfo&#8221; to get the model of atom processor and make sure your <a title="Safe CFLAGS for Intel Atom" href="http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel#Atom" target="_blank">CFLAGS</a> are set properly.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://compguyaug.com/2010/06/gcc-4-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HDTV using MPlayer</title>
		<link>http://compguyaug.com/2010/01/hdtv-using-mplayer/</link>
		<comments>http://compguyaug.com/2010/01/hdtv-using-mplayer/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 11:00:03 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[mplayer]]></category>
		<category><![CDATA[tv]]></category>

		<guid isPermaLink="false">http://compguyaug.com/?p=510</guid>
		<description><![CDATA[In my desktop computer, I&#8217;ve got an nvidia GeForce 6150 PCI-E video card. It has a built-in mpeg2 decoding helper in it. Using Linux, this is called XvMC, or Xvideo Motion Compensation. I finally got it partially usable.
I&#8217;m currently watching the news on WJBF, the only channel I get b/c I haven&#8217;t fully setup my [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>In my desktop computer, I&#8217;ve got an nvidia GeForce 6150 PCI-E video card. It has a built-in mpeg2 decoding helper in it. Using Linux, this is called XvMC, or Xvideo Motion Compensation. I finally got it partially usable.</p>
<p>I&#8217;m currently watching the news on WJBF, the only channel I get b/c I haven&#8217;t fully setup my antenna. Using xvmc is fairly simple:</p>
<pre>mplayer -vc ffmpegmc12 -vo xvmc -framedrop dvb://WJBF-DT</pre>
<p>I add -framedrop to keep the video and audio sync&#8217;ed.  Mplayer will rant about waiting for retrace. Using OpenGL is actually better, for me at least.</p>
<pre>mplayer -vo gl2 -framedrop dvb://WJBF-DT</pre>
<p>It dropped 14 frames at the beginning, but hasn&#8217;t dropped another in 10 minutes. XvMC would have crapped out by now. A/V sync is still perfect. I&#8217;ve even got it full screen and it&#8217;s resizing from 1280&#215;720 (720 HD resolution) to 1440&#215;900.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://compguyaug.com/2010/01/hdtv-using-mplayer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>X11 Forwarding</title>
		<link>http://compguyaug.com/2010/01/x11-forwarding/</link>
		<comments>http://compguyaug.com/2010/01/x11-forwarding/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 16:04:35 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networks]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[mplayer]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://compguyaug.com/?p=506</guid>
		<description><![CDATA[A few days, I moved my desktop computer out into the living room. The computer has a tuner card that can receive digital broadcasts. I don&#8217;t own a TV, so this is the closest I&#8217;ve got to one. I still have to set up lircd before I can use a remote, but I wanted something [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>A few days, I moved my desktop computer out into the living room. The computer has a tuner card that can receive digital broadcasts. I don&#8217;t own a TV, so this is the closest I&#8217;ve got to one. I still have to set up lircd before I can use a remote, but I wanted something a bit easier</p>
<p>Today, I discovered a new trick &#8230; SSH X11 Forwarding. Now, I can play video on my desktop right from my netbook. It&#8217;s wonderful and very simple!</p>
<p>In the following instructions, the &#8220;<strong>A</strong>&#8221; refers to the computer playing the video and &#8220;<strong>B</strong>&#8221; refers to any other computer.</p>
<ol>
<li>Make sure &#8220;X11Forwarding Yes&#8221; is in your sshd_config file on computer <strong>A</strong>. Restart sshd if you had to uncomment/add it.</li>
<li>On <strong>B</strong>, run `ssh -XC <strong>A</strong>`</li>
<li>In the ssh session, type `DISPLAY=:0.0`.</li>
<li>Now run mplayer or any other video player in the  ssh session and it will play on computer <strong>A</strong>.</li>
</ol>
<p>If you want  to have a program run on computer <strong>A</strong> and use the screen on computer <strong>B</strong>, the process is very similar:</p>
<ol>
<li>Make sure &#8220;X11Forwarding Yes&#8221; is in your sshd_config file on computer <strong>A</strong>. Restart sshd if you had to uncomment/add it.</li>
<li>On <strong>B</strong>, run `xhost <strong>A</strong>`</li>
<li>On <strong>B</strong>, run `ssh -XC <strong>A</strong>`</li>
<li>Now run mplayer or any other video player in the  ssh session and it will play on computer <strong>A</strong>.</li>
</ol>
<p>Step 2 authorizes use of the current display by computer <strong>A</strong> and only needs to be run once. Also, note that the display variable doesn&#8217;t need to be set when using <strong>B</strong>&#8217;s screen.</p>
<p>Mplayer works wonderfully when playing on my desktop, plus I control it via the ssh session. It has tons of keyboard shortcuts. The ones I use the most are space for pause and the arrow keys for skipping around.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://compguyaug.com/2010/01/x11-forwarding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PVR Update</title>
		<link>http://compguyaug.com/2010/01/pvr-update/</link>
		<comments>http://compguyaug.com/2010/01/pvr-update/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 11:00:43 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[mencoder]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://compguyaug.com/?p=499</guid>
		<description><![CDATA[In anticipation of TV shows coming back on, I&#8217;ve been tweaking my PVR scripts. These record shows from the digital airwaves right onto my computer. I&#8217;ve separated the script into two parts: recording and encoding. Each is a simple one line shell script that can be called easily from the command line or from a [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>In anticipation of TV shows coming back on, I&#8217;ve been tweaking my PVR scripts. These record shows from the digital airwaves right onto my computer. I&#8217;ve separated the script into two parts: recording and encoding. Each is a simple one line shell script that can be called easily from the command line or from a cron. The record.sh script is:</p>
<pre>/usr/bin/mencoder dvb://$1 -ovc copy -oac copy -o "$2.mpeg" -endpos $3</pre>
<p>All this does is copy the video and audio streams directly to the disk. The three parameters are  the station name, as stated in ~/.mplayer/channels.conf, the filename and the end position. This end position can be the number or seconds to record, or a time format of hh:mm:ss. This makes recording fairly simple within the cron.</p>
<p>The encode.sh script contains:</p>
<pre>/usr/bin/mencoder -vf scale=640:-2 -ovc xvid -xvidencopts bitrate=1700:threads=2 \
 -oac copy "$1" -o "$1.avi"</pre>
<p>This, slightly more complex use of mencoder, will scale the video to 640 wide, the height calculated to keep the aspect ratio. The video is encoded into xvid at 1700kbps using 2 threads. To speed up the encoding process, the audio is not re-encoded, but copied as is.</p>
<p>You will need to play with the number of xvid threads to find the best fps. I have a dual-core and it encodes the fastest with 2 threads. It does need to be an integer, and most dual-cores will work best at 2.</p>
<p>Then, two lines are required in the cron to record and encode the program:</p>
<pre>59 19 * * 1 /dvr/record.sh WAGTNBC /dvr/shows/heroes 01:03:00
05 20 * * 1 /dvr/encode.sh /dvr/shows/heroes.mpeg</pre>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://compguyaug.com/2010/01/pvr-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mencoder Cheat Sheet</title>
		<link>http://compguyaug.com/2009/12/mencoder-cheat-sheet/</link>
		<comments>http://compguyaug.com/2009/12/mencoder-cheat-sheet/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 11:00:17 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[mencoder]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://compguyaug.com/?p=467</guid>
		<description><![CDATA[Mencoder is a video encoder for linux. It is part of the mplayer package which also includes a video player. This tool is quite versatile and can do pretty much any kind of video processing all from the console.
As with any linux tool, there a tons of bells and whistles. This makes the learning curve [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Mencoder is a video encoder for linux. It is part of the mplayer package which also includes a video player. This tool is quite versatile and can do pretty much any kind of video processing all from the console.</p>
<p>As with any linux tool, there a tons of bells and whistles. This makes the learning curve kind of steep, but with a bit of determination anyone can make sense of it. Without further ado, here&#8217;s the cheat sheet:</p>
<table border="0">
<tbody>
<tr>
<td>mencoder clip1.avi clip2.avi -ovc copy -oac copy -o new-clip.avi</td>
<td>Copies clip1 and clip2 into new-clip.avi</td>
</tr>
<tr>
<td>mencoder clip.avi -ovc xvid -xvidencopts bitrate=800  -oac lamemp3 -lameopts cb:br=128 -o new-clip.avi</td>
<td>Encodes a clip with the xvid codec at 800Kbps and mp3 audio at 128Kbps.</td>
</tr>
<tr>
<td>mencoder clip.avi -ovc xvid -xvidencopts bitrate=800:threads=2  -oac lamemp3 -lameopts cbr:br=128 -o new-clip.avi</td>
<td>Same as above, but uses 2 threads for the xvid encoding.</td>
</tr>
<tr>
<td>mencoder clip.avi -endpos 00:05:00 -ovc copy -oac copy -o new-clip.avi</td>
<td>Copies the first 5 minutes from clip.avi into new-clip.avi</td>
</tr>
<tr>
<td>mencoder clip.avi -endpos 00:05:00 -ss 00:01:00 -ovc copy -oac copy -o new-clip.avi</td>
<td>Copies 5 minutes from clip.avi into new-clip.avi, skipping the first minute.</td>
</tr>
<tr>
<td>mencoder dvb://WJBF-DT -endpos 01:0000 -ovc copy -oac copy -o ugly.betty.mpeg</td>
<td>Tunes to WJBF-DT, records 1 hour of that station to ugly.betty.mpeg</td>
</tr>
<tr>
<td>mencoder clip.avi -vf scale=640:-2 -ovc xvid -xvidencopts bitrate=1200:threads=2 -oac copy -o new-clip.avi</td>
<td>Resizes the video to 640 wide, keeping the aspect ration, then encoding video using xvid at 1200Kbps and copying the audio directly</td>
</tr>
<tr>
<td>mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -ovc lavc -o &gt;(tee webcam-`date +%Y-%m-%d-%H.%M.%S`.avi | mplayer -cache 128)</td>
<td>Records the webcam to &#8220;webcam-yyyy-dd-mm-hh.mm.ss.avi&#8221;, where that is the date, and display it to the screen while recording.</td>
</tr>
<tr>
<td>mencoder -idx clip.avi -ovc copy -oac copy new-clip.avi</td>
<td>Fixes the AVI index of clip.avi, the output being new-clip.avi</td>
</tr>
<tr>
<td>mencoder clip.avi -vf cropdetect -o /dev/null</td>
<td>Detects what cropping is needed</td>
</tr>
<tr>
<td>mencoder clip.avi -of mpeg -mpegopts format=dvd -lavcopts vcodec=mpeg2video:vbitrate=5000:acodec=ac3 -o dvd-clip.mpeg</td>
<td>Encodes clip.avi into a dvd-compatible mpeg at 5000Kbps</td>
</tr>
<tr>
<td>mencoder -dvd 2 -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -o dvd.avi</td>
<td>Rips a DVD to dvd.avi</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://compguyaug.com/2009/12/mencoder-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH Without a Password</title>
		<link>http://compguyaug.com/2009/12/ssh-without-a-password/</link>
		<comments>http://compguyaug.com/2009/12/ssh-without-a-password/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 23:44:27 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://compguyaug.com/?p=492</guid>
		<description><![CDATA[You can ssh from one box to another without typing in your password. This is done using a key pair. One key sits on the computer A, the other on computer B. Starting logged into computer A, here&#8217;s how you do it:
ssh-keygen -t dsa
ssh B mkdir ~/.ssh/
cat .ssh/id_dsa.pub &#124; ssh B 'cat &#62;&#62; .ssh/authorized_keys'
When you [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>You can ssh from one box to another without typing in your password. This is done using a key pair. One key sits on the computer A, the other on computer B. Starting logged into computer A, here&#8217;s how you do it:</p>
<pre>ssh-keygen -t dsa
ssh <strong>B</strong> mkdir ~/.ssh/
cat .ssh/id_dsa.pub | ssh <strong>B</strong> 'cat &gt;&gt; .ssh/authorized_keys'</pre>
<p>When you run ssh-keygen, do not use a passphrase, just press enter. Also, change the bold <strong>B</strong> to the name or IP of computer B. If you were successful, you should be able to `ssh <strong>B</strong>` without a password.</p>
<p>To repeat for another computer, do not repeat ssh-keygen, just repeat line 2 &amp; 3. If you run ssh-keygen again, your key will be overwritten and you&#8217;ll need to copy it again via line 3.</p>
<p>Using keys is an excellent security measure. You can even setup sshd to only allow keyed logins. No passwords allowed. If you do set this up, make sure you have physical access or a rescue/remote console or you&#8217;ll be locked out if you lose your key.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://compguyaug.com/2009/12/ssh-without-a-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PVR Cron</title>
		<link>http://compguyaug.com/2009/10/pvr-cron/</link>
		<comments>http://compguyaug.com/2009/10/pvr-cron/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 11:00:11 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[pvr]]></category>
		<category><![CDATA[tv]]></category>

		<guid isPermaLink="false">http://compguyaug.com/?p=264</guid>
		<description><![CDATA[For about a year now, I&#8217;ve been playing around with my digital tuner card. It wasn&#8217;t until I turned off the cable that I have a need to use it. Using some cool linux tools, I&#8217;ve made a script to record HDTV broadcasts to my computer. It is a work in progress, but here&#8217;s what [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>For about a year now, I&#8217;ve been playing around with my digital tuner card. It wasn&#8217;t until I turned off the cable that I have a need to use it. Using some cool linux tools, I&#8217;ve made a script to record HDTV broadcasts to my computer. It is a work in progress, but here&#8217;s what I&#8217;ve got so far.</p>
<p><strong>The Tuner Card</strong><br />
The tuner card is DVB based on a Conextant chipset, so the first step was to get my kernel to make the card usable. A quick check will show if the driver is loaded:</p>
<p><code>dmesg | grep dvb</code></p>
<p><strong>The Tools Required</strong></p>
<ul>
<li>dvb-atsc-tools</li>
<li>azap</li>
<li>ffmpeg</li>
</ul>
<p><strong>Channel Scan</strong><br />
Scan for channels using:</p>
<p><code>dvbscan /usr/share/dvb/atsc/us-ATSC-center-frequencies-8VSB &gt; ~/.azap/channels.conf</code></p>
<p>Edit the file ~/.azap/channels.conf to make sure the channel names are correct. Your base frequencies file may be in a different location, but it is usually under <code>/usr/share</code>.</p>
<p><strong>Iteration 1: Crontab Recording</strong><br />
At first, I used only the crontab to record. Here&#8217;s an example:</p>
<p><code><br />
24 12 * * * /usr/bin/azap -c /home/dvr/.azap/channels.conf -r WRDW-HD<br />
25 12 * * * /bin/cat /dev/dvb/adapter0/dvr0 &gt; /data/dvr/young-restless.mpeg<br />
35 13 * * * /usr/bin/pkill cat<br />
36 13 * * * /usr/bin/pkill azap<br />
37 13 * * * /usr/bin/ffmpeg -i /data/dvr/young-restless.mpeg -s 1024x476 -vcodec libxvid -b 1600000 -acodec copy /data/dvr/y-r-friday.avi<br />
</code></p>
<p>This is a very ugly solution with lots of cracks. For instance, if I were running cat from a console when <code>/usr/bin/pkill cat</code> were running, it would die. Heaven forbid another processes is using cat when that runs. Also, I had to change the name of the ffmpeg output file every day.</p>
<p><strong>Iteration 2: Cronable Perl Script</strong><br />
This script does pretty much the same thing as the above 4 lines in the crontab does. This means you don&#8217;t have to write 4 lines in the crontab for each recording, just 1 line. Also, the file name is appended with the date in yyyy-mm-dd format.</p>
<p><code><br />
#!/usr/bin/perl</code></p>
<p>#Does someone need a reminder?<br />
if ( $#ARGV != 2 ) {<br />
print &#8220;Usage:\n&#8221;;<br />
print &#8220;record.pl   \n&#8221;;<br />
exit;<br />
}</p>
<p>#Creates a random 16 character (a-z) string<br />
sub randstr {<br />
my @chars=(&#8216;a&#8217;..&#8217;z');<br />
my $res = &#8220;&#8221;;<br />
for(my $i=0;$i&lt;16;$i++) {<br />
$res .= $chars[rand($#chars)];<br />
}<br />
return $res;<br />
}</p>
<p>#Grab the command line args<br />
my ( $channel, $length, $finalFileName ) = @ARGV;</p>
<p>#Temporary mpeg filename<br />
my $tempFileName = randstr();</p>
<p>#Add date to final filename<br />
$finalFileName .= &#8220;-&#8221;.`date +%Y-%m-%d`;<br />
$finalFileName =~ s/\n//;</p>
<p>#Start Azap in the background<br />
print &#8220;Starting azap\n&#8221;;<br />
system( &#8220;/usr/bin/azap -c /home/barry/.azap/channels.conf -r $channel &gt;/dev/null 2&gt;/dev/null &amp;&#8221; );<br />
sleep 5;</p>
<p>#Start cat in the background<br />
print &#8220;Starting cat\n&#8221;;<br />
system( &#8220;/bin/cat /dev/dvb/adapter0/dvr0 &gt; /data/dvr/$tempFileName.mpeg &amp;&#8221; );</p>
<p>#Sleep the required seconds for the show to record<br />
print &#8220;Recording for &#8220;.(60*$length).&#8221; seconds&#8230;\n&#8221;;<br />
sleep 60*$length;</p>
<p>#TODO: Remove pkill, as it may cause problems<br />
print &#8220;Killing cat and azap.\n&#8221;;<br />
`pkill cat`;<br />
`pkill azap`;</p>
<p>#Resize &amp; Encode to XVID using ffmpeg<br />
#ffmpeg sometimes stops working b/c of bad mpeg data<br />
#TODO: Replace with mencoder<br />
print &#8220;Encoding&#8230;\n&#8221;;<br />
`/usr/bin/ffmpeg -i /data/dvr/$tempFileName.mpeg -s 1024&#215;476 -vcodec libxvid -b 1600000 -acodec copy /data/dvr/$finalFileName.avi`;</p>
<p>#Remove the temporary mpeg file<br />
`rm $tempFileName.mpeg`;</p>
<p>print &#8220;Done!\n&#8221;;</p>
<p>I know it&#8217;s not the most elegant of perl scripts, but it gets the job done. Here&#8217;s a sample cron:</p>
<p><code><br />
25 12 * * * /home/dvr/record.pl WRDW-HD 70 young-restless<br />
</code></p>
<p>As you can see from the TODO comments, I continue to tinker with the script. When I make a good development, I&#8217;ll post it. If you have any suggestions, feel free to post a comment or contact me.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://compguyaug.com/2009/10/pvr-cron/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cron Jobs</title>
		<link>http://compguyaug.com/2009/10/cron-jobs/</link>
		<comments>http://compguyaug.com/2009/10/cron-jobs/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 11:00:03 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[scheduled jobs]]></category>

		<guid isPermaLink="false">http://compguyaug.com/?p=259</guid>
		<description><![CDATA[Cron jobs are the Linux/UNIX world&#8217;s scheduler. Many people, myself included, have a hard time understanding crons. After all, setting one up is very simple, if you know what you are doing.
The Crontab
&#8220;crontab&#8221; is the utility you use to setup a cron job. Type &#8220;crontab -e&#8221; from the command prompt to edit your list of [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Cron jobs are the Linux/UNIX world&#8217;s scheduler. Many people, myself included, have a hard time understanding crons. After all, setting one up is very simple, if you know what you are doing.</p>
<p><strong>The Crontab</strong><br />
&#8220;<code>crontab</code>&#8221; is the utility you use to setup a cron job. Type &#8220;<code>crontab -e</code>&#8221; from the command prompt to edit <strong>your</strong> list of crons. It&#8217;s just a textfile with a special format. Each non-blank line is a cron job. The format of each line is 6 space separated fields. Here is what each field defines:</p>
<ol>
<li>Minute</li>
<li>Hour (Military Time)</li>
<li>Day of the Month</li>
<li>Month</li>
<li>Day of the Week (0 is Sunday, 1 is Monday, etc.)</li>
<li>Program to run w/any arguments (may include spaces)</li>
</ol>
<p>The Date/Time fields may be a specific number, a &#8220;*&#8221; meaning anything, a &#8220;*/x&#8221; meaning every x hours/minutes/etc., or a comma separated list of any or all of the above.</p>
<p>So, if you wanted a certain program to run every 30 minutes, you could say it any of these ways:</p>
<pre>*/30 * * * * /path/to/program arg1 arg2
0,30 * * * * /path/to/program arg1 arg2
12,42 * * * * /path/to/program arg1 arg2</pre>
<p><strong>Use Absolute Paths</strong><br />
If you are writing a script to run as a cron, you <strong>must</strong> make sure your script uses full paths or it will throw an error. Yes, the script will execute without error when run from the command line, but the cron will crap out.</p>
<p><strong>Examples</strong></p>
<pre>0 2 1 * * /home/apache/rotate-logs.sh</pre>
<p>Runs the rotate-logs.sh script the first of every month at 2AM.</p>
<pre>0 17 * * * /home/oddjob/send-margarita-time-email.sh</pre>
<p>Runs the send-margarita-time-email.sh script at 5PM every day.</p>
<pre>0 17 * * 1,2,3,4,5 /home/oddjob/send-margarita-time-email.sh</pre>
<p>Runs the send-margarita-time-email.sh script at 5PM Monday &#8211; Friday.</p>
<pre>0 4 * * 1 /usr/sbin/mysql_dump &gt; /backup/mysql/backup-`date "+%Y-%m-%d"`</pre>
<p>Performs a weekly backup of the mysql database Mondays at 4AM.</p>
<pre>0 0 1,15 * * /home/accounting/payroll.pl</pre>
<p>Runs payroll.pl on the first and fifteenth of every month at 12 midnight.</p>
<p><strong>Points to remember</strong></p>
<ul>
<li>Use full paths in scripts</li>
<li>The crontab is only for the current user</li>
</ul>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://compguyaug.com/2009/10/cron-jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vim quick start</title>
		<link>http://compguyaug.com/2009/06/vim-quick-start/</link>
		<comments>http://compguyaug.com/2009/06/vim-quick-start/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 11:00:57 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://compguyaug.com/?p=131</guid>
		<description><![CDATA[Vim is a open source text editor.  I fell in love with it a few years ago.  It runs on Linux, Windows, Macs, and others.  The interface is pretty much the same across the board. It really is full-featured.  It highlights almost any file syntax from PHP to python to httpd.conf.
One major barriers to its [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Vim is a open source text editor.  I fell in love with it a few years ago.  It runs on Linux, Windows, Macs, and others.  The interface is pretty much the same across the board. It really is full-featured.  It highlights almost any file syntax from PHP to python to httpd.conf.</p>
<p>One major barriers to its popularity is its learning curve.  Vim was designed to be used entirely by a keyboard.  To start, download it and install it.  If you&#8217;re running linux, it should be preinstalled.  Once it is installed, run it by running vi. When you run it, you can only scroll.</p>
<p>Press the i key or the insert key to go to insert mode and you can type all day long. Press the escape key to exit insert mode.</p>
<p>You can do a quick search by pressing forward slash and typing your search. To repeat the last search press the foward slash then enter.</p>
<p>All the other basic commands start with a colon.  Here are a few to get you started:</p>
<ul>
<li>:w &#8212; write the file</li>
<li>:sav filename &#8212; save the file to filename</li>
<li>:q &#8212; quit</li>
<li>:n &#8212; go to the next file</li>
<li>:N &#8212; go the the previous file</li>
<li>:wq &#8212; write the file and quit</li>
<li>:q! &#8212; quit now!</li>
<li>:wn &#8212; write the file andd go to the next file</li>
</ul>
<p>There is a key difference between &#8220;:q&#8221; and &#8220;:q!&#8221;.  The first will not quit if the file has been changed or there are more files to edit.  The second will quit immediately.</p>
<p>There are  a ton more features than what is listed here.  When you are ready to continue learning vim, type :help for a help screen.  Type :q to exit the help.</p>
<p>Happy editing.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://compguyaug.com/2009/06/vim-quick-start/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

