Saturday, July 2, 2011

Simple Hacks for windows using regedit

Following is a list of some interesting restrictions, which can be made in Windows 2000, XP, 2003, Vista, 2008 and 7. Like you can restrict Display properties, task bar properties, folder options, etc. All tricks are based on Registry editing. So I'll tell the key name and the value, that you have to create for the restriction. If the key is not present, then simply create it.

1.) Restrict Display Properties:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\System
create DWORD value NoDispCPL and set its value to 1

2.) Restrict Taskbar Properties:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value NoSetTaskbar and set its value to 1

3.) Restrict Folder Options:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value NoFolderOptions and set its value to 1

4.) Restrict Locking/Unlocking the taskbar:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value LockTaskbar and set its value to 1

5.) Restrict Active Desktop:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value NoActiveDesktop and set its value to 1

6.) Restrict adding/deleting items from Toolbars:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value NoToolbarCustomize and set its value to 1

7.) Restrict adding/deleting toolbars:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value NoBandCustomize and set its value to 1

8.) Restrict right-click in Start Menu:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value NoChangeStartMenu and set its value to 1

9.) Restrict Desktop Cleanup Wizard:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value No Desktop Clean up Wizard and set its value to 1

10.) Restrict notification at low disk space:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value No Low Disk Space Checks and set its value to 1

11.) Restrict Taskbar Context Menu:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value No Tray Context Menu and set its value to 1

12.) Restrict Programs to run:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer\DisallowRun
create String value with any name, like 1 and set its value to the program's EXE file.
e.g., If you want to restrict msconfig, then create a String value 1 and set its value to msconfig.exe. If you want to restrict more programs, then simply create more String values with names 2, 3 and so on and set their values to the program's exe.

13.) Restrict Registry Editor:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\System
create DWORD value Disable Registry Tools and set its value to 1

14.) Restrict Task Manager:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\System
create DWORD value Disable TaskMgr and set its value to 1

15.) Restrict Writing to USB Drives:
HKEY_LOCAL_MACHINE\SYSTEM\Current Control Set\ ControlSet \Control\ Storage Device Policies
Create DWORD value Write Protect and set its value to 1

16.) Restrict New option in context menu:
HKEY_CLASSES_ROOT\Directory\Background\ shellex\ Context Menu Handlers\New
And delete the value of Default, e.g., empty it.

17.) Restrict Send To in context menu:
HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenu Handlers\Send To
And delete the value of Default, e.g., empty it.

18.) Restrict Balloon Tips:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Explorer\Advanced
Create DWORD value EnableBalloonTips and set its value to 0

19.) Restrict Users to enable New XP StartMenu:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
Create DWORD value No Simple Start Menu and set its value to 1

20.) Restrict Command Prompt:
HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System
Create DWORD value Disable CMD and set its value to 2

21.) Restrict Drives in My Computer:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
In right-side pane, create a new DWORD value No View On Drive and change its value as following:

3 : To Restrict A and B drives only.
4 : To Restrict C drive only.
7 : To Restrict A, B, and C drives only.
8 : To Restrict D drive only.
F : To Restrict A, B, C, and D drives only.
03FFFFFF : To Restrict all drives.

And if you want more specific restrictions, like you want to restrict a combination of other drives, then you can use decimal no. instead of hexadecimal no. Following is a list for all drives decimal no.:

A: 1
B: 2
C: 4
D: 8
E: 16
F: 32
G: 64
H: 128
I: 256
J: 512
K: 1024
L: 2048
M: 4096
N: 8192
O: 16384
P: 32768
Q: 65536
R: 131072
S: 262144
T: 524288
U: 1048576
V: 2097152
W: 4194304
X: 8388608
Y: 16777216
Z: 33554432
ALL: 67108863

So if you want to disable a combination of drives, just sum their numbers and give the same value to NoViewOnDrive. e.g., for restricting C, D, E and F drives, give the value: 4+8+16+32 = 60
NOTE: You can also hide the drives using No Drives DWORD value. The location and its value remain same as the above trick.

