<?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 Exploits of Plouj &#187; tools</title>
	<atom:link href="http://www.plouj.com/blog/category/tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.plouj.com/blog</link>
	<description>A blog by Michael Ploujnikov</description>
	<lastBuildDate>Wed, 01 Sep 2010 17:05:46 +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>Google Earth trip video capture in GNU/Linux with Yukon/Seom</title>
		<link>http://www.plouj.com/blog/2009/07/15/google-earth-trip-video-capture-in-gnulinux-with-yukonseom/</link>
		<comments>http://www.plouj.com/blog/2009/07/15/google-earth-trip-video-capture-in-gnulinux-with-yukonseom/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 17:21:55 +0000</pubDate>
		<dc:creator>plouj</dc:creator>
				<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[capture]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[googleearth]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[seom]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[yukon]]></category>

		<guid isPermaLink="false">http://www.plouj.com/blog/?p=385</guid>
		<description><![CDATA[This is documentation of how I used Yukon and Seom to video capture a Google Earth trip for a recent video project in Fedora 10. I used the official installation guide as a starting point. Compile the Seom library I choose to install both Seom and Yukon in a custom prefix /home/plouj/yukon, rather than the [...]]]></description>
			<content:encoded><![CDATA[<p>This is documentation of how I used <a href="https://devel.neopsis.com/projects/yukon/">Yukon and Seom</a> to video capture a <a href="http://earth.google.com/">Google Earth</a> <a href="http://earth.google.com/tour.html#v=4">trip</a> for a recent video project in <a href="http://fedoraproject.org/">Fedora</a> 10. I used the <a href="https://devel.neopsis.com/projects/yukon/wiki/HowTo/Install">official installation guide</a> as a starting point.</p>
<h2>Compile the Seom library</h2>
<p>I choose to install both Seom and Yukon in a custom prefix <em>/home/plouj/yukon</em>, rather than the system wide <em>/usr</em> or <em>/usr/local</em>.</p>
<pre>
$ svn co https://devel.neopsis.com/svn/seom/branches/packetized-stream seom
$ cd seom
$ ./configure --prefix=/home/plouj/yukon --arch="x86" --cflags="-W -Wall" &#038;&#038; \
make CC="gcc -m32" &#038;&#038; make install LIBDIR="lib"
</pre>
<p>Note that &#8220;&#8211;arch=&#8221;x86&#8243; and &#8220;-m32&#8243; are only necessary for me because my operating system is 64bit and I need 32bit versions of seom and yukon (to work with 32bit Google Earth).</p>
<h2>Compile and install Yukon</h2>
<pre>
$ svn co https://devel.neopsis.com/svn/yukon/branches/rewrite yukon
$ cd yukon
$ ./configure --prefix=/home/plouj/yukon/ --libdir="lib" --arch="x86" &#038;&#038; \
make CC="gcc -L/home/plouj/yukon/lib -I/home/plouj/yukon/include -m32" &#038;&#038; \
make install
</pre>
<h2>Install Google Earth for Linux</h2>
<p>Obviously get it here: <a href="http://earth.google.com/">http://earth.google.com/</a></p>
<h2>Modify the Google Earth startup script</h2>
<p>Since I chose <em>/home/plouj/bin/</em> as the &#8220;Binary path&#8221; for Google Earth I was editing <em>/home/plouj/bin/googleearth</em>. All I had to do was to add yukon/seom library and executable paths at the end of the script:</p>
<pre>
...
cd "${GOOGLEEARTH_DATA_PATH}/"
LD_LIBRARY_PATH=/home/plouj/yukon/lib/:$LD_LIBRARY_PATH \
PATH=/home/plouj/yukon/bin:$PATH exec yukon "./googleearth-bin" "$@"
</pre>
<p>instead of the original:</p>
<pre>
cd "${GOOGLEEARTH_DATA_PATH}/"
exec "./googleearth-bin" "$@"
</pre>
<h2>Capture</h2>
<p>Finally, the <a href="https://devel.neopsis.com/projects/yukon/wiki/HowTo/Capture">capture</a> process is well documented on the Yukon website.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plouj.com/blog/2009/07/15/google-earth-trip-video-capture-in-gnulinux-with-yukonseom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fedora 9 Jigdo</title>
		<link>http://www.plouj.com/blog/2008/05/14/fedora-9-jigdo/</link>
		<comments>http://www.plouj.com/blog/2008/05/14/fedora-9-jigdo/#comments</comments>
		<pubDate>Wed, 14 May 2008 20:55:00 +0000</pubDate>
		<dc:creator>plouj</dc:creator>
				<category><![CDATA[tools]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[jigdo]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.plouj.com/blog/?p=13</guid>
		<description><![CDATA[So Fedora 9 has been released upon the masses yesterday. I won&#8217;t be able to try it for a while, but I decided to start downloading it now anyways. On the download page I noticed a curious new option of using Jigdo. After reading a bit about Jigdo it looks like it could fit me [...]]]></description>
			<content:encoded><![CDATA[<p>So <a href="http://docs.fedoraproject.org/release-notes/f9/">Fedora 9</a> has been released upon the masses yesterday. I won&#8217;t be able to try it for a while, but I decided to start downloading it now anyways. On the download page I noticed a curious new option of using <a href="http://atterer.net/jigdo/">Jigdo</a>. After reading a bit about Jigdo it looks like it could fit me well. I have, what I consider to be, a fast (5Mbit download) Internet connection, but I don&#8217;t like the idea of straining mirror download servers of Free Software projects which usually exist on a volunteer basis (A recent check shows that the main Fedora mirror is indeed overloaded). Plus, my bittorrent download keeps going inactive so I&#8217;m currently downloading Fedora 9 with Jigdo.</p>
<p>In Fedora 8, Jigdo was easy to install:<br />
<code># yum install jigdo</code></p>
<p>From the jgdo manpage I discovered that the command line <strong>client</strong> version of jigdo is actually called &#8220;jigdo-lite&#8221;. Using this client turned out to be as easy as telling it which &#8220;.jigdo&#8221; file to use:</p>
<p><code>$ jigdo-lite http://www.muug.mb.ca/pub/fedora/linux/releases/9/Fedora/x86_64/jigdo/Fedora-9-x86_64-DVD.jigdo</code></p>
<p>Jigdo was nice enough to ask me to enter a path to previous installation media (presumably Fedora) to check for files which can be reused. To my amusement it turned out that the Fedora 7 x86_64 DVD contained no such files while the Fedora 8 x86_64 DVD contained 116 of the 2691 files required by the template.</p>
<p>Resuming jigdo was an interesting process. I canceled the first attempt with Ctrl-C. Then I simply re-ran the original jigdo command and it told me:</p>
<pre>The temporary directory `Fedora-9-x86_64-DVD.iso.tmpdir' already exists. Its contents
ARE GOING TO BE DELETED (possibly after having been copied to the
image, if they are of interest for it). If you do not want this
to happen, press Ctrl-C now. Otherwise, press Return to proceed.</pre>
<p>This puzzled me because it didn&#8217;t say what is the meaning of the files in the *.tmpdir directory. Without knowing that I shouldn&#8217;t be expected to assess the importance of the directory and make a decision about deleting it. My initial guess was that it contained <strong>everything</strong> that jigdo has downloaded in the previous session. I checked the &#8220;jigdo&#8221; and &#8220;jigdo-lite&#8221; mangpages but they did not mention resuming. Thankfully, the documentation on the website was more helpful. The <a href="http://atterer.net/jigdo/debian-jigdo-mini-howto/x205.html#DOWNLOADINGOFTHEISO">Downloading Of The ISO</a> section made it clear that I shouldn&#8217;t fear to loose Fedora-9-x86_64-DVD.iso.tmpdir after all. Apparently it simply stores files which have <strong>just</strong> been downloaded but haven&#8217;t been merged into the temporary image (which is called Fedora-9-x86_64-DVD.iso.tmp). I checked that currently Fedora-9-x86_64-DVD.iso.tmpdir is much smaller than Fedora-9-x86_64-DVD.iso.tmp so I feel confident in letting jigdo delete that dir:</p>
<pre>$ ls -lah
total 3.9G
drwxrwxr-x  3 plouj plouj 4.0K 2008-05-14 15:48 .
drwxr-xr-x 25 plouj plouj 4.0K 2008-05-14 11:16 ..
-rw-rw-r--  1 plouj plouj 314K 2008-05-14 11:30 Fedora-9-x86_64-DVD.iso.list
-rw-rw-r--  1 plouj plouj 3.9G 2008-05-14 15:47 Fedora-9-x86_64-DVD.iso.tmp
drwxrwxr-x  4 plouj plouj 4.0K 2008-05-14 15:47 Fedora-9-x86_64-DVD.iso.tmpdir
-rw-rw-r--  1 plouj plouj 211K 2008-05-12 13:11 Fedora-9-x86_64-DVD.jigdo
-rw-rw-r--  1 plouj plouj  12M 2008-05-12 11:38 Fedora-9-x86_64-DVD.template
-rw-rw-r--  1 plouj plouj 3.0M 2008-05-14 11:30 jigdo-file-cache.db
$ du -sh Fedora-9-x86_64-DVD.iso.tmpdir
7.5M	Fedora-9-x86_64-DVD.iso.tmpdir</pre>
<p>Find confirms the same:</p>
<pre>$ find Fedora-9-x86_64-DVD.iso.tmpdir -type f
Fedora-9-x86_64-DVD.iso.tmpdir/gulus.usherbrooke.ca/pub/distro/fedora/linux/releases/9/Fedora/x86_64/os/Packages/lucene-contrib-2.3.0-1jpp.0.fc9.x86_64.rpm
Fedora-9-x86_64-DVD.iso.tmpdir/gulus.usherbrooke.ca/pub/distro/fedora/linux/releases/9/Fedora/x86_64/os/Packages/libpng-1.2.24-1.fc9.x86_64.rpm
Fedora-9-x86_64-DVD.iso.tmpdir/gulus.usherbrooke.ca/pub/distro/fedora/linux/releases/9/Fedora/x86_64/os/Packages/lftp-3.6.3-2.fc9.i386.rpm
Fedora-9-x86_64-DVD.iso.tmpdir/www.muug.mb.ca/pub/fedora/linux/releases/9/Fedora/x86_64/os/Packages/glibc-2.8-3.x86_64.rpm</pre>
<p>After I pressed &#8220;Return&#8221;, jigdo happily resumed downloading my Fedora 9 DVD. Some time later, the download finished successfully and the resulting image passed the SHA1SUM check.</p>
<p>In addition to the resuming confusion I noticed a few other problems with Jigdo. Firstly, it just takes a long time to download and check all the files. It has been running for over 3 hours and at 500KB/s (the average speed I get from good servers) the whole DVD image (3970.8 MB) would have been downloaded by now. Secondly, the name is hard to spell correctly. I&#8217;ve gone from &#8220;Jingo&#8221; to &#8220;Jidgo&#8221; to &#8220;Figdo&#8221;.</p>
<p>To be fair, I have to admit that the coolness of what jigdo does in the background outweighs its shortcomings and I am happy with it in the end.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plouj.com/blog/2008/05/14/fedora-9-jigdo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HOWTO: run rTorrent from Cron inside Screen at boot</title>
		<link>http://www.plouj.com/blog/2008/03/31/howto-run-rtorrent-from-cron-inside-screen/</link>
		<comments>http://www.plouj.com/blog/2008/03/31/howto-run-rtorrent-from-cron-inside-screen/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 17:13:48 +0000</pubDate>
		<dc:creator>plouj</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[bittorrent]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[p2p]]></category>
		<category><![CDATA[screen]]></category>

		<guid isPermaLink="false">http://www.plouj.com/blog/?p=3</guid>
		<description><![CDATA[Once I figured out how to do QoS on my openwrt router I decided that I would make use of the bandwidth provided to me by my ISP to seed some nice legal torrents as long as I can without interrupting my Internet browsing. Since I was already using rTorrent, it seemed like a good [...]]]></description>
			<content:encoded><![CDATA[<p>Once I figured out how to do <a href="http://wiki.openwrt.org/MiniHowtos/QoSHowto">QoS on my openwrt router</a> I decided that I would make use of the bandwidth provided to me by my ISP to seed some nice legal torrents as long as I can without interrupting my Internet browsing. Since I was already using rTorrent, it seemed like a good choice for a console application running inside screen that would be started by cron each time my computer boots. In theory that was true, but in practice the lack of documentation of various peculiarities cost me a few hours of digging and asking around before I had a properly working solution. In this post I will document my solution.</p>
<p>Right away I knew that I wanted to be able to easily attach to the bittorrent screen session at any time, so I used an easy to remember name for it:</p>
<pre>screen -s torrent</pre>
<p>I also knew that for screen to work with cron it had to start in a &#8220;detached&#8221; mode. Thankfully, the screen manual told me how to do that:</p>
<pre>screen -d m</pre>
<p>During my research I came across different people mentioning a <a href="http://www.google.ca/search?q=cron+screen+%22-dmS%22">short form</a> for all of the above switches:</p>
<pre>screen -dmS torrent</pre>
<p>Since I like to simplify things I immediately adopted it and unfortunately paid dearly in the end. In fact, this was one of those attractive in theory but poorly executed features that cause other things to fail and waste my time with unhelpful error messages. It took me a few hours to figure out that it was causing screen to keep failing to start from inside cron with a &#8220;Must be connected to a terminal.&#8221; error.</p>
<p>Once I got over that hurdle I tried the full command without cron:</p>
<pre>screen -d -m -S torrent /usr/bin/rtorrent</pre>
<p>Everything was good until I noticed that I couldn&#8217;t use any rTorrent keyboard commands. I couldn&#8217;t even quit it apart from killing it from a separate terminal. According to the <a href="http://libtorrent.rakshasa.no/wiki/RTorrentUserGuide">rTorrent user guide</a> this was a result of a flow control conflict with screen. Thankfully screen also had a switch -fa just for that:</p>
<pre>screen -fa -d -m -S torrent /usr/bin/rtorrent</pre>
<p>To be on the safe side I used an absolute path to screen in the cron job:</p>
<pre>/usr/bin/screen -fa -d -m -S torrent /usr/bin/rtorrent</pre>
<p>Making sure cron starts this each time my computer boots was easy with the @reboot directive so this is exactly what should go in the crontab:</p>
<pre>@reboot /usr/bin/screen -fa -d -m -S torrent /usr/bin/rtorrent</pre>
<p>After running rTorrent like this for a few days I noticed that it was a bit unstable and would crash sometimes so I came up with a simple Bash script to keep it running:</p>
<pre>
$ cat ~/bin/myrtorrent
#!/bin/bash
PROGRAM="/usr/bin/rtorrent"
GRACE_DELAY=15
while true;
do
    "$PROGRAM"
    RETURNED=$?
    if [ $RETURNED -ne 0 ]
    then
	echo "$PROGRAM did not exit cleanly with status code $RETURNED"
	echo "pausing for $GRACE_DELAY seconds before restarting $PROGRAM"
	sleep $GRACE_DELAY;
    else
	echo "$PROGRAM exited cleanly. It will not be restarted automatically"
	exit 0
    fi
done
</pre>
<p>The final cronjob looks like this now:</p>
<pre>
@reboot /usr/bin/screen -fa -d -m -S torrent $HOME/bin/myrtorrent
</pre>
<p>Sadly, the usefullness of this setup is questionable since <a href="http://arstechnica.com/news.ars/post/20080325-canadian-isps-furious-about-bell-canadas-traffic-throttling.html">Bell is throttling DSL resellers&#8217; peer-to-peer traffic</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plouj.com/blog/2008/03/31/howto-run-rtorrent-from-cron-inside-screen/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
