<?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>Brain Drop</title>
	<atom:link href="http://blog.itchy.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.itchy.net</link>
	<description>My memory, in blog format.  Feel free to peek.</description>
	<lastBuildDate>Sun, 23 Oct 2011 13:38:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Trouble-free vnc on kubuntu</title>
		<link>http://blog.itchy.net/2011/10/trouble-free-vnc-on-kubuntu/</link>
		<comments>http://blog.itchy.net/2011/10/trouble-free-vnc-on-kubuntu/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 13:38:05 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.itchy.net/?p=300</guid>
		<description><![CDATA[The below steps gave me an auto-starting desktop-effects-tolerant vnc.  I haven&#8217;t been able to fine one spot that gives a simple method to getting a working vnc on kubuntu, until now: Make a backup of the MIT-COOKIE auth file. Having &#8230; <a href="http://blog.itchy.net/2011/10/trouble-free-vnc-on-kubuntu/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The below steps gave me an auto-starting desktop-effects-tolerant vnc.  I haven&#8217;t been able to fine one spot that gives a simple method to getting a working vnc on kubuntu, until now:</p>
<p>Make a backup of the MIT-COOKIE auth file. Having this file will allow x11vnc to run without being root, eliminating much of the configuration headaches involved.</p>
<blockquote><p>ps wwaux | grep auth</p></blockquote>
<p>The file will be located in:</p>
<blockquote><p>/var/run/xauth</p></blockquote>
<p>In my case it was: /var/run/xauth/A:0-q6mb8o &#8211; but NOTE: This name will change frequently.  This is why we need to copy this out in the next step.</p>
<p>Create a new directory in ~/.vnc to store this file:</p>
<blockquote><p>mkdir ~/.vnc</p></blockquote>
<p>Copy the MIT-COOKIE file we found above to this location:</p>
<blockquote><p>sudo cp /var/run/xauth/your_file ~/.vnc</p></blockquote>
<p>Now install x11vnc:</p>
<blockquote><p>sudo apt-get install x11vnc</p></blockquote>
<p>Create a password:</p>
<blockquote><p>x11vnc -storepasswd YOUR_PWD ~/.vnc/x11vnc.pass</p></blockquote>
<p>Run x11vnc once:</p>
<blockquote><p>x11vnc -forever -rfbport 5900 -rfbauth ~/.vnc/x11vnc.pass -o ~/.vnc/x11vnc.log -auth ~/.vnc/your_auth_file -noxdamage -display :0</p></blockquote>
<p>The -auth switch points to the MIT-cookie auth file, and -noxdamage prevents Compiz from creating additional display issues. I would suggest changing the RFB or listening port to a non-standard one for security reasons.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.itchy.net/2011/10/trouble-free-vnc-on-kubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shrink Virtualbox VDI File Size (Windows Guest)</title>
		<link>http://blog.itchy.net/2011/05/shrink-virtualbox-vdi-file-size-windows-guest/</link>
		<comments>http://blog.itchy.net/2011/05/shrink-virtualbox-vdi-file-size-windows-guest/#comments</comments>
		<pubDate>Fri, 27 May 2011 17:32:25 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[VirtualBox]]></category>

		<guid isPermaLink="false">http://blog.itchy.net/?p=290</guid>
		<description><![CDATA[Making a note here so in the future I remember the steps required to shrink a VirtualBox hard-drive file on the host machine: First need to get SDelete from microsoft and run it on the guest machine to zero out &#8230; <a href="http://blog.itchy.net/2011/05/shrink-virtualbox-vdi-file-size-windows-guest/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Making a note here so in the future I remember the steps required to shrink a VirtualBox hard-drive file on the host machine:</p>
<p>First need to get SDelete from microsoft and run it on the guest machine to zero out the free space on the drive.</p>
<p>Grab SDelete from</p>
<blockquote><p><code><a title="http://www.microsoft.com/technet/sysinternals/Security/SDelete.mspx" href="http://www.microsoft.com/technet/sysinternals/Security/SDelete.mspx">http://www.microsoft.com/technet/sysinternals/Security/SDelete.mspx</a></code></p></blockquote>
<p>Extract it, run it within the guest OS with -c :</p>
<blockquote><p><code>sdelete -c c:</code></p></blockquote>
<p>and shutdown the guest OS and virtualbox<br />
then on the host (running ubuntu of course):</p>
<blockquote><p><code>vditool SHRINK ntfs.vdi</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.itchy.net/2011/05/shrink-virtualbox-vdi-file-size-windows-guest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful Programs</title>
		<link>http://blog.itchy.net/2010/09/useful-programs/</link>
		<comments>http://blog.itchy.net/2010/09/useful-programs/#comments</comments>
		<pubDate>Sun, 26 Sep 2010 02:38:57 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.itchy.net/?p=287</guid>
		<description><![CDATA[A list of useful or fun programs i&#8217;ve been using under ubuntu that are not in the normal repositories: BleachBit &#8211; Clean junk to free disk space and to maintain privacy Catch And Convert &#8211; Download and convert video from &#8230; <a href="http://blog.itchy.net/2010/09/useful-programs/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A list of useful or fun programs i&#8217;ve been using under ubuntu that are not in the normal repositories:</p>
<p><a href="http://bleachbit.sourceforge.net/download/linux">BleachBit</a> &#8211; Clean junk to free disk space and to maintain privacy</p>
<p><a href="http://sourceforge.net/projects/cac/files/">Catch And Convert</a> &#8211; Download and convert video from websites</p>
<p><a href="http://www.dropbox.com/">DropBox</a> &#8211; Online Backup</p>
<p><a href="http://wordrider.net/freerapid/">FreeRapid Downloader</a> &#8211; A simple Java downloader for downloading from file-sharing services</p>
<p><a href="http://www.ubuntugeek.com/gnome-commander-nice-and-fast-file-manager-for-the-gnome-desktop.html">Gnome Commander</a> &#8211; sudo apt-get install gnome-commander</p>
<p><a href="http://handbrake.fr/">Handbrake</a> &#8211; Video conversion</p>
<p><a href="http://radiotray.sourceforge.net/">Radio Tray</a> &#8211; Online streaming player that runs on a Linux system tray</p>
<p><a href="http://www.subdownloader.net/">SubsDownloader</a> &#8211; Download subtitles for movies</p>
<p><a href="http://torrent-search.sourceforge.net/download">Torrent Search</a> &#8211; Find all your torrents</p>
<p><strong>With Custom Repositories</strong></p>
<ul>
<li>Skype:
<ul>
<li>sudo gedit /etc/apt/sources.list</li>
<li>Add:
<ul>
<li>deb <a title="Linkification: http://download.skype.com/linux/repos/debian/" href="http://download.skype.com/linux/repos/debian/">http://download.skype.com/linux/repos/debian/</a> stable non-free</li>
</ul>
</li>
<li>Now you need to install GPG key
<ul>
<li>sudo apt-key adv &#8211;keyserver pgp.mit.edu &#8211;recv-keys 0xd66b746e</li>
</ul>
</li>
<li>Update sources list
<ul>
<li>sudo apt-get update</li>
</ul>
</li>
<li>Install skype using the following command
<ul>
<li>sudo apt-get install skype</li>
</ul>
</li>
</ul>
</li>
</ul>
<p style="padding-left: 30px;">
]]></content:encoded>
			<wfw:commentRss>http://blog.itchy.net/2010/09/useful-programs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nagios Comments</title>
		<link>http://blog.itchy.net/2010/09/nagios-comments/</link>
		<comments>http://blog.itchy.net/2010/09/nagios-comments/#comments</comments>
		<pubDate>Thu, 23 Sep 2010 00:02:14 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.itchy.net/?p=281</guid>
		<description><![CDATA[Comments are stored in /usr/local/nagios/var/status.dat You can view it (non-intrusively) by doing cat /usr/local/nagios/var/status.dat An example of one of the comment entries is: hostcomment { host_name=Customer ABC entry_type=4 comment_id=27065 source=0 persistent=0 entry_time=1283883777 expires=0 expire_time=0 author=Nagios Admin comment_data=Checking now (Rich) } &#8230; <a href="http://blog.itchy.net/2010/09/nagios-comments/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Comments are stored in /usr/local/nagios/var/status.dat</p>
<p>You can view it (non-intrusively) by doing cat /usr/local/nagios/var/status.dat</p>
<p>An example of one of the comment entries is:</p>
<p style="padding-left: 60px;"><em><span style="color: #000000;">hostcomment {<br />
</span></em><em><span style="color: #000000;">host_name=Customer ABC<br />
</span></em><em><span style="color: #000000;">entry_type=4<br />
</span></em><em><span style="color: #000000;">comment_id=27065<br />
</span></em><em><span style="color: #000000;">source=0<br />
</span></em><em><span style="color: #000000;">persistent=0<br />
</span></em><em><span style="color: #000000;">entry_time=1283883777<br />
</span></em><em><span style="color: #000000;">expires=0<br />
</span></em><em><span style="color: #000000;">expire_time=0<br />
</span></em><em><span style="color: #000000;">author=Nagios Admin<br />
</span></em><em><span style="color: #000000;">comment_data=Checking now (Rich)<br />
</span></em><em><span style="color: #000000;">}</span></em></p>
<p>Before you get too excited it&#8217;s not as easy as just editing that file.  This file is locked while nagios is running so you can&#8217;t edit anything.<br />
If you stop nagios, however, the contents of status.dat are written to:<br />
/usr/local/nagios/var/retention.dat</p>
<p>And this is where you can have fun!</p>
<p>While nagios is stopped you can edit the data in retention.dat, but I would recommend only using the following to avoid causing ownership problems:</p>
<p><strong>/usr/local/nagios/var$ sudo -u nagios pico retention.dat</strong></p>
<p>or</p>
<p><strong>/usr/local/nagios/var$ sudo -u nagios gedit retention.dat</strong></p>
<p>should also work but i don&#8217;t have a GUI on my servers here at home so can&#8217;t test it.</p>
<p>The key is the name.  You can move a comment to another entry by just changing the &#8216;host_name&#8217; to another valid host.</p>
<p>It appears on each start of nagios any comments with invalid hosts are deleted.   So the only way you could change a hostname and retain comments would be to stop nagios &#8211; change the host-name in customers.cfg and then also find and replace in retention.dat for the same hostname-change.  And restart nagios.  (Remember to make sure you don’t fudge up the ownership/permissions)</p>
<p>If you just change the hostname in customers.cfg and restart nagios all old comments are wiped.</p>
<p><strong>Other thoughts:</strong></p>
<p style="padding-left: 30px;">Entry Type:</p>
<p style="padding-left: 60px;">entry_type=1 = User Comment<br />
entry_type=2 = System Comments (flapping)<br />
entry_type=4 = Acknowledgements</p>
<p style="padding-left: 30px;">Fun with linux:</p>
<ul>
<li>if you wanted to see just the user comments for hosts:<br />
grep -B2 -A9 entry_type.1 retention.dat</li>
<li>if you wanted to find all comments that contain Flubber you first search for retention (and get the 2 lines before and 9 lines after) then grep THOSE results for Flubber (-i = not-case-sensitive):<br />
grep -B2 -A9 entry_type.1 retention.dat | grep -B1 -A10 -i Flubber</li>
<li>To replace the text &#8216;John&#8217; with &#8216;John Doe&#8217; you could:
<ul>
<li>cat retention.dat | sed &#8220;s/John/John Doe/g&#8221; &gt;retention1.dat
<ul>
<li>the changed file will be at retention1.dat</li>
</ul>
</li>
<li>To do it inline:
<ul>
<li>sed -i &#8220;s/John/John Doe/g&#8221; retention.dat</li>
</ul>
</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.itchy.net/2010/09/nagios-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Samba Security Update</title>
		<link>http://blog.itchy.net/2010/03/samba-security-update/</link>
		<comments>http://blog.itchy.net/2010/03/samba-security-update/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 23:48:59 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.itchy.net/?p=274</guid>
		<description><![CDATA[In mid march Ubuntu released a security patch that stopped my samba shares from working. I have it set up that my windows media pcs can browse my ubuntu file-server to a single share.  Then I have 2 or 3 &#8230; <a href="http://blog.itchy.net/2010/03/samba-security-update/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In mid march Ubuntu released a security patch that stopped my samba shares from working.<br />
<span id="more-274"></span><br />
I have it set up that my windows media pcs can browse my ubuntu file-server to a single share.  Then I have 2 or 3 drives as symlinks outside of that share.  The security update prevents those symlinks from working.</p>
<p>To fix it I had to add 3 options to the /etc/samba/smb.conf file and restart samba.</p>
<p>Below is the global section of smb.conf with the three additions I did highlighted.</p>
<p><code>[global]<br />
log file = /var/log/samba/log.%m<br />
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .<br />
obey pam restrictions = yes<br />
null passwords = yes<br />
map to guest = bad user<br />
encrypt passwords = true<br />
passwd program = /usr/bin/passwd %u<br />
passdb backend = tdbsam<br />
dns proxy = no<br />
server string = %h server (Samba, Ubuntu)<br />
unix password sync = yes<br />
workgroup = WORKGROUP<br />
syslog = 0<br />
panic action = /usr/share/samba/panic-action %d<br />
usershare allow guests = yes<br />
max log size = 1000<br />
pam password change = yes<br />
follow symlinks = yes<br />
wide links = yes<br />
unix extensions = no</code></p>
<p><code> </code></p>
<p><code>## Browsing/Identification ###</code></p>
<p>The three options I (well JD figured it out) added are the last three options:</p>
<p>follow symlinks = yes<br />
wide links = yes<br />
unix extensions = no</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.itchy.net/2010/03/samba-security-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tight VNC Server (separate desktop)</title>
		<link>http://blog.itchy.net/2010/01/tight-vnc-server-separate-desktop/</link>
		<comments>http://blog.itchy.net/2010/01/tight-vnc-server-separate-desktop/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 00:01:38 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.itchy.net/?p=228</guid>
		<description><![CDATA[How to set up Tight VNC Server to work on a separate Desktop. <a href="http://blog.itchy.net/2010/01/tight-vnc-server-separate-desktop/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Tight VNC Server</p>
<p>First install tightvncserver:</p>
<blockquote><p>sudo apt-get install tightvncserver</p></blockquote>
<p>Create script to start service:</p>
<p>To create the service-start script:</p>
<blockquote><p>sudo pico /etc/init.d/vncserver</p></blockquote>
<p>Paste in the below, modifying the variables at the top as necessary:</p>
<blockquote><p>#!/bin/sh -e<br />
### BEGIN INIT INFO<br />
# Provides:          vncserver<br />
# Required-Start:    networking<br />
# Default-Start:     S<br />
# Default-Stop:      0 6<br />
### END INIT INFO<br />
PATH=”$PATH:/usr/X11R6/bin/”<br />
# The Username:Group that will run VNC<br />
export USER=”brian”<br />
#${RUNAS}<br />
# The display that VNC will use<br />
DISPLAY=”1″<br />
# Color depth (between 8 and 32)<br />
DEPTH=”16″<br />
# The Desktop geometry to use.<br />
#GEOMETRY=”<WIDTH>x<HEIGHT>”<br />
#GEOMETRY=”800×600″<br />
#GEOMETRY=”1024×768″<br />
#GEOMETRY=”1280×1024″<br />
GEOMETRY=”1280×768″<br />
#GEOMETRY=”1440×900″<br />
# The name that the VNC Desktop will have.<br />
NAME=”my-vnc-server”<br />
OPTIONS=”-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}”<br />
. /lib/lsb/init-functions<br />
case “$1″ in<br />
start)<br />
log_action_begin_msg “Starting vncserver for user ‘${USER}’ on localhost:${DISPLAY}”<br />
su ${USER} -c “/usr/bin/vncserver ${OPTIONS}”<br />
;;<br />
stop)<br />
log_action_begin_msg “Stoping vncserver for user ‘${USER}’ on localhost:${DISPLAY}”<br />
su ${USER} -c “/usr/bin/vncserver -kill :${DISPLAY}”<br />
;;<br />
restart)<br />
$0 stop<br />
$0 start<br />
;;<br />
esac<br />
exit 0</p></blockquote>
<p>Finally, make the file executable:</p>
<blockquote><p>sudo chmod +x /etc/init.d/vncserver</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.itchy.net/2010/01/tight-vnc-server-separate-desktop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fanboys</title>
		<link>http://blog.itchy.net/2010/01/fanboys/</link>
		<comments>http://blog.itchy.net/2010/01/fanboys/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 22:57:08 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.itchy.net/?p=217</guid>
		<description><![CDATA[I found this elsewhere, thought it was hilarious, the pic takes you to where i found it.]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.makeuseof.com/tech-fun/how-fanboys-see-operating-systems-pic/"><img class="size-medium wp-image-220 alignnone" title="computerfanboys" src="http://blog.itchy.net/wp-content/uploads/2010/01/computerfanboys1-300x244.png" alt="computerfanboys" width="300" height="244" /></a></p>
<p style="text-align: center;">I found this elsewhere, thought it was hilarious, the pic takes you to where i found it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.itchy.net/2010/01/fanboys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fuze Video Conversion</title>
		<link>http://blog.itchy.net/2009/09/fuze-video-conversion/</link>
		<comments>http://blog.itchy.net/2009/09/fuze-video-conversion/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 23:24:11 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.itchy.net/?p=164</guid>
		<description><![CDATA[I found the following script to convert videos to be compatible with the Sanza Fuze player.  At the center of it is a script posted to the Sanza Forums.  Many thanks to the script author ‘Thomas’.  You can find his helpful posts on his Sanza Forum Profile Page. <a href="http://blog.itchy.net/2009/09/fuze-video-conversion/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I found the following script to convert videos to be compatible with the Sanza Fuze player.  At the center of it is a script posted to the Sanza Forums.  Many thanks to the script author &#8216;Thomas&#8217;.  You can find his helpful posts on his <a title="ewelot" href="http://forums.sandisk.com/sansa/profile?user.id=26720">Sanza Forum Profile Page.</a></p>
<p><strong>Step One:</strong></p>
<p>Ensure mencoder is installed, final processing step does require the use of a windows app using wine, so make sure both are installed.<strong><br />
</strong></p>
<blockquote><p>sudo apt-get install mencoder wine unzip</p></blockquote>
<p><strong>Step Two:</strong></p>
<p>Grab the freeware AVI-MUX program:  <a title="AVI-MUX GUI" href="http://www.alexander-noe.com/video/amg/">Website Link</a>,  or use the code below.</p>
<p>Extract the zip to your windows &#8216;program files&#8217; directory as configured in wine.  If you haven&#8217;t done any customization it is located at: &#8220;~/.wine/drive_c/Program Files&#8221;<br />
I downloaded the zip to this location and extracted it at this location.</p>
<p>Accomplish all of this with:</p>
<blockquote><p>cd ~/.wine/drive_c/Program\ Files</p>
<p>wget http://www.alexander-noe.com/video/amg/AVI-Mux_GUI-1.17.8.zip</p>
<p>unzip AVI-Mux_GUI-1.17.8.zip -d AVI-Mux_GUI-1.17.8</p></blockquote>
<p><strong>Step Three:</strong></p>
<p>Save the script (At the bottom) into a location that is in your path and set as executable.  I kept the original authors name &#8216;pvc.sh&#8217;</p>
<p><strong>Step Four:</strong></p>
<p>Execute the conversion with:</p>
<blockquote><p>./pvc.sh input_video.mkv output_name.avi</p></blockquote>
<p><strong>The Script</strong>:</p>
<p>Thomas (the script author) posted his script at the following location for download.</p>
<p>You can <a title="Ewelot's Script" href="http://bash.pastebin.com/pastebin.php?dl=f4480d948">download ewelot&#8217;s script</a>, and verify file integrity by running</p>
<blockquote><p><span style="font-family: courier new,courier;"><span>md5sum pvc.sh</span></span></p></blockquote>
<p>which must print the following hash value:<span style="font-family: courier new,courier;"><span> </span></span></p>
<blockquote><p><span style="font-family: courier new,courier;"><span>d9b3efdec6a32f1853f59784101d8503  pvc.sh</span></span></p></blockquote>
<p>or copy the script below into a file into your path:</p>
<pre name="code" class="bash">
#! /bin/bash

############################################################################
#   pvc.sh [-hvdo] [-x|y] [-p player] [-c codec] [-b vbit] [-a abit]
#          [-k keyint] [-s start] [-l length]
<input>  <output>
#
#   Portable media player video converter for linux.
#
#   The purpose of this script is to convert videos into a format which
#   can be played by portable media players, e.g. the SanDisk Sansa Fuze.
#   It is based on mencoder and AVI-Mux_GUI.exe (under wine). The latter
#   can be found at: http://www.alexander-noe.com/video/amg
#
#   Examples:
#   - convert a video file for the Fuze:
#         pvc.sh anyvideo.mkv file.avi
#   - convert chapters 3 to 5 of title 2 from an anamorpic widescreen DVD:
#         pvc.sh -x dvd://2:3-5 dvdchapter.avi
#
#   Notes:
#   - You can reference selected chapters of DVD titles as
<input> by using
#     a special syntax of the form 'dvd://title:chapters' e.g. 'dvd://1:4-5'.
#     For a full list of other supported video input sources
#     (like streams e.c.) consult the manpage of mplayer/mencoder
#   - Temporary disk space of about the size of the output file is needed
#     under /tmp.
#   - Seeking ("-s start") is not supported by all
<input> types.
#   - There are rare cases where avimux-gui cannot handle AVI files
#     created by mencoder.
#
############################################################################
VERSION="1.1"
VINFO="T. Lehmann, Sep. 2009"
COPYRIGHT="(c) Thomas Lehmann, <t UNDERSCORE lehmann AT freenet DOT de>"
LICENSE="GPL v2 or any later version"
PINFO="\
    options:
      h        show this help text
      v        increase verbosity
      d        dry run, display mencoder commands and exit
      o        force to overwrite output file
      p player targeted portable player model (default: Fuze)
                   try '-p list' for a list of supported models
      c codec  video codecs used for encoding (default: xvid)
                   try '-c list' for a list of supported codecs
      b vbit   video bitrate in kbps (default: 600)
      a abit   audio bitrate in kbps (default: 128)
      k keyint video keyframe intervall in frames (default: 15)
      s start  start encoding at given time position (hh:mm:ss)
      l length encode for the given duration (hh:mm:ss)
      x        indicate the source video is 16:9 anamorphic
      y        indicate the source video is  4:3 anamorphic
    parameters:
      input    name of source video to be converted, there is support
               for DVD chapters like 'dvd://1:4-5' which is chapters 4-5
      output   output video file name
"
CHANGELOG="
    1.1  - 02 Sep 2009
        * bugfix: convert WINEPREFIX variable to absolute path
        * bugfix: handle space in path name to the AVI-Mux_GUI.exe
          (thanks to bug report by Jeff Ammons)

    1.0  - 25 Aug 2009
        * added option o to force overwriting output file
        * added support for DVD chapters
        * cleanup and more checks
        * preliminary support for SanDisk Sansa View (untested)

    0.2  - 24 Aug 2009
        * added option d to only display commands
        * removed TOFUZEOPTS in favour of new options x,y,s,l

    0.1  - 23 Aug 2009
        * first test release, based on tofuze() shell function
"

#--------------------
#   user definitions
#--------------------
verbose=0
player=fuze
ac=mp3          # audio codec
srate=44100     # audio sample rate in Hz

#--------------------
#   functions
#--------------------
shorthelp ()
{
  echo "Usage:  $(basename $0)" \
       "[-hvdo] [-x|y] [-p player] [-c codec] [-b vbit] [-a abit]"
  echo "               [-k keyint] [-s start] [-l length]
<input>  <output>"
}

longhelp ()
{
  echo $(basename $0)"   [$VERSION]   $VINFO"
  shorthelp
  printf "$PINFO"
}

error ()
{
  f_str="$1"
  echo "ERROR:  $f_str" >&#038;2
  exit 1
}

#--------------------
#   get options
#--------------------
dryrun="";
player="fuze"   # player model
vc="xvid"       # video codec
vbit=600        # video bitrate in kbps
abit=128        # audio bitrate in kbps
keyint=15       # video keyframe interval
meopts="-ffourcc DX50"
xy=""
overwrite=""
while getopts dp:c:b:a:k:s:l:xyohv c
do
  case $c in
    d)  dryrun=1;;
    o)  overwrite=1;;
    p)  player="$(echo $OPTARG | awk '{print tolower($0)}')";;
    c)  vc="$(echo $OPTARG | awk '{print tolower($0)}')";;
    b)  vbit=$OPTARG;;
    a)  abit=$OPTARG;;
    k)  keyint=$OPTARG;;
    s)  meopts+=" -ss $OPTARG";;
    l)  meopts+=" -endpos $OPTARG";;
    x)  test "$xy" &#038;&#038; error "Options x and y are mutually exclusive."
        xy=1
        meopts+=" -aspect 16:9";;
    y)  test "$xy" &#038;&#038; error "Options x and y are mutually exclusive."
        xy=1
        meopts+=" -aspect 4:3";;
    h)  longhelp; exit -1;;
    v)  verbose=$(($verbose + 1));;
    \?) shorthelp
        echo "Try '$(basename $0) -h' for more information."
        exit -1;;
  esac