22.) Restrict RUN in New XP Start Menu:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
Create DWORD value No Run and set its value to 1

23.) Restrict Control Panel:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
Create DWORD value No Control Panel and set its value to 1

NOTE: If you want to remove the restriction, then simply delete the DWORD value or set its value to 0
So, that's some simple hacks that you can try to fight the battle against any virus, worms, trojan horse, malware or spyware or even your naive system admin :P Have fun :) .

Thursday, June 23, 2011

Fun with SAPI

Following vb script pronounces what you write- I tried on my win7 box and I thought it's fun to get started with SAPI. Write the code on Notepad and save the file with extension .vbs.

Then clicking the vb script file will show you the following window - write what you want to listen on the text box and press ok, did you hear that ? :P

I have some more idea based on it; do you ? Will share once I can create some more fun with it :)

Resources for Face Detection

I always had some interest in working with faces :B - yeah face detection and recognition. following is a list I have found once on the internet; thought might be helpful for me someday when I'll get some time to work with seriously :S.
Face detection (or more generally Image Matching resources):
AForge.net
Facedectection in C# with less than 50 LoC
http://friism.com/facedectection-in-c-with-less-than-50-loc
Face Detection in (pure) C#
http://askernest.com/archive/2008/05/03/face-detection-in-c.aspx
Easy to use Wrapper (DLL) for Intel’s OpenCV Library with Examples
http://www.codeproject.com/KB/cs/Intel_OpenCV.aspx
OpenCV (Open Source Computer Vision) for C#
http://coolthingoftheday.blogspot.com/2008/08/opencv-open-source-computer-vision-for.html
OpenCVDotNet
http://code.google.com/p/opencvdotnet/
Emgu CV
http://www.emgu.com/wiki/index.php/Main_Page
SharperCV Project
http://www.cs.ru.ac.za/research/groups/SharperCV/
[C#] OpenCV
http://www.dotblogs.com.tw/chou/archive/2009/06/13/8812.aspx
Webcam in C#: with OpenCVDotNet
http://haryoktav.wordpress.com/2008/12/12/webcam-in-c/
OpenCV / SURF How to generate a image hash / fingerprint / signature out of the descriptors?
http://stackoverflow.com/questions/2146542/opencv-surf-how-to-generate-a-image-hash-fingerprint-signature-out-of-the-d
Face Detection and Identification
http://www.emgu.com/forum/viewtopic.php?f=7&t=11&start=10
Phase Correlation in OpenCV
http://nashruddin.com/phase-correlation-function-in-opencv.html
SURF and OpenSURF
http://amitsarangi.wordpress.com/tag/opencv-features/

A proprietary tool but had a lot of fun with the following tool:
http://www.luxand.com/


Wednesday, June 8, 2011

Free hosting and services for Node.js

If you wanna start playing with Node.js the best way I think is burning a box with Ubuntu or CentOS and start with installing and creating simple hello world  servers. But if the box is instantly not available to you and you are dieing of testing (!! or tasting !!) this incredible technology (it is already being called the future of web !!) then there are some good folks who have come up with the solutions where you can experiment with your thirst for Node.js.
As I always try to check how it works first - instead
of starting from the root of it - I was looking for free
hosting that comes up with Node.js already built in and easy-to-utilize. Here I am going to share the list of them and my experience and/or what others think of them :
  • Nodester : Fair enough. Just registered will update the review soon. Ref link : http://nodester.com/
  • Nodejitsu. :(Seems the folks are fond of Martial Arts :P ) Still not open for public. Request only. I have requested for a Coupon- don get the response yet- but seems good enough. Ref link : http://nodejitsu.com/
  • Joyent Node: I kinda like there url : http://no.de. Just requested for a coupon and waiting for the response. will update with my experience soon.

Monday, May 30, 2011

Playing with Node.js

I was watching a lot of noises speaking high about an incredible technology - a server framework : Node.js.
I was looking for a chance to play with it and this is what I was doing for the last two hours :
Installing Node.js on CentOS box :
1. You will need gc++ if you wanna compile from the source ; so if you don have it just do :
yum install gc-c++
2. You will need python; if you don have it already just do :
yum install python
3. Now download the Node.js source available as tarball from the website : Node.js.
4. Extract the tarball, cd within the directory and sequncially do the following :
./configure
make
make install
5. Hurrah, most possibly you are done ;) You wanna check ? just do :
node --version
possibly you are seeing the installed node version :)

