Archive for September, 2010

watch command line utility for alternative for Mac OS X: (Solved by MacPorts)

Since I use all Apple Mac OS X as my primary desktop operating system of choice, I wrote a ruby script ago that mimics the GNU/Linux watch command on OS X a couple of months ago (watch.rb). Little that I knew that the watch package is available within MacPorts.

In short MacPorts is an free and open source package management system built into OS X. (Essentially the BSD UNIX port system). The awesome thing about MacPorts is that it lets you install traditional UNIX userland applications that are not included by default by OS X like wget, and watch.
http://www.macports.org

One of the best Documentaries I’ve ever seen…

What’s in my bookshelf?


I finally finished reading my first book on Ruby programming. Ruby: Visual QuickStart Guide, by Larry Ullman has to be the perfect introduction book for anyone trying to learn the Ruby programming language, even though sadly it only has 3 five star reviews on Amazon. The author writing thoroughly explains the concepts in a friendly and easy to understand manner. This being the third book that I’ve read from this same author, the other titles being for MySQL and PHP (no reviews on these yet since I’m not fully finished reading them).

One thing I would’ve like changed the author to change was on the database chapter, as it was mainly focused on SQLite. It would have been better if the author used MySQL instead. Also it would have been better if the author removed the dedicated chapter to Rails, and instead extended the chapter to have more generic web related like Net::HTTP, given how powerful that single class is.

Chapter 1: Getting Started
Chapter 2: Simple Scripts
Chapter 3: Simple Types
Chapter 4: Array, Ranges, and Hashes
Chapter 5: Control structures
Chapter 6: Creating Methods
Chapter 7: Creating Classes
Chapter 8: Inheritance and More
Chapter 9: Modules and Includes
Chapter 10: Regular Expressions
Chapter 11: Debugging and Error Handling
Chapter 12: Rubygems
Chapter 13: Directories and Files
Chapter 14: Databases
Chapter 15: Networking
Chapter 16: Ruby on Rails
Chapter 17: Dynamic Programing

I would highly recommended this book to anybody starting or wanting to learn Ruby.
Ruby-Visual-QuickStart
4/5

Encrypting files in Linux with mcrypt

By default Linux systems do not ship with the mcrypt utility. At least not CentOS or Ubuntu that is.

In Ubuntu installing mycrypt is just a matter of running the following command:
apt-get install mcrypt

In CentOS 5.5 mycrypt is not included in the distribution’s repositories because when I ran yum install mcrypt it installed the php-mcrypt packages along with the libmcrypt and libmcrypt-devel. But it didn’t actually included the actual mcrypt userland application. This meant I had to install the package from source. Installing mcrypt from source required an additional library called mhash to be installed. After that dependency was installed then it was just a matter of executing the following commands to install mcrypt:

./configure
make
make install

Once installed then, encrypting a file can be done with the following command:
mcrypt filetoencrypt

Mcrypt will prompt you for a secret keyphrase to use to decrypt the file.
Mcrypt creates the encrypted file with a .nc enxtension. To decrypt the file simply run the following command:
mcrypt -d filetoencrypt.nc

If you don’t want to specify your secret passphrase every time you encrypt/decrypt a file, you can create a user mcrypt config file on ~/.mcryptrc with the following contents in it:
key yourultrasecurepassphrasehere

http://sourceforge.net/projects/mcrypt/
Dependency:
http://mhash.sourceforge.net/