done
shift `expr $OPTIND - 1`

#--------------------
#   get parameter
#--------------------
if [ ! $# = 2 ]
then
    echo "ERROR: Wrong number of parameters."
    shorthelp
    echo "Try '$(basename $0) -h' for more information."
    exit -1
fi
infile="$1"
outfile="$2"

#--------------------
#   checkings
#--------------------
# handling of special source media or streams
if echo "$infile" | grep -q "//"
then
    # some kind of special source media or stream
    # test for special dvd chapter syntax
    if echo "$infile" | grep -q -E "^dvd://[0-9]+:[0-9]+"
    then
        meopts+=" -chapter $(echo "$infile" | cut -d ":" -f3)"
        infile="$(echo "$infile" | cut -d ":" -f1-2)"
    fi
else
    # regular file
    test ! -f "$infile" &#038;&#038;
        error "Input file '$infile' not found."
fi

# output file
test -f "$outfile" &#038;&#038; test -z "$overwrite" &#038;&#038;
    error "Output file '$outfile' exists. Use option '-o' to overwrite it."

# programs
for p in mencoder wine winepath
do
    ! type -p $p > /dev/null 2>&#038;1 &#038;&#038; error "program $p not in search path"
done

test "$WINEPREFIX" || WINEPREFIX=$HOME/.wine
test ! -d "$WINEPREFIX" &#038;&#038;
  error "Directory WINEPREFIX=\"$WINEPREFIX\" does not exist."
# convert to absolute path
WINEPREFIX="$(cd "$WINEPREFIX" &#038;&#038; pwd)"
amgexe="$(find "$WINEPREFIX" -name "AVIMux_GUI.exe" | head -1)"
test -z "$amgexe" &#038;&#038;
  error "Cannot find AVIMux_GUI.exe file.
  You might have to provide the path to the AVIMux_GUI software by
  using the WINEPREFIX environment variable on the command line."

#--------------------
#   start
#--------------------
log=$(mktemp "/tmp/tmp_log_$$.XXXXXX")
amgscript=$(mktemp "/tmp/tmp_amg_$$.XXXXXX")
tmp1=$(mktemp "/tmp/tmp_vid_$$.XXXXXX")

# mencoder message level
meopts+=" -msglevel all=$(expr 3 + $verbose)"

# player specific settings
exit_after_info=""
fps=""
container=""
case $player in
    fuze)   w=224   # width in pixel
            h=176   # height in pixel
            fps=20  # video frames per second
            container="avi"
            ;;
    view)   w=320
            h=240
            fps=30
            container="lavf -lavfopts format=mp4"
            ;;
    test)   w=640
            h=480
            ;;
    list|help)
            echo ""
            echo "  List of supported portable media players:"
            echo ""
            echo "      fuze   - SanDisk Sansa Fuze (default)"
            echo "      view   - SanDisk Sansa View (experimental)"
            echo ""
            exit_after_info=1
            ;;
    \?)     error "The player '$player' is not supported by this program."
            ;;
esac

# combine video options to be passed to mencoder
vopts="-vf pp=li,expand=:::::$w/$h,scale=$w:$h,harddup"
test "$fps" &#038;&#038; vopts="-ofps $fps $vopts"
test "$container" &#038;&#038; vopts="-of $container $vopts"
case $vc in
    mpeg4)  vcopts="-ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$vbit:vmax_b_frames=0:keyint=$keyint"
            vcopts1="$vcopts:turbo:vpass=1"
            vcopts2="$vcopts:vpass=2";;
    xvid)   vcopts="-ovc xvid -xvidencopts bitrate=$vbit:max_bframes=0:max_key_interval=$keyint"
            vcopts1="$vcopts:turbo:pass=1"
            vcopts2="$vcopts:pass=2";;
    x264)   vcopts="-ovc x264 -x264encopts bitrate=$vbit:bframes=0:keyint=$keyint"
            vcopts1="$vcopts:turbo=1:pass=1"
            vcopts2="$vcopts:pass=2";;
    list|help)
            echo ""
            echo "  List of supported video codecs:"
            echo ""
            echo "      xvid   - Xvid MPEG-4 Part 2 codec (default)"
            echo "      mpeg4  - mpeg4 MPEG-4 Part 2 codec from libavcodec/ffmpeg"
            echo "      x264   - H.264 MPEG-4 Part 10 AVC codec (experimental)"
            echo ""
            exit_after_info=1
            ;;
    \?)     error "The video codec '$vc' is not supported."
            ;;