On the next post I will try to create couple of example apps to play even more with Node.js.So, Stay tuned :P

Wednesday, April 6, 2011

Installing ffmpeg and other extensions and tools to use with php

Installing FFMpeg
yum install ffmpeg ffmpeg-devel
If you get package not found, then you will need to add few lines in the yum repository for dag packages installation. Create a file named dag.repo in /etc/yum.repos.d with the following contents on it
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
then
yum install ffmpeg ffmpeg-devel
If everything is fine, then the installation should proceed smoothly. If not you will get something like warning GPG public key missing .


Common Errors

To fix rpmforge GPG key warning:
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
For more information refer to this faq depending on Centos version
Missing Dependency Error:
If you get missing dependency error like shown below, in the middle of ffmpeg installation
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package ffmpeg
Error: Missing Dependency: libtheora.so.0(libtheora.so.1.0) is needed by package ffmpeg
Error: Missing Dependency: rtld(GNU_HASH) is needed by package ffmpeg
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package a52dec
Error: Missing Dependency: rtld(GNU_HASH) is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package gsm
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package x264
Error: Missing Dependency: rtld(GNU_HASH) is needed by package xvidcore
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package lame
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package a52dec
Error: Missing Dependency: rtld(GNU_HASH) is needed by package faad2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package x264
Error: Missing Dependency: rtld(GNU_HASH) is needed by package lame
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package xvidcore
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package faac
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package faad2
Error: Missing Dependency: libgif.so.4 is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package faac
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package gsm
Error: Missing Dependency: libpng12.so.0(PNG12_0) is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package libmp4v2
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package libmp4v2
then most commonly you have GLIB 2.3 installed instead of GLIB 2.4 version. To check the current GLIB version installed on your server. just use
yum list glib*
and it should list the latest GLIB package version.

The reason i was getting this error was my rpmforge packages was pointed to centos 5 versions instead of centos 4.6.


To fix dependency error:

To fix this error, you might need to check your rpmforge packages compatible to the release of your existing CentOS version.
Check the file /etc/yum.repos.d/rpmforge.repo and it should look like for Centos 4.6(Final). If you have lines like http://apt.sw.be/redhat/el5/en/mirrors-rpmforge you might need to make changes to therpmforge.repos like shown below

Note: Backup the original rpmforge.repo file before you edit its content.
[rpmforge]
name = Red Hat Enterprise $releasever - RPMforge.net - dag
#baseurl = http://apt.sw.be/redhat/el4/en/$basearch/dag
mirrorlist = http://apt.sw.be/redhat/el4/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
To know what linux type and version you are running
cat /etc/redhat-release
Once this is done, do again yum install ffmpeg.
This trick resolved the problem in my linux box running Centos 4.6 and this is the only way i found to install ffmpeg using yum.
To check the FFmpeg working:

Finally, check the ffmpeg whether it is working or not.
ffmpeg
ffmpeg -formats
ffmpeg --help
// This lists path of mpeg, its modules and other path information
ffmpeg -i Input.file Output.file
To check what audi/video formats are supported
ffmpeg -formats > ffmpeg-format.txt
Open the ffmpeg-formats.txt to see the output
D means decode
E means encode
V means video
A means audio
T = Truncated


Install FFMPEG-PHP Extension
FFmpeg-php is a very good extension and wrapper for PHP which can pull useful information about video through API interface. Inorder to install it you will need to download the source file and then compile and install extension in your server. You can download the source tarball : http://ffmpeg-php.sourceforge.net/
wget /path/to/this/file/ffmpeg-php-0.6.0.tbz2
tar -xjf ffmpeg-0.6.0.tbz2
phpize
./configure
make
make install
Common Errors

1. If you get command not found error for phpize, then you will need to do yum install php-devel
2. If you get error like "ffmpeg headers not found" while configuring the source.
configure: error: ffmpeg headers not found. Make sure ffmpeg is compiled as shared libraries using the --enable-shared option
then it means you have not installed ffmpeg-devel packages.
To Fix: Just install ffmpeg-devel using
yum install ffmpeg-devel
3. If you get an error like shared libraries not found problem and the program halts in the middle, then you must specify the ffmpeg installed path explicitly to the ./configure.
configure: error: ffmpeg shared libraries not found. Make sure ffmpeg is compiled as shared libraries using the --enable-shared option
To Fix:
1. First find out the ffmpeg path with ffmpeg --help command. The prefix default path should be like /usr/local/cpffmpeg
2. Configure the FFmpeg-php with --with-ffmpeg option
./configure --with-ffmpeg=/usr/local/cpffmpeg
That should resolve the problem!


Issue that I faced while installing the ffmpeg-php of version 0.6.0 :
/tmp/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zim_ffmpeg_frame_toGDImage’:
/tmp/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: ‘PIX_FMT_RGBA32’ undeclared (first use in this function)
/tmp/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once
/tmp/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.)
/tmp/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zim_ffmpeg_frame_ffmpeg_frame’:
/tmp/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: ‘PIX_FMT_RGBA32’ undeclared (first use in this function)
make: *** [ffmpeg_frame.lo] Erreur 1
Fix to this issue :
Just open the ffmpeg_frame.c file and replace the PIX_FMT_RGBA32 with PIX_FMT_RGB32. With vi you can do it as :
vi ffmpeg_frame.c
:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32
:w
However I just opened it on a text editor on my windows and applied find and replace ;)
After the replacement is done you have surely you have to do the configure and make and make install as :
phpize
./configure
make
make install
[before performing a make this time it is recommended you do a make clean]

Editing php.ini
Once you have done that without any problems then you will see the php extension file /usr/lib/php/modules/ffmpeg.so and you will need mention that extension in php.ini file
vi /etc//php.ini
Put the below two lines at the end of the php.ini file
[ffmpeg]
extension=ffmpeg.so
Then restart the server service httpd restart. In my case I had a server from godaddy and I had to do the following to restart the webserver :
/usr/sbin/apachectl graceful
To check whether ffmpeg enabled with php, point your browser to test.php file. It should show the confirmation of installed ffmpeg php extension
// #test.php
          phpinfo()
?>
This is what you are suppose to get :
If any case the ffmpeg does not show in the phpinfo() test make sure that php.ini path to ffmpeg.so is correct. Still the problem occurs, the reason could be you might be using older versions of ffmpeg-php which is buggy. Just download the latest version of ffmpeg-php source then compile it.
Installing Mplayer + Mencoder
To know more about Mplayer
Just issue the following yum commands to install the rest of the packages.
yum install mplayer mencoder
Installing FlvTool2
Flvtool2 is a flash video file manipulation tool. It can calculate metadata and can cut and edit cue points for flv files.
If you are on Centos 5 try yum install flvtool2 [worked fine with me] with dag repository and if you get package not found you will need to manually download and compile the flvtool2. You can download latest version of flvtool2 here: http://rubyforge.org/projects/flvtool2/
wget
ruby setup.rb config
ruby setup.rb setup
sudo ruby setup.rb install
If you get command not found error, it probably means that you dont have ruby installed.
yum install ruby
Thats it! Once ffmpeg works fine with php extension, download a sample video, convert to .flv format in the command line and plug it to flowplayer to see it work on your web browser. Try also to download the video file offline and see whether the converted flv file works well with both audio and video.
Now following is how you might wanna play with this beautiful tool/toolset :
This is how ffmpeg actually works :

