<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Almost Working Code</title>
	<atom:link href="http://almostworkingcode.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://almostworkingcode.wordpress.com</link>
	<description></description>
	<lastBuildDate>Wed, 09 Dec 2009 18:23:07 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='almostworkingcode.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/5b61c250e7d0cb1047d1f3203456e436?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Almost Working Code</title>
		<link>http://almostworkingcode.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://almostworkingcode.wordpress.com/osd.xml" title="Almost Working Code" />
		<item>
		<title>New Lolipower download script</title>
		<link>http://almostworkingcode.wordpress.com/2009/12/06/new-lolipower-download-script/</link>
		<comments>http://almostworkingcode.wordpress.com/2009/12/06/new-lolipower-download-script/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 20:49:41 +0000</pubDate>
		<dc:creator>Dario Meloni</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[lolipower]]></category>

		<guid isPermaLink="false">http://almostworkingcode.wordpress.com/?p=122</guid>
		<description><![CDATA[And this time it&#8217;s in perl!
I rewrote the script from scratch to see how much i knew Perl, and this is what I worked out.
It&#8217;s base on WWW::Mechanize and HTML::TreeBuilder::XPath respectively for managing the cookies and for searching in the html tree.
Using it is fairly simple.
lolipower Title
and it will download all the episodes of the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=122&subd=almostworkingcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>And this time it&#8217;s in perl!<br />
I rewrote the script from scratch to see how much i knew Perl, and this is what I worked out.<br />
It&#8217;s base on <code>WWW::Mechanize</code> and <code>HTML::TreeBuilder::XPath</code> respectively for managing the cookies and for searching in the html tree.</p>
<p>Using it is fairly simple.</p>
<p><code>lolipower Title</code></p>
<p>and it will download all the episodes of the anime in the local folder.<br />
With respect to the ruby version you can find in these pages the title can be partial, the script will find the complete title. If the title matches more then one anime then a list of anime that maches will be printed and the download aborted.</p>
<p>There are various options, especially 2 that I added to put the script in a cronjob to get mailed when a new episode comes out and automatically download it at night time.</p>
<p><code>lolipower --dest TitleFolder --new-ep Title</code></p>
<p>The <code>--dest</code> options tells the script where to save the files instead of the current directory, while <code>--new-ep</code> suppress every output except for new downloaded episodes, and will write in the mail even if the anime is completed.</p>
<p>One another nice feature is that it doesn&#8217;t check anymore each file&#8217;s md5 hash but only for freshly downloaded files. The behavior can be hoverwer forced with the <code>--md5</code> flag.</p>
<p>Aside from the options <code>--starep</code> and <code>--endep</code> that do exactly what you can think of there is the <code>--search</code> command. It will search the title in the list of animes without downloading anything.</p>
<p>There is another cute option to allow serial download of more then one anime! The <code>--conf</code> option.<br />
It accepts file with <code>#</code> as comment line and structured like<br />
<code><br />
# comment line<br />
Title=Folder<br />
Title=Folder<br />
</code><br />
where Title is the anime title (or a match for a unique anime) and Folder is a absolute path to the location where to store the episodes.</p>
<p>And from version 1.1 there is support for out of order episodes on the website, &#8211;startep and &#8211;endep works a lot better and the pages on the server are loaded less times.</p>
<p>The script can be found <a href="http://github.com/mellon85/Lolipower-Downloader">here</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/almostworkingcode.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/almostworkingcode.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/almostworkingcode.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/almostworkingcode.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/almostworkingcode.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/almostworkingcode.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/almostworkingcode.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/almostworkingcode.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/almostworkingcode.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/almostworkingcode.wordpress.com/122/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=122&subd=almostworkingcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://almostworkingcode.wordpress.com/2009/12/06/new-lolipower-download-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a502a5d4f53ebb6f02a96e174332d60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mellon</media:title>
		</media:content>
	</item>
		<item>
		<title>Hamachi and UDP Broadcast Games</title>
		<link>http://almostworkingcode.wordpress.com/2009/05/28/hamachi-and-udp-broadcast-games/</link>
		<comments>http://almostworkingcode.wordpress.com/2009/05/28/hamachi-and-udp-broadcast-games/#comments</comments>
		<pubDate>Thu, 28 May 2009 17:25:59 +0000</pubDate>
		<dc:creator>Dario Meloni</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[broadcast]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[hamachi]]></category>
		<category><![CDATA[lan]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[starcraft]]></category>
		<category><![CDATA[udp]]></category>
		<category><![CDATA[vpn]]></category>
		<category><![CDATA[warcraft]]></category>

		<guid isPermaLink="false">http://almostworkingcode.wordpress.com/?p=98</guid>
		<description><![CDATA[I was recently trying to play some old game (Starcraft, Warcraft 3, and others) in LAN with some friends through the hamachi VPN system. All attempts were unsucessful due to the fact that the broadcasted UDP packet weren&#8217;t sent over the VPN interface but only in the local LAN.
To solve this we just had to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=98&subd=almostworkingcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was recently trying to play some old game (Starcraft, Warcraft 3, and others) in LAN with some friends through the hamachi VPN system. All attempts were unsucessful due to the fact that the broadcasted UDP packet weren&#8217;t sent over the VPN interface but only in the local LAN.</p>
<p>To solve this we just had to manipulate the routing table of the systems.<br />
After connecting to the hamachi VPN just do these commands as root user</p>
<p>OS X: as long hamachi uses 5.x.x.x for his nodes<br />
<code>route add -net 255.255.255.255 5.255.255.255</code></p>
<p>Linux: where ham0 is the hamachi interface<br />
<code>route add -net 255.255.255.255 netmask 255.255.255.255 dev ham0</code><br />
<em>No, this is not working, i tried to test it and to work around it but found no solution to host on a linux machine by now. If anybody knows how to do so, let me know</em></p>
<p><em>It seems to be working on gentoo (look at the comments)</em></p>
<p>This will redirect all the broadcast packets, maybe it can interfere with some other program, but as long as you want some time off to play it works great. To clear the modification to the routing table we didn&#8217;t do anything else then disconnecting from the hamachi VPN, the system handles the disappareance of the interface removing every involved route.</p>
<p>Resuming*</p>
<table>
<tr>
<th>Game</th>
<th>Linux</th>
<th>MacOS</th>
</tr>
<tr>
<th>Warcraft 3</th>
<th>play</th>
<th>host</th>
</tr>
<tr>
<th>Starcraft</th>
<th>host</th>
<th>host</th>
</tr>
<tr>
<th>Delta Force</th>
<th>host</th>
<th>untested</th>
</tr>
</table>
<p>* <em>Linux has no other setup then just starting hamachi. This all was tested between a Mac and a Linux systems</em></p>
<p>If someone can test other games and maybe help on the linux problem that would be great.</p>
<p>Hope this helps!<br />
[last update 10 August 2009]</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/almostworkingcode.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/almostworkingcode.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/almostworkingcode.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/almostworkingcode.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/almostworkingcode.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/almostworkingcode.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/almostworkingcode.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/almostworkingcode.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/almostworkingcode.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/almostworkingcode.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=98&subd=almostworkingcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://almostworkingcode.wordpress.com/2009/05/28/hamachi-and-udp-broadcast-games/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a502a5d4f53ebb6f02a96e174332d60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mellon</media:title>
		</media:content>
	</item>
		<item>
		<title>Rtorrent web interface</title>
		<link>http://almostworkingcode.wordpress.com/2009/05/25/rtorrent-web-interface/</link>
		<comments>http://almostworkingcode.wordpress.com/2009/05/25/rtorrent-web-interface/#comments</comments>
		<pubDate>Mon, 25 May 2009 16:19:28 +0000</pubDate>
		<dc:creator>Dario Meloni</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[rpc]]></category>
		<category><![CDATA[rtorrent]]></category>
		<category><![CDATA[socket]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://almostworkingcode.wordpress.com/?p=87</guid>
		<description><![CDATA[Me and alka wrote a web application in ruby which serves as an interface to rtorrent. It has been written in ruby using the ramaze and sequel frameworks. It
is currently tested on debian stable with mostly apt-get installed gems,
for more info check the README file included (the only one external to
the distribution should be the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=87&subd=almostworkingcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Me and alka wrote a web application in ruby which serves as an interface to rtorrent. It has been written in ruby using the ramaze and sequel frameworks. It<br />
is currently tested on debian stable with mostly apt-get installed gems,<br />
for more info check the README file included (the only one external to<br />
the distribution should be the xmlrpc gem which is on another post in<br />
this blog).<br />
It supports authentication and accesses rtorrent through the unix socket<br />
interface, allowing to run the server as a user process.<br />
An internal copy of the information from rtorrent is stored in a<br />
in-memory sqlite database (maybe it can be totaly avoided, but that was how we planned it in the beggining) to avoid to access too much times to rtorrent<br />
along with the caching of pages in ramaze.</p>
<p>Currently may lack some feature, but it&#8217;s doing it&#8217;s job, the main<br />
missing feature is the user interface. If someone can write a<br />
CSS and maybe do some cleanup in the interface any help would be<br />
appreciated.</p>
<p>As usual in the code page everything can be found or directly here<br />
<code>git://github.com/mellon85/rtorrent-wrb.git</code></p>
<p>It is currently no more developed as we switched torrent client. Patches or comment are welcomed</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/almostworkingcode.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/almostworkingcode.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/almostworkingcode.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/almostworkingcode.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/almostworkingcode.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/almostworkingcode.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/almostworkingcode.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/almostworkingcode.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/almostworkingcode.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/almostworkingcode.wordpress.com/87/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=87&subd=almostworkingcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://almostworkingcode.wordpress.com/2009/05/25/rtorrent-web-interface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a502a5d4f53ebb6f02a96e174332d60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mellon</media:title>
		</media:content>
	</item>
		<item>
		<title>Download anime from lolipower.org</title>
		<link>http://almostworkingcode.wordpress.com/2009/05/17/download-from-lolipower-org/</link>
		<comments>http://almostworkingcode.wordpress.com/2009/05/17/download-from-lolipower-org/#comments</comments>
		<pubDate>Sun, 17 May 2009 07:45:32 +0000</pubDate>
		<dc:creator>alkawiz</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[md5]]></category>

		<guid isPermaLink="false">http://almostworkingcode.wordpress.com/?p=72</guid>
		<description><![CDATA[This little ruby script can download a whole anime serie from lolipower.org, when the anime page respects the &#8220;standards&#8221;. It verifies the MD5 checksum of downloads and it avoids to download already downloaded (checksum checked) or duplicated episodes.
If there are duplicate episodes the mkv format one will be preferred. You can also choose ,with command [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=72&subd=almostworkingcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This little ruby script can download a whole anime serie from lolipower.org, when the anime page respects the &#8220;standards&#8221;. It verifies the MD5 checksum of downloads and it avoids to download already downloaded (checksum checked) or duplicated episodes.<br />
If there are duplicate episodes the mkv format one will be preferred. You can also choose ,with command line arguments, the first and last episode to download.</p>
<p>You can find the link to the project in the code page or just here<br />
git://github.com/alka/down-lolipower.git</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/almostworkingcode.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/almostworkingcode.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/almostworkingcode.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/almostworkingcode.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/almostworkingcode.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/almostworkingcode.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/almostworkingcode.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/almostworkingcode.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/almostworkingcode.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/almostworkingcode.wordpress.com/72/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=72&subd=almostworkingcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://almostworkingcode.wordpress.com/2009/05/17/download-from-lolipower-org/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/497bd6ce4379f4d33f9c1b1d5608f695?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">alkawiz</media:title>
		</media:content>
	</item>
		<item>
		<title>Portsfoster</title>
		<link>http://almostworkingcode.wordpress.com/2009/02/03/portsfoster/</link>
		<comments>http://almostworkingcode.wordpress.com/2009/02/03/portsfoster/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 16:12:16 +0000</pubDate>
		<dc:creator>Dario Meloni</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[clean]]></category>
		<category><![CDATA[debfoster]]></category>
		<category><![CDATA[dependencies]]></category>
		<category><![CDATA[deps]]></category>
		<category><![CDATA[macports]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[portfile]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://almostworkingcode.wordpress.com/?p=58</guid>
		<description><![CDATA[Portsfoster is a debfoster clone i wrote in ruby for the Macports software distribution system.
It work in a similar way and helps you to have a clean MacPorts installation without ports you don&#8217;t want (or you forgot).
At start it will ask you if you want to purge inactive packages (or the program will leave them [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=58&subd=almostworkingcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Portsfoster is a <a href="http://www.fruit.je/debfoster/">debfoster</a> clone i wrote in ruby for the <a href="http://www.macports.org/">Macports</a> software distribution system.<br />
It work in a similar way and helps you to have a clean MacPorts installation without ports you don&#8217;t want (or you forgot).</p>
<p>At start it will ask you if you want to purge inactive packages (or the program will leave them untouched). Then it will load all the installed ports and dependencies to check which are new (to his knowledge) and ask you if you want to keep them.</p>
<p>You you don&#8217;t keep a port the program will continue asking on the packets dependencies if they aren&#8217;t already locked for another port.</p>
<p>When done the list of &#8220;keep&#8221; packet will be saved in <code>/opt/local/var/portsfoster</code> as simple text with one package for line. You can delete or add manually if you need to.</p>
<p>Don&#8217;t worry if the program takes time to calculate all the dependencies, it gets the information through the port command and not analyzing the port files, and this takes some time&#8230;</p>
<p>You can find the link to the project in the code page or just here<br />
<code>git://github.com/mellon85/portsfoster.git</code></p>
<p>P.s.<br />
Dont worry if the pogram reports that information about a port can&#8217;t be found. It means that the package has been localy installed (and it is not in the port tree) or that it has been installed and then removed from the port tree.<br />
If you have a old installation of macports (say, older then this post at least) you may receive the warning on the <code>render</code> port. Just uninstall it, it is no more in the tree.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/almostworkingcode.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/almostworkingcode.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/almostworkingcode.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/almostworkingcode.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/almostworkingcode.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/almostworkingcode.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/almostworkingcode.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/almostworkingcode.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/almostworkingcode.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/almostworkingcode.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=58&subd=almostworkingcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://almostworkingcode.wordpress.com/2009/02/03/portsfoster/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a502a5d4f53ebb6f02a96e174332d60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mellon</media:title>
		</media:content>
	</item>
		<item>
		<title>4chan</title>
		<link>http://almostworkingcode.wordpress.com/2009/01/19/4chan/</link>
		<comments>http://almostworkingcode.wordpress.com/2009/01/19/4chan/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 19:29:21 +0000</pubDate>
		<dc:creator>Dario Meloni</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[4chan]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[net]]></category>
		<category><![CDATA[page]]></category>

		<guid isPermaLink="false">http://almostworkingcode.wordpress.com/?p=49</guid>
		<description><![CDATA[I have written for testing purpose a script to download images that would have been posted on the website 4chan.org. I tried to let it go for 1 day.. I&#8217;ve got 2.7GB of data for 16661 images (the number tell me something about of what i have done).
Here&#8217;s the code

#! /usr/bin/ruby
# License: GPLv3 or newer

urls=['http://img.4chan.org/b/1.html',
 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=49&subd=almostworkingcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I have written for testing purpose a script to download images that would have been posted on the website <a href="http://www.4chan.org/">4chan.org</a>. I tried to let it go for 1 day.. I&#8217;ve got 2.7GB of data for 16661 images (the number tell me something about of what i have done).</p>
<p>Here&#8217;s the code</p>
<pre>
#! /usr/bin/ruby
# License: GPLv3 or newer

urls=['http://img.4chan.org/b/1.html',
    " ... other 4chan boards you want ..." ]

require 'rubygems'
require 'net/http'
require 'thread'

def download(url)
    uri = URI.parse(url)
    Net::HTTP.start(uri.host) { |h|
        page = h.get(uri.path)
        data = page.body.split(/(href=|\n)/).delete_if {
                               |x| !(x =~ /\"http/)}
        data = data.map {|x| x.gsub(/^\"/,'')}
        data = data.map { |x| x.gsub(/\".*/,'')}
        data = data.delete_if {|x| !(x =~ /(png|jpg|gif)$/)}
        data.uniq.each {|x|
            img = x.gsub(/.*\//,'')
            if !File.exist?(img) then
                puts "downloading #{img}"
                resp = h.get(URI.parse(x).path)
                open(img,"wb") { |f|
                    f.write(resp.body)
                }
            end
        }
        h.close
    }
end

threads = []
s = Mutex.new
urls.each { |x|
    Thread.start{
        s.synchronize{
            threads &lt;&lt; Thread.current
        }
        download(x)}
    }
</pre>
<pre>
while (threads.length != urls.length) do
    Thread.pass
    sleep(5)
end

threads.each{ |x|
    begin
        x.join
    rescue Exception =&gt; e
    end }
puts "finished"
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/almostworkingcode.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/almostworkingcode.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/almostworkingcode.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/almostworkingcode.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/almostworkingcode.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/almostworkingcode.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/almostworkingcode.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/almostworkingcode.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/almostworkingcode.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/almostworkingcode.wordpress.com/49/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=49&subd=almostworkingcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://almostworkingcode.wordpress.com/2009/01/19/4chan/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a502a5d4f53ebb6f02a96e174332d60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mellon</media:title>
		</media:content>
	</item>
		<item>
		<title>rTorrent 0.8.4 and ruby-controller 0.2</title>
		<link>http://almostworkingcode.wordpress.com/2009/01/04/rtorrent-084-and-ruby-controller-02/</link>
		<comments>http://almostworkingcode.wordpress.com/2009/01/04/rtorrent-084-and-ruby-controller-02/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 16:23:54 +0000</pubDate>
		<dc:creator>Dario Meloni</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[rtorrent]]></category>
		<category><![CDATA[upnp]]></category>

		<guid isPermaLink="false">http://almostworkingcode.wordpress.com/?p=46</guid>
		<description><![CDATA[Yesterday i switched to rtorrent 0.8.4 (debian build from experimental).
Rtorrent after some little adjustment in the configuration file has started working. I just had some problems with the torrent which i hadn&#8217;t completed.
Except these two little problems it just works, along with the ruby controller too (without any modification).
In the meanwhile I have added some [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=46&subd=almostworkingcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Yesterday i switched to rtorrent 0.8.4 (debian build from experimental).</p>
<p>Rtorrent after some little adjustment in the configuration file has started working. I just had some problems with the torrent which i hadn&#8217;t completed.</p>
<p>Except these two little problems it just works, along with the ruby controller too (without any modification).<br />
In the meanwhile I have added some little fixes to the controller and a new feature. <br />
Now the available upload bandwidth is decreased by a fraction of the actual rtorrent download speed.<br />
This is done to prevent even further to rtorrent to make itself slower flooding the upload bandwidth with ack packets.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/almostworkingcode.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/almostworkingcode.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/almostworkingcode.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/almostworkingcode.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/almostworkingcode.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/almostworkingcode.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/almostworkingcode.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/almostworkingcode.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/almostworkingcode.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/almostworkingcode.wordpress.com/46/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=46&subd=almostworkingcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://almostworkingcode.wordpress.com/2009/01/04/rtorrent-084-and-ruby-controller-02/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a502a5d4f53ebb6f02a96e174332d60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mellon</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby rtorrent controller</title>
		<link>http://almostworkingcode.wordpress.com/2008/09/27/ruby-rtorrent-controller/</link>
		<comments>http://almostworkingcode.wordpress.com/2008/09/27/ruby-rtorrent-controller/#comments</comments>
		<pubDate>Sat, 27 Sep 2008 09:06:46 +0000</pubDate>
		<dc:creator>Dario Meloni</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[bandwidth]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[rtorrent]]></category>
		<category><![CDATA[upload]]></category>
		<category><![CDATA[upnp]]></category>

		<guid isPermaLink="false">http://almostworkingcode.wordpress.com/?p=30</guid>
		<description><![CDATA[Finnaly i had time to work on the rtorrent controller.
it works, that&#8217;s all i can say everyone will have to test it and fix the various values to setup the network for each own best performances.
There are many costants that may be configured to solve problems you may encounter with the configuration. Everything should be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=30&subd=almostworkingcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Finnaly i had time to work on the rtorrent controller.<br />
it works, that&#8217;s all i can say everyone will have to test it and fix the various values to setup the network for each own best performances.</p>
<p>There are many costants that may be configured to solve problems you may encounter with the configuration. Everything should be clear in the comments but i&#8217;ll try to add  more comments anyway when i have time.</p>
<p>With the configuration in the distribution (made for myself for my 2M adsl) i can have my sister doing video chats and playing online without any lag problem and when everything is finihed rtorrent autmatically will raise his own bandwidth limits.</p>
<p>There is currently a drawback. Rtorrent versions prior of 0.8.1 have a memory leak regarding xmlrpc-rtorrent communications. This means that rtorrent is going to eat all your ram. I am using the program <a href="http://tildeslash.com/monit/">monit</a> to monitor my own servers and it&#8217;s  just trivial with it to keep rtorrent in a sane memory usare buy restarting it everytime it goes too far. Otherwise even a cronjob will do the trick restarting rtorrent every 1 or 2 days.</p>
<p>You can find the link to the project in the code page or just here<br />
git://github.com/mellon85/ruby-rtorrent.git</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/almostworkingcode.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/almostworkingcode.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/almostworkingcode.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/almostworkingcode.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/almostworkingcode.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/almostworkingcode.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/almostworkingcode.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/almostworkingcode.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/almostworkingcode.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/almostworkingcode.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=30&subd=almostworkingcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://almostworkingcode.wordpress.com/2008/09/27/ruby-rtorrent-controller/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a502a5d4f53ebb6f02a96e174332d60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mellon</media:title>
		</media:content>
	</item>
		<item>
		<title>mupnp updated</title>
		<link>http://almostworkingcode.wordpress.com/2008/09/22/mupnp-updated/</link>
		<comments>http://almostworkingcode.wordpress.com/2008/09/22/mupnp-updated/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 09:02:38 +0000</pubDate>
		<dc:creator>Dario Meloni</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[miniupnp]]></category>
		<category><![CDATA[mupnp]]></category>
		<category><![CDATA[upnp]]></category>

		<guid isPermaLink="false">http://almostworkingcode.wordpress.com/?p=33</guid>
		<description><![CDATA[mupnp has been updated to version 0.1.1.
The point is that i was experimenting problems with firehol firewall wich had UPnP ports enabled but I still wasn&#8217;t retriving any answer.
To fix this i had to hack a little on miniupnp library and finished searching when i found the TX_FROM_UPNP_PORT constant wich wasn&#8217;t set by default due to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=33&subd=almostworkingcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>mupnp has been updated to version 0.1.1.</p>
<p>The point is that i was experimenting problems with firehol firewall wich had UPnP ports enabled but I still wasn&#8217;t retriving any answer.</p>
<p>To fix this i had to hack a little on miniupnp library and finished searching when i found the TX_FROM_UPNP_PORT constant wich wasn&#8217;t set by default due to compatibility problems with Windows XP. I just made a slight change and converted it in a runtime check instead of a compile time one. This changed the C api of the library for the upnpDiscover function, and added a value to the initialization of the high level interface written to interface with the library which is automatically set to send data from the upnp port.</p>
<p>I have sent the patch to the mainstream developer, but it would require api changes and more modification to make it work correctly on the full fledged library.</p>
<p>With this last fix the rtorrent ruby controller is almost ready, i just have to comment the code and write a post about it</p>
<p>The gem is already available for upgrade on the rubyforge webstite or gem utility.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/almostworkingcode.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/almostworkingcode.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/almostworkingcode.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/almostworkingcode.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/almostworkingcode.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/almostworkingcode.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/almostworkingcode.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/almostworkingcode.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/almostworkingcode.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/almostworkingcode.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=33&subd=almostworkingcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://almostworkingcode.wordpress.com/2008/09/22/mupnp-updated/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a502a5d4f53ebb6f02a96e174332d60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mellon</media:title>
		</media:content>
	</item>
		<item>
		<title>UPnP Gem!</title>
		<link>http://almostworkingcode.wordpress.com/2008/07/01/upnp-gem/</link>
		<comments>http://almostworkingcode.wordpress.com/2008/07/01/upnp-gem/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 16:22:16 +0000</pubDate>
		<dc:creator>Dario Meloni</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[makefile]]></category>
		<category><![CDATA[mkmf]]></category>
		<category><![CDATA[mupnp]]></category>
		<category><![CDATA[upnp]]></category>

		<guid isPermaLink="false">http://almostworkingcode.wordpress.com/?p=25</guid>
		<description><![CDATA[I have just discovered the power of the mkmf package in Ruby.
It simplify the way to build the upnp module a lot!
I just had to move the files to be compiled in a folder (called miniupnpc) and then just call this

require 'mkmf'
create_makefile("MiniUPNP","miniupnpc")

And i&#8217;ll have a makefile ready to compile the module, no matter which is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=25&subd=almostworkingcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I have just discovered the power of the <code>mkmf</code> package in Ruby.<br />
It simplify the way to build the upnp module a lot!<br />
I just had to move the files to be compiled in a folder (called miniupnpc) and then just call this</p>
<pre>
require 'mkmf'
create_makefile("MiniUPNP","miniupnpc")
</pre>
<p>And i&#8217;ll have a makefile ready to compile the module, no matter which is you platform! With theis new knowledge and the immense usefulness of the ferret&#8217;s <code>Rakefile</code> i&#8217;have built and published a ruby gem that will install the UPnP module and the wrapper.</p>
<p>The name is simply <code>mupnp</code>. Installable with the gem utility. For windows the library must be precompiled, so it may not be immidiatly upated or released when needed.</p>
<p>There have been some API changes, to make it more ruby style, anyway it is nothing big, just check at the documentation of the methods and check for differences.<br />
[Only <em>addPortMapping</em> and the <em>initialize</em> method had a change in the order of the arguments]</p>
<p>To install it just do:</p>
<p><code>gem install mupnp</code></p>
<p>And it will be downloaded and compiled on your mac/linux box. For windows version i&#8217;ll have to find someone to trust that will build it for me.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/almostworkingcode.wordpress.com/25/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/almostworkingcode.wordpress.com/25/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/almostworkingcode.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/almostworkingcode.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/almostworkingcode.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/almostworkingcode.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/almostworkingcode.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/almostworkingcode.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/almostworkingcode.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/almostworkingcode.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/almostworkingcode.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/almostworkingcode.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=almostworkingcode.wordpress.com&blog=3928197&post=25&subd=almostworkingcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://almostworkingcode.wordpress.com/2008/07/01/upnp-gem/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a502a5d4f53ebb6f02a96e174332d60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mellon</media:title>
		</media:content>
	</item>
	</channel>
</rss>