esac
test "$exit_after_info" &#038;&#038; exit 0

# reject invalid combinations of player and codec
test "$player" == "fuze" &#038;&#038; test "$vc" == "x264" &#038;&#038;
    error "x264 video codec is not supported by SanDisk Sansa Fuze."

# combine audio options to be passed to mencoder
aopts="-srate $srate -af resample=$srate:0:1,format=s16le"
case $ac in
    mp3)    acopts="-oac mp3lame -lameopts cbr:br=$abit";;
    ac3)    acopts="-oac lavc -lavcopts acodec=ac3:abitrate=$abit";;
    *)      acopts=""; echo "unknown audio codec";;
esac

# mencoder two-pass encoding
msgprefix="
# $(basename $0) is executing:
"
test "$dryrun" &#038;&#038; msgprefix=""
rm -f divx2pass.log
echo "$msgprefix\
    mencoder $meopts $vopts $vcopts1 $aopts $acopts \"$infile\" -o \"$tmp1\" 2>$log
"
if [ ! "$dryrun" ]
then
    mencoder $meopts $vopts $vcopts1 $aopts $acopts "$infile" -o "$tmp1" 2>$log
fi
err=$?
test ! $err -eq 0 &#038;&#038;
  cat $log &#038;&#038;
  error "mencoder failed at first pass with error $err."