Here is a some tutorials to play with ffmepg.

http://www.phpro.org/tutorials/Video-Conversion-With-FFMPEG.html

Reference :

Wednesday, March 30, 2011

Konami Code : Fun way to show up some secret information (!!)

"The Konami Code, known in Japan as the Konami Command(コナミコマンド Konami Komando), is a cheat code that appears in many Konami video games, although the code also appears in some non-Konami games."
To get more information you can check the best of the bests information source wikipedia pages. And to get more interested seeing who else on the web are utilizing this fun way to publish (!!) information please visit : http://konamicodesites.com/ [you have to try the Konami Code to get the list though :| ]
I thought why not I secretly embed my information into whatever I develop. So there came the jQuery solution for it. I basically merged two of the plugins from jQuery.
There are a number of Konami code plugins online - you can grab any of them - But make sure that the one you are trying works for all browser [the browser compatibility as they say :P I found couple of them not compatible to some browsers] . Following are couple of them that you can check :
And then to show up the information nicely I have plugged in the jQuery notification plugin jNotify
BTW, I'm gonna submit my code soon [sorry I don have a clean copy of my work right now :S] Till then stay tuned and help thyself :P

iGoogle like interface using CodeIgniter and jQuery

iGoogle-like Interface

I was asked to develop an interface that would look like iGoogle webtop. And as always do I instantly started googling and this post is the result of what I got and what I lastly went for.
I googled and I got some solutions already there :
  1. Picok : Which I got hectic to configure and modify [as I was in hurry I din check it very well thought but I think it has some potential]
  2. jPolite : I loved this solution but thought might be little tricky to implement the back end.I strongly suggest if you have some time please look at this solution.
But finally I actually decided to go with a simpler solution starting from an interface developed utilizing jQuery and creating a Codeigniter back end for it.
How to create the UI, you will get the complete article from net.tuts+  . However, to get the Codeigniter version you can download it from the following location. I am telling you the implementation is not a rocket science so far, but I have a plan to extend it and may be will create a complete opensource project some day.
Till then wait or Download and start one by yourself :)
Please comment some other opensource reference if you got any. 

Thursday, January 20, 2011

How to deploy DKIM email authentication in 4 steps

DKIM is an emerging e-mail authentication standard supported by Yahoo, Google and others ISPs, as well as a growing number of Email Service Providers that was developed by the Internet Engineering Task Force. DKIM allows an organization to cryptographically sign outgoing e-mail to verify that it sent the message. Deploying DKIM for your company is pretty straightforward. If you are managing all of your own email servers and outbound email, including sales, marketing and transactional emails, there are 4 steps. If you are using an ESP there are 2 very simple steps that take about 10 minutes. Here’s the rundown.
DKIM provides email authentication and often complements Email authorization. Email authorization is implemented using 'Sender Policy Framework' ("SPF") and/or SenderID. I'll explain how to configure SenderID/SPF in a related posting.
Configuring DKIM (Companies Managing their Own MTAs)
If you are hosting your own email servers, your company needs to take these 4 steps to deploy the emerging DomainKeys Identified Mail (DKIM) standard:
Step #1:
Figure out all the domains that are allowed to send outbound mail on its behalf. Often this includes multiple corporate domains as well as third-party e-mail Service Providers (like Pinpointe). This is often the hardest step - especially for large organizations.
Step #2:
Next you’ll use an online wizard to create the DKIM public / private key pairing and the policy record. The ‘public’ key is a key that will be placed in your public-facing DNS record along with what’s called a ‘policy record’.
The ‘private’ key is a long key that is installed on the MTA/Email sending system(s). When you send an email, the outgoing email server (or the outgoing server of your Email Service Provider, such as Pinpointe), adds the
Here are two online wizards you can use to create the public/private key pair and the policy record. You just enter your sending domain and a ’selector’ - which is kind of like a password key (if you use an ESP - the ESP does all this for you):
http://www.socketlabs.com/services/dkwiz
http://www.port25.com/support/support_dkwz.php
Step #3:
Create DNS text records that include DKIM information for every domain that is used to send e-mail. These records will be inserted in your public facing DNS record for each sending domain. If you don’t know how to insert / modify your DNS entry, you can find a description in our description of setting up an SPF record - the process is pretty much the same:
http://www.pinpointe.com/blog/install-an-spf-record-to-improve-email-delivery
Step #4:
Upgrade your emails servers and/or software to support DKIM. (Note - In the Email world, Email servers are often called “message transfer agents” or “MTAs”).” MTAs are the last component of a messaging system to touch outbound e-mail. That’s where DKIM signatures are attached.

