May 28, 2009
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’t sent over the VPN interface but only in the local LAN.
To solve this we just had to manipulate the routing table of the systems.
After connecting to the hamachi VPN just do these commands as root user
OS X: as long hamachi uses 5.x.x.x for his nodes
route add -net 255.255.255.255 5.255.255.255
Linux: where ham0 is the hamachi interface
route add -net 255.255.255.255 netmask 255.255.255.255 dev ham0
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
It seems to be working on gentoo (look at the comments)
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’t do anything else then disconnecting from the hamachi VPN, the system handles the disappareance of the interface removing every involved route.
Resuming*
| Game |
Linux |
MacOS |
| Warcraft 3 |
play |
host |
| Starcraft |
host |
host |
| Delta Force |
host |
untested |
* Linux has no other setup then just starting hamachi. This all was tested between a Mac and a Linux systems
If someone can test other games and maybe help on the linux problem that would be great.
Hope this helps!
[last update 10 August 2009]
10 Comments |
Posts | Tagged: broadcast, game, hamachi, lan, linux, mac, starcraft, udp, vpn, warcraft |
Permalink
Posted by Dario Meloni
May 25, 2009
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 xmlrpc gem which is on another post in
this blog).
It supports authentication and accesses rtorrent through the unix socket
interface, allowing to run the server as a user process.
An internal copy of the information from rtorrent is stored in a
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
along with the caching of pages in ramaze.
Currently may lack some feature, but it’s doing it’s job, the main
missing feature is the user interface. If someone can write a
CSS and maybe do some cleanup in the interface any help would be
appreciated.
As usual in the code page everything can be found or directly here
git://github.com/mellon85/rtorrent-wrb.git
Leave a Comment » |
Posts, Ruby, Script | Tagged: gem, rpc, rtorrent, Ruby, socket, unix |
Permalink
Posted by Dario Meloni
May 17, 2009
This little ruby script can download a whole anime serie from lolipower.org, when the anime page respects the “standards”. 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 line arguments, the first and last episode to download.
You can find the link to the project in the code page or just here
git://github.com/alka/down-lolipower.git
1 Comment |
Ruby, Script | Tagged: download, gem, hash, http, md5, Ruby |
Permalink
Posted by alkawiz
February 3, 2009
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’t want (or you forgot).
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.
You you don’t keep a port the program will continue asking on the packets dependencies if they aren’t already locked for another port.
When done the list of “keep” packet will be saved in /opt/local/var/portsfoster as simple text with one package for line. You can delete or add manually if you need to.
Don’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…
You can find the link to the project in the code page or just here
git://github.com/mellon85/portsfoster.git
P.s.
Dont worry if the pogram reports that information about a port can’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.
If you have a old installation of macports (say, older then this post at least) you may receive the warning on the render port. Just uninstall it, it is no more in the tree.
Leave a Comment » |
Posts | Tagged: clean, debfoster, dependencies, deps, macports, port, portfile, Ruby |
Permalink
Posted by Dario Meloni
January 19, 2009
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’ve got 2.7GB of data for 16661 images (the number tell me something about of what i have done).
Here’s the code
#! /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 << Thread.current
}
download(x)}
}
while (threads.length != urls.length) do
Thread.pass
sleep(5)
end
threads.each{ |x|
begin
x.join
rescue Exception => e
end }
puts "finished"
2 Comments |
Ruby | Tagged: 4chan, download, http, image, net, page, Ruby |
Permalink
Posted by Dario Meloni
January 4, 2009
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’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 little fixes to the controller and a new feature.
Now the available upload bandwidth is decreased by a fraction of the actual rtorrent download speed.
This is done to prevent even further to rtorrent to make itself slower flooding the upload bandwidth with ack packets.
Leave a Comment » |
Ruby | Tagged: rtorrent, Ruby, upnp |
Permalink
Posted by Dario Meloni
September 27, 2008
Finnaly i had time to work on the rtorrent controller.
it works, that’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 clear in the comments but i’ll try to add more comments anyway when i have time.
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.
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 monit to monitor my own servers and it’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.
You can find the link to the project in the code page or just here
git://github.com/mellon85/ruby-rtorrent.git
1 Comment |
Ruby | Tagged: bandwidth, download, rtorrent, Ruby, upload, upnp |
Permalink
Posted by Dario Meloni
September 22, 2008
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’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’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.
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.
With this last fix the rtorrent ruby controller is almost ready, i just have to comment the code and write a post about it
The gem is already available for upgrade on the rubyforge webstite or gem utility.
6 Comments |
Ruby | Tagged: gem, miniupnp, mupnp, Ruby, upnp |
Permalink
Posted by Dario Meloni
July 1, 2008
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’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’s Rakefile i’have built and published a ruby gem that will install the UPnP module and the wrapper.
The name is simply mupnp. Installable with the gem utility. For windows the library must be precompiled, so it may not be immidiatly upated or released when needed.
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.
[Only addPortMapping and the initialize method had a change in the order of the arguments]
To install it just do:
gem install mupnp
And it will be downloaded and compiled on your mac/linux box. For windows version i’ll have to find someone to trust that will build it for me.
2 Comments |
Ruby | Tagged: gem, makefile, mkmf, mupnp, Ruby, upnp |
Permalink
Posted by Dario Meloni
June 26, 2008
I have just published on rubyforge the gem for my xmlrpc modifications.
It’s called xmlrpcs and contains the class discussed in the previous post.
xmlrpcs Rubyforge homepage
Online RDoc
The changes are that now it has full rdoc comments and the path to include it is ‘xmlrpc/xmlrpcs’
I would like to relase my upnp binding as a gem too, but that will come later.
To install it just do
gem install xmlrpcs
and it’s done
Leave a Comment » |
Ruby | Tagged: gem, rpc, Ruby, rubyforge, socket, xml |
Permalink
Posted by Dario Meloni