echo "$msgprefix\
    mencoder $meopts $vopts $vcopts2 $aopts $acopts \"$infile\" -o \"$tmp1\" 2>>$log
"
if [ ! "$dryrun" ]
then
    mencoder $meopts $vopts $vcopts2 $aopts $acopts "$infile" -o "$tmp1" 2>>$log
fi
err=$?
test ! $err -eq 0 &#038;&#038;
  cat $log &#038;&#038;
  error "mencoder failed at second pass with error $err."

if [ "$player" == "fuze" ]
then
# create AVIMux_GUI script file
cat <<EOScript > $amgscript
CLEAR
LANGUAGE English
LOAD $(winepath -w "$tmp1")
SELECT FILE 1
ADD VIDEOSOURCE
SET OPTION CLOSEAPP 1
SET OPTION DONEDLG 0
SET OPTION OVERWRITEDLG 0
SET INPUT OPTIONS
WITH SET OPTION
UNBUFFERED 1
OVERLAPPED 1
ADD_IMMED 0
ADD_IMMED 1
USE CACHE 1
AVI FORCE MP3VBR 0
MP3 VERIFY CBR ASK
MP3 VERIFY RESDLG 0
M2F2 CRC 1
AVI FIXDX50 1
AVI IGNLCHUNKS OFF
AVI TRY2FIXLCHUNKS 0
WITH CHAPTERS
IMPORT 1
FROMFILENAMES 0
END WITH
END WITH
SET OUTPUT OPTIONS
WITH SET OPTION
UNBUFFERED 1
THREAD 1
LOGFILE 0
STDOUTPUTFMT AVI
END WITH
DESELECT AUDIO 0
WITH SET OPTION
END WITH
DESELECT SUBTITLE 0
WITH SET OPTION
NO AUDIO 0
ALL AUDIO 1
NO SUBTITLES 0
ALL SUBTITLES 1
OPENDML 1
LEGACY 1
RECLISTS 0
FRAMES 0
PRELOAD 0
MP3 CBR FRAMEMODE 0
MAXFILESIZE OFF
AVI AC3FPC 2
AVI MP3FPC 1
AVI DTSFPC 2
AVI ADDJUNKBEFOREHEADERS 0
OGG PAGESIZE 65025
AVI RIFFAVISIZE 999
AVI HAALIMODE 0
OVERLAPPED 0
MAXFILESIZE 2030
MAXFILES OFF
NUMBERING OFF
NUMBERING $Name ($Nbr)
AUDIO INTERLEAVE 2 FR
SPLIT POINTS OFF
STDIDX 4000 FRAMES
PRLAC BYTE
END WITH
WITH SET OPTION MKV
LACE 3
LACESIZE general 1 500
LACESIZE mp3 1 500
LACESIZE ac3 1 200
LACESIZE dts 1 100
LACESIZE aac 1 200
LACESIZE vorbis 1 50
CLUSTERSIZE 512
CLUSTERTIME 30000
CLUSTERINDEX 0
HARDLINKING 0
NONCLUSTERINDEXMODE 1
HEADERSIZE 0
HEADERSTRIPPING 0
USE_A_AAC 0
PREVCLUSTERSIZE 1
CLUSTERPOSITION 1
LIMIT1STCLUSTER 1
DISPWH 1
CUES 1
CUES VIDEO 1
CUES AUDIO 1
CUES SUBS 1
CUES AUTOSIZE 1
CUES MINIMUMINTERVAL 2000
CUES SIZERATIO 20
CUES TARGETSIZERATIO 980
CUES WRITEBLOCKNUMBER 1
CUES AUDIO ONLY_AUDIO_ONLY 0
TIMECODESCALE MKA 10000
TIMECODESCALE MKV 500000
FORCE_V1 1
FORCE_V2 0
FLOAT_WIDTH 32
RANDOMIZE_ORDER 1
2ND_COPY_OF_TRACKS 1
END WITH
START $(winepath -w "$outfile")
EOScript

