Thursday, September 03, 2009

How to resize or scale a list of images on linux

Here is a simple but powerful command when you got several images that you want to shrink:

mogrify -scale 50% *.jpg

This will reduce all the images by 50%

Or if you just want to reduce one image to 200x200 pixels for example:

convert -scale 200x200 image.jpg image_small.jpg

Friday, August 21, 2009

Installing virtualbox on Ubuntu 9.04

# virtualbox
WARNING: The character device /dev/vboxdrv does not exist.
Please install the virtualbox-ose-source package and the appropriate
headers, most likely linux-headers-generic.

You will not be able to start VMs until this problem is fixed.

root@ubuntu-laptop:/home/camafla# apt-get install linux-headers-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
The following NEW packages will be installed:
linux-headers-2.6.28-11-server linux-headers-server
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 672kB of archives.
After this operation, 8139kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 jaunty/main linux-headers-2.6.28-11-server 2.6.28-11.42 [669kB]
Get:2 jaunty/main linux-headers-server [3388B]
Fetched 672kB in 6s (104kB/s)
Selecting previously deselected package linux-headers-2.6.28-11-server.
(Reading database ... 157949 files and directories currently installed.)
Unpacking linux-headers-2.6.28-11-server (from .../linux-headers-2.6.28-11-server_2.6.28-11.42_i386.deb) ...
Selecting previously deselected package linux-headers-server.
Unpacking linux-headers-server (from .../linux-headers-server_2. ...
Setting up linux-headers-2.6.28-11-server (2.6.28-11.42) ...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/dkms
* Running DKMS auto installation service for kernel 2.6.28-11-server
* vboxdrv (2.1.4)... vboxdrv (2.1.4): Installing module.
[ OK ]
* vboxnetflt (2.1.4)... vboxnetflt (2.1.4): Installing module.
[ OK ]
run-parts: executing /etc/kernel/header_postinst.d/nvidia-common

Setting up linux-headers-server ( ...

Monday, June 08, 2009

LPI 102 exam reference card (or cheat sheet if you like)

I recently cleared the LPIC-1 certification (LPI certification Level 1) , as an educational exercise to study for my second exam (exam 102) I created a reference card that helped me remember some commands and key concepts for the exam.

I want to share this to anyone interested in taking this exam or just anyone who wants a quick linux reference card to the objectives included in the exam.


PNG version: lpi-102-reference-card-v1.png

PDF version: lpi-102-reference-card-v1.pdf

Wednesday, January 28, 2009

Installing Oracle OCI8 and PHP

I will describe here the steps I needed to install oracle connectivity for php. It's supposed you have php installed, in my case
I had php 5.1.6 throught RPM:

# rpm -qa | grep php


# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5 (Tikanga)

1. Download and install the Instant Client rpms from oracle which you can get here

This are the two files needed in my case:

# rpm -ivh oracle-instantclient11.1-basic-

# rpm -ivh oracle-instantclient11.1-devel-

2. Compile and install the oci8 extension:

Make sure you have the proper packages to compile a script like: php-devel, gcc,etc.

# pear install pecl/oci8

I used pear install pecl/oci8 instead of pear install oci8 because for some reason the second one returns an out of memory error and ignores the memory limit variable (memory_limit = XX ) from the
php.ini file.

When asked about this:

Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client : autodetect

If you have oracle installed in the same server just hit enter. If not (you just want to connect to another server) type:

instantclient and enter or the path to the oracle libraries e.g: /usr/lib/oracle/11.1/client64/lib/.

3. Finally, edit your php.ini file (/etc/php.ini) and add the in the Dynamic extensions section. Don't forget to restart apache so the changes take effect in apache.

Additional information can be found here: