rails environment with lighttpd

September 4th, 2007

We want an automated deployment enviroment. The server will automatically (upon restart) detect all the rails applications under a given folder and create virtual hosts for them. No further changes in the server configuration will be required. never. :)
Read the rest of this entry »

ruby Qt: model / view / controller

August 15th, 2007

From the wikipedia:

Model-view-controller (MVC) is an architectural pattern used in software engineering. In complex computer applications that present a large amount of data to the user, a developer often wishes to separate data (model) and user interface (view) concerns, so that changes to the user interface will not affect data handling, and that the data can be reorganized without changing the user interface.

MVC is not only useful for web frameworks and applications, here is a simple example of the implementation of the MVC pattern for a Qt GUI application.
Read the rest of this entry »

ruby bot: email processing

August 7th, 2007

Pinky: Gee, Brain, what are we going to do tonight?
Brain: The same thing we do every night, try to take over the world!

Have you ever wanted to have the ability to send commands to your box using email? Use RubyBot, the brand new plugin-driven ruby script that makes the task of taking over the world a bit easier!
Read the rest of this entry »

ruby Qt: menu bar, status bar and resources

July 31st, 2007

Menu and status bar are two elements that you expect to find in most applications out there. Menu bars are rich elements that consists of menu items and actions. Each action consists of a text and optionally a shortcut and an icon.
Read the rest of this entry »

ruby Qt custom widget example

June 4th, 2007

With Qt’s custom widgets you can create the building blocks of the GUI of your application.

In this case we are creating a graphical command line. The command line will consist mainly of a text input box (Qt::LineEdit). The widget will have memory, that is, every line entered by the user will be added to the internal history of the widget and will be accessible by means of Up and Down arrows as the standard *nix command line.

Read the rest of this entry »

ruby Qt::TreeWidget example

June 2nd, 2007

I am involved in some projects were we are using Qt library for GUI development with ruby. In the following example I will show how to use the Qt::TreeWidget object.

The TreeWidget can be used not only to display information hierarchically but also to add multiple columns to the data model.
Read the rest of this entry »

send files through email from the command line

December 20th, 2006

Every now and then I need to send by email some file to a friend or coworker or even myself. I have found that the easiest way to do this is just having a shell script that do the hard work for you.

After some research I found a set of scripts that actually do what I want (credit goes to Heiner Steven). The bad news is that this is not a full-bash solution. The scripts use the metasend command to send files as MIME atachments.

Read the rest of this entry »

runningserver: hello? anybody out there?

December 20th, 2006

I have created a small ruby script to check if there are running servers on a given port number. The script is able to check a list of hosts and will output an informational message on the port status for each host.

Let’s begin with the script. Then we can talk about the work it does.
Read the rest of this entry »

matar: bloodlust

December 15th, 2006

Here is a tiny script that can be usefull to terminate (kill -9) all the programs which contain a certain string (i.e.: kill all the running copies of ping).

#!/bin/bash

for foo in `ps aux | grep $1 | awk '{print $2}'`;  do kill -9 $foo; done

Just run: matar <program name> and that’s it. They are all gone.

icmp timestamps

December 14th, 2006

The Timestamp is an ICMP (rfc792) message which is used for time synchronization. The Timestamp Reply message consists of the originating timestamp sent by the sender of the Timestamp as well as a receive timestamp and a transmit timestamp.

If your machine answers ICMP Timestamp messages an attacker can learn the date which is set on your machine. This may help him to defeat all your time based authentication protocols.

Read the rest of this entry »