I am an IT Engineer taking a PhD course at IST, Portugal. My interests in the IT field include Network Management, Project Management, Enterprise Architecture, Free Software and programming in general.
Just to laugh a little bit:
Netcat is an extremely useful and versatile command line tool which allows the reading and writing to network connections on either TCP or UDP protocols.
As is tradition with Unix tools, it has a very narrow functionality, but what it does, it does it well, and can be easily combined with other tools for very useful purposes.
Let's first create a very simple chat session:
On your server, say netcat to listen to port 6666
$> netcat -l -p 6666
On the client computer, connect to the server, and write "Hello"
$> netcat yourServerUrl.com 6666 Hello!!!
If all went ok, you should now receive the Hello message in the server.
Now for something more usefull, let's transfer a file between computers.
On your server:
$> cat someFile.tar | nc -l 6666
And receive the file on the client:
$> nc yourServerUrl.com 6666 > someFile.tar
All this has a big problem, all communication between the two computers is completly open, without any kind of encryption. Let's solve it:
Once again, on your server do:
$> cat someFile.tar | nc -l 6666
And receive the file on the server, but this time through an SSH tunnel:
$ ssh -f -L 9999:127.0.0.1:6666 username@youServerUrl.com sleep 10; \ nc 127.0.0.1 9999 > someFile.tar
Finally, to completely prove flexibility of netcat, let's use it as a port scanner:
$> nc -vz youServerUrl.com 20-25 yourServerUrl.com [1.1.1.1] 20 (www) open
Note: If in any of the previous commands, you want to use UDP, just add the "-u" flag.
This one is definitely one of the better Linux apps I have ever used (right after git, vim and zsh)
Aria2 is a small utility for downloading files through the most used protocols: HTTP(S), FTP and BitTorrent. It also supports Metalink, which is a standard for describing multiple locations/protocols to download a file.
As always in Debian related distributions, installation is as easy as:
$> sudo aptitude install aria2
Let's try it: download files from multiple sources and protocols. We are mixing ftp, http and bittorrent.
$> aria2c ftp://dl2.foss-id.web.id/iso/ubuntu/releases/8.10/ubuntu-8.10-desktop-i386.iso http://darkstar.ist.utl.pt/ubuntu/releases/current/ubuntu-8.10-desktop-i386.iso -T ubuntu-8.10-desktop-i386.iso.torrent
*** Download Progress Summary as of Sat Mar 14 08:50:29 2009 *** ======================================================================= [#1 SIZE:0B/698.8MiB(0%) CN:0 SPD:0.00KiB/s] FILE: ./ubuntu-8.10-desktop-i386.iso -----------------------------------------------------------------------
Aria2 is smart in the way it uses the multiple sources. It uses a slow server only when while it is beneficial to use it. If a small server has uploaded the rest of the file, the slower server will be swapped out in favor of the most rapid one.
Another Aria2 feature is the use of BitTorrent and Metalink checksums for verifying the various chunks of data.
Finally, Aria2 can also seed torrent files.
All this in a small application, with a very low memory footprint. Sounds cool doesn't it?
A long, long time ago I inquered how to show code on Drupal.
Long time after, I discover GeSHi Filter module. It provides a filter for source code syntax highlighting for a wide range of languages like C, C#, Java, Javascrip, List, Latex, Bash..... and the rest you can think of.
And if you use wordpress or joomla you can also use GeSHi. This is a great solution.
A simple example, calculating Pi in C:
while (!done) { if (myid == 0) { printf("Enter the number of intervals: (0 quits) "); scanf("%d",&n); } MPI_Bcast(&n, 1, MPI_INT, 0, MPI_COMM_WORLD); if (n == 0) break; h = 1.0 / (double) n; sum = 0.0; for (i = myid + 1; i <= n; i += numprocs) { x = h * ((double)i - 0.5); sum += 4.0 / (1.0 + x*x); } mypi = h * sum; MPI_Reduce(&mypi, &pi, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD); if (myid == 0) printf("pi is approximately %.16f, Error is %.16f\n", pi, fabs(pi - PI25DT)); } MPI_Finalize();