Steps to Implement DKIM With an Email Service Provider :
If you are using an ESP, the process is trivial:

Step #1 - Ensure you have access to your domain’s DNS Entry (see step #2 above)
Step #2 - Call your ESP. Your ISP can provide you the key information and policy entries for your DNS entry.

Sunday, January 16, 2011

Running CodeIgniter from shell on Cronjobs

I am actually tuklifying from the CodeIgniter wiki - just adding my experience - things I faced and solution to the issue.
Steps :
1.Make a directory for your cron scripts. I just used scripts and put it in the same directory that my CI system folder is in.
2. Copy the index.php file from your DOCUMENT_ROOT (the script that normally initiates a connection to CI from a web browser) to the scripts directory, and rename it to something meaningful, such as mailsender.php.
3. Add the following line at the very first line of the mailsender.php:
#!/usr/local/bin/php -q
4. Edit this file and make some slight adjustments. First, we don’t want the script to timeout during execution, so somewhere toward the top we add:
set_time_limit(0);
5. Set the path to the system folder, if it isn’t correct:
$system_folder = "../system";
6. We need to let CI know what controller/method we want to access, and any other URI variables we need. Normally this happens in the URL, so we emulate it by setting PATH_INFO manually:

$_SERVER['PATH_INFO'] = '/mailprocessor/sendmail';
$_GET = ''; // Required for some installations
However, if the config uri protocol is set to REQUEST_URI, then CI doesn’t use PATH_INFO, so instead, emulate REQUEST_URI manually:

$_SERVER['REQUEST_URI'] = '/mailprocessor/sendmail';
7. You create a mailprocessor.php controller (in the application/controllers dir) with a sendmail method, and make it do what it needs to do, load libraries/models/etc, execute them, then exit. What you don’t want to happen is output anything. Just make sure you don’t echo any content to stdout (echo, loading views, etc.) If you are sending emails, you would load a view file, but return the contents to a variable instead of displaying it (pass true as third param), then run through normal procedures for sending emails.
One thing to be aware of regarding security, you probably don’t want anyone accessing /mailprocessor/sendmail from a web browser[In my case I don put the scripts on the web directory- so no need to worry about ], so in the mailprocessor.php controller constructor, you may want to do some kind of check to make sure we are coming from a cron script. Probably the easiest method would be to test the SCRIPT_FILENAME variable:

if($_SERVER['SCRIPT_FILENAME'] != 'mailsender.php')
  exit; 
8.Once everything looks good, add your crontab entry to execute the script, and there you have it! Sample cronjob [from cPanel  can easy do that- you just need to put the script location to run]:
# execute cronjob every day at 2am
00 02 * * * /HOME/myusername/misc/scripts/mailsender.php
My addition : 
8. You need to edit the BASEPATH on the mailsender.php.  You need to put the absolute path instead of relative path.


Original post - You will get some other alternative ways to do the things :)
Update-05/16/2011: On version 2, CodeIgniter has implemented a feature to run sccript from CLI. :)