# run AVIMux_GUI via wine
echo "$msgprefix\
    wine \"$amgexe\" \"$(winepath -w "$amgscript")\"
"
if [ ! "$dryrun" ]
then
    wine "$amgexe" "$(winepath -w "$amgscript")"
fi

else
   mv "$tmp1" "$outfile"
fi

#--------------------
#   clean-up
#--------------------
for f in $log $amgscript $tmp1
do
  test -f $f &#038;&#038; rm $f
done
exit 0
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.itchy.net/2009/09/fuze-video-conversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sansa Fuze MP3 Player Adventure</title>
		<link>http://blog.itchy.net/2009/09/sansa-fuze-mp3-player-adventure/</link>
		<comments>http://blog.itchy.net/2009/09/sansa-fuze-mp3-player-adventure/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 21:17:22 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.itchy.net/?p=160</guid>
		<description><![CDATA[Mine worked fine, but his was acting very flakey.  It refused to see any music in sub-folders.  If you copied music into the root of the Music share it would see the songs, but it would freeze as soon as it started playing. Both devices successfully had taken the update to the latest firmware. <a href="http://blog.itchy.net/2009/09/sansa-fuze-mp3-player-adventure/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>JD and I both bought <a title="Sansa Fuze 4GB" href="http://www.woot.com/Blog/ViewEntry.aspx?Id=9052">Sansa Fuze 4GB MP3 Players from Woot.</a></p>
<p>Mine worked fine, but his was acting very flakey.  It refused to see any music in sub-folders.  If you copied music into the root of the Music share it would see the songs, but it would freeze as soon as it started playing.  Both devices successfully had taken the update to the latest firmware.</p>
<p>I had changed the USB settings on my device to &#8216;MSC&#8217; mode, to prevent ubuntu from thinking it was a camera and allowed me to work with the files in a more pleasant view.  In this &#8216;MSC&#8217; view I saw 5 files in the root of the device including 4 .sys files and a .sdk file.</p>
<p>Just on a wild hunch i copied the .sys files from the working device, to the flakey device and this corrected all issues.  Both are now working great, playing all music files and properly seeing sub-folders.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.itchy.net/2009/09/sansa-fuze-mp3-player-adventure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SNMP</title>
		<link>http://blog.itchy.net/2009/08/snmp/</link>
		<comments>http://blog.itchy.net/2009/08/snmp/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 05:38:54 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.itchy.net/?p=108</guid>
		<description><![CDATA[Simple Network Management Protocol (SNMP) is a widely used protocol for monitoring the health and welfare of network equipment (eg. routers), computer equipment and even devices like UPSs. SNMPD is the service running SNMP on a managed entity. SNMP comes &#8230; <a href="http://blog.itchy.net/2009/08/snmp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: 100%;"><span style="font-family: arial;">Simple Network</span> Management Protocol (SNMP) is a widely used protocol for monitoring the health and welfare of network equipment (eg. routers), computer equipment and even devices like UPSs.</span></p>
<p><span style="font-size: 100%;"><span id="more-108"></span><br />
</span></p>
<p><span style="color: #0000ff;"><em> </em></span>SNMPD is the service running SNMP on a managed entity. SNMP comes in 3 versions. Version 1, the one we are going to use here is not secured, therefore we are going to make sure that only localhost is going to be able to access it.</p>
<p><span style="color: #0000ff;"><em></em></span></p>
<p>People opening the service to the outside should make sure that trusted hosts can access the service either though the use of iptables or through the use of /etc/hosts.allow.</p>
<p><span style="color: #0000ff;"><em>Tested on Ubuntu Desktop: 8.04, 8.10<br />
Tested on Ubuntu Server: 8.04, 8.10</em></span></p>
<p><strong>Installation</strong></p>
<ul>
<li><code>sudo apt-get install snmpd</code></li>
<li>edit file /etc/default/snmpd and make sure those values are set:
<ul>
<li>SNMPDRUN=yes</li>
<li>SNMPDOPTS=&#8217;-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1&#8242;
<ul>
<li>If you want your server to listen on all interfaces, remove the 127.0.0.1 bit.</li>
</ul>
</li>
<li>SNMPDOPTS=&#8217;-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid&#8217;</li>
</ul>
</li>
<li>Edit /etc/snmp/snmpd.conf and make sure that com2sec it only set to:
<ul>
<li>com2sec readonly 192.168.0.202 mycommunity
<ul>
<li>Replace the ip with that of your gathering server. Can be of the form: 1.1.1.1 or 1.1.0.0/16.</li>
<li>Replace the name &#8216;mycommunity&#8217; with the name of your snmp community</li>
</ul>
</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.itchy.net/2009/08/snmp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

