Blogs

Rob Costlow - Baby Girl Part 2

Rob Costlow album art

Here's a short, but very nice piano piece from Rob Costlow's "Reconstruction" album...

Song: Rob Costlow - Baby Girl Part 2 (2:18 min, 1.2 MB)
License: CC-by-nc-sa 1.0
Source: magnatune.com
Purchase from: Magnatune

How to run 65535 web servers on a single laptop

OK, so here's what crazy computer geeks come up with when they're bored of just sitting in the subway and staring out of the window.

Web servers usually run on port 80. TCP/UDP ports range from 1 to 65535 (port 0 is reserved). You can run multiple web servers on different ports at the same time... Do you think what I think?

Well, first you need a web server (duh). I decided to use lighttpd, as it's said to be small and memory-efficient (which sounded pretty important given what I was trying to do). Apache would probably not be a good choice here. Mind you, I have not done any benchmarks at all, I'm just guessing...

  $ apt-get install lighttpd

Then, I wrote a little shell script containing a loop, which invoked lighttpd on port 1, 2, 3, 4, ..., 65535. That's it ;)

  #!/bin/bash
  TMPDIR=/tmp
  CONFFILE="server.document-root       = \"/var/www/\"
           index-file.names           = ( \"index.html\" )"
  for ((i = 1; i < 300; i = i + 1)) do
    echo "+++ Starting web server on port $i"
    echo $CONFFILE > $TMPDIR/lighttpd.conf
    echo "server.port = $i" >> $TMPDIR/lighttpd.conf
    /usr/sbin/lighttpd -f $TMPDIR/lighttpd.conf
    rm -f $TMPDIR/lighttpd.conf
  done 

I'm sure this can be optimized a lot, but it's sufficient for now, and it works.

You can test any of the web servers by running "wget http://localhost:3556/" (for example). You can kill them all with killall lighttpd. If you already run some other daemons on some ports, you cannot start a lighttpd on the same port, so you'll end up with fewer than 65535 servers.

In case you try this on your hardware, make sure you have lots of RAM and lots of swap. Don't run this on production hardware. Feel free to post your experiences in the comments.

Anamar - Pais oceano

Anamar album art

I'm back. Yes, really. With new music. This time from Sao Lourenco, Portugal... Enjoy!

Song: Anamar - Pais oceano (3:24 min, 1.8 MB)
License: CC-by-nc-sa 1.0
Source: magnatune.com
Purchase from: Magnatune

How to find copies or modified versions of your photos online, e.g. using TinEye

Sugar

I found out about TinEye a few minutes ago. It's a nice little search engine which allows you to find exact copies of a photo or even similar versions of it. You can either upload an image for comparison with their database, or point TinEye to a URL of the image you want to check.

For instance, checkout this this search for my unreasonably popular "Sugar" photo. Or have a look at this list of sample searches.

The site is also used in Wikipedia for detecting the original source of uploaded images.

I know there is some other website which also allows similarity search of images, but I just can't remember the URL. Please leave a comment if you know of other such sites, thanks!

Scott Altham - Hear Us Now (poptastic mix)

Scott Altham album art

After a long pause in this podcast, let me continue with more great music, this time from Scott Altham — a very nice ambient/chillout tune...

Song: Scott Altham - Hear Us Now (poptastic mix) (4:49 min, 8.9 MB)
License: CC-by-nc 3.0
Source: ccmixter.org
Purchase from: ?

Syndicate content