Sunday, December 31, 2006

Create your own Pixel Button - No image editing required!!

Do you want a cool pixel button for your blog or website? Don't know how to handle image editing softwares such as GIMP/Photoshop? Or perhaps just plain lazy to create your own manually? If yes, this site can help you. It automatically generate a pixel button based on the spec you gave to the generator. Its easy and simple. They even gave away its sourcecode!.

This StumbleUpon button,

was created using the tool. (I couldn't find one that matches my taste from the official site, so I brew it myself)

Saturday, December 30, 2006

Using Tsocks to tranparently use SOCKS proxies in applications

There are not many applications out there supports SOCKS proxy for traffics. Usually people will try to find similar application that have SOCKS support if they need it. To Linux/BSD users, there is a dirty trick to do make virtually any console and some X applications to use SOCKS proxy transparently by preloading certain libraries before executing the application. One of those libraries is Tsocks.

Step 1 : Installing
Simply extract the tarball, then, use the magic spell everyone familiar with to install it.
 ./configure
make
sudo make install

Afterwards, create a config file named tsocks.conf in /etc/ . Refer the examples given together with the source tarball for guidance on how to write the config. For those who just want a quick and basic config and lazy to open the examples, I've provided it below.

# This is the configuration for libtsocks (transparent socks)
# Lines beginning with # and blank lines are ignored
#
# This sample configuration shows the simplest (and most common) use of
# tsocks. This is a basic LAN, this machine can access anything on the
# local ethernet (192.168.0.*) but anything else has to use the SOCKS version
# 4 server on the firewall. Further details can be found in the man pages,
# tsocks(8) and tsocks.conf(5) and a more complex example is presented in
# tsocks.conf.complex.example

# We can access 192.168.0.* directly
local = 192.168.0.0/255.255.255.0

# Otherwise we use the server
server = 192.168.0.1


Step 2 : Using the library
To make an application to use tsocks, using a terminal, simply do this
export LD_PRELOAD=/lib/libtsocks.so
before executing the application from the terminal. Note that environment variable export only works on the terminal which you export the value.

Alternatives of Tsocks
Transconnect - A HTTP Proxying library similar to Tsocks.
Proxychains - A similar library which supports both HTTP and SOCKS. Also, its able to chain multiple proxies at once.

Friday, December 29, 2006

HOWTO: Building an X-less Azureus Dedicated Box using Fedora

Do you have an old unused box sitting still in the storage without nothing useful to do with it?. Are you a heavy torrent'er? Are you tired of torrent (especially Azureus) eating up your personal computer resources and makes everything goes slow?. This Howto will guide you in converting that unused box of your into something useful - An advanced dedicated Azureus torrent box controlled through SSH and web-based interface!!.

First and foremost, there are a few issues I would like to highlight.
- This guide is not targeted for a total newbie, however, I wont stop newbies to try it. Its a good learning experience
- Azureus requires Java, and Java eats resources more. So, you'll need a box with around 200Mhz processor with more than 128MB RAM
- The webUI of Azureus is a simple UI for starting/stopping downloads and uploading .torrent files, we will depend mostly on the TelnetUI for adjusting configurations
- Don't use the java that provided together with Fedora (GCJ) , because it eats more system resources. Use Sun's JRE.
- English is not my first language. Pardon me if theres mistakes all over the place.

I believe some of you have heard about Torrentflux web based torrent client. Why I didn't choose it for this guide? Well, my answer is, Torrentflux is not advanced enough. One of its major disadvantage is the unavailability of encryption. At my place, the largest and cheapest ISP which monopolize the market shape torrent traffic. Therefore, I needed the encryption support for my torrents.

Now, lets start hackin'

Step 1 : Installing The OS
Firstly of course, we need to install the OS. In this case, Fedora. The main point here is to install Fedora with the least packages, and without the Xserver. You also need to do some proper partitioning of the harddisk to give space for your downloads. My suggestion of a partitioning scheme is like this

2-4GB partition for /
A swap partition (people usually suggest the swap size is 2*(your RAM) and no bigger than 1GB)
A partition as big as you can for /mnt/torrentdownload/

During the package selection, unselect GNOME, KDE, X11, and anything related to GUI. SSH server is a must, don't unselect it. crond is aslo needed. To save you from future trouble and for future customization, I recommend installing the development packages and text-based internet applications.

Set up the networking and allow SSH through the firewall. I would also recommend disabling SElinux because it might sometimes causes weird errors with some applications (If you're sure what you're doing, its okay to enable it). And lets assume the computer thats going to become the dedicated box is using IP 192.168.1.2

After installation and reboot, you'll be greeted with a terminal login screen. Login as root and proceed to next step. You can also login remotely through SSH (or for windows users - puTTY)

Step 2 : Installing Sun JRE and Azureus

As I was saying, the GCJ eats resources a lot (at least that what I experienced with it). So, you will need to install Sun's JRE. Install the Sun JRE following this FedoraSolved guide.

Now is to install Azureus. There exist a package for Azureus in Fedora Extras, but I personaly prefer installing from the official Azureus tarball from Azureus's website. So, I'll will guide through its installation and setting up based on the Azureus tarball. You can just simply
yum install azureus
but you might need to modify some of the steps below in order to make it to work for this purpose.

First, create a new user with the name "azureus" and set a password for the user.
adduser azureus
passwd azureus
Switch to the user
su - azureus

From a different computer, get the latest Azureus linux tarball here. SCP it to the box using the scp command (assuming you download the tarball in the home folder)
scp ~/Azureus_2.5.0.0_linux.tar.bz2 azureus@192.168.1.2:/home/azureus/

For Windows user, you can copy the tarball to the box using WinSCP

Back to the box. Untar the azureus tarball and change into the directory
cd /home/azureus/ #just in case
tar xvf Azureus_2.5.0.0_linux.tar.bz2
cd azureus

Back to the different computer, goto this page and download commons-cli.jar and log4j.jar. Those two files are required for console/telnet UI to work. Then, SCP it into the extracted azureus folder.
scp ~/commons-cli.jar ~/log4j.jar azureus@192.168.1.2:/home/azureus/azureus/


To the box again, create a file named azureus.pl and a file named start_daemon.sh in /home/azureus/azureus/ . The content of the files are
===== azureus.pl =====
#!/usr/bin/perl
# http://www.azureuswiki.com/index.php/DaemonizedAzureus

use POSIX 'setsid';
open STDIN, "/dev/null";
open STDOUT,">/dev/null";
open STDERR,">/dev/null";
exit if fork > 0;
setsid;
exec("java -jar Azureus2.jar --ui=telnet");



==== start_daemon.sh ====
#!/bin/bash
# this script will check whether azureus is running
# or not and start it if it doesnt

UP=`ps ax|grep Azureus|grep -v "grep " -c`
if [ "$UP" == "0" ];then
cd /home/azureus/azureus
./azureus.pl
fi


Set execute permission for both scripts
 chmod +x azureus.pl start_daemon.sh

Now , technically, Azureus have been installed and can be run directly by executing the start_daemon.sh. You can test whether it has run or not by
telnet localhost 57006
to enter the telnetUI. Type "help" in the telnet session for help on how to use the telnetUI. For starter, lets set the default download path and the listening port for Azureus using the telnetUI.
set General_sDefaultSave_Directory /mnt/torrentdownload/
set Core_iTCPListenPort 31234
set UDP.Listen.Port 31234


Exit the telnetUI by typing "logout". Kill the azureus process for now. 
kill `ps ax|grep Azureus2|grep -v "grep"|awk '{print $1}'`


Now, get the AzhtmlUI plugin from here and SCP it to the box.
 scp ~/azhtmlwebui_0.7.2.jar azureus@192.168.1.2:/home/azureus/ 


Create a directory named azhtmlwebui in the plugins directory and move the plugin file there.
mkdir -p /home/azureus/azureus/plugins/azhtmlwebui
mv ~/azhtmlwebui_0.7.2.jar /home/azureus/azureus/plugins/azhtmlwebui/
lets disable firewall for now to test the htmlUI
 su -c '/sbin/service iptables stop' 


Now run azureus and from a different computer , open a web browser and test the htmlUI by opening http://192.168.1.2:6886 . If the htmlUI running, you have successfully installed azureus. And don't forget to chmod /mnt/torrentdownload/ to 755 to allow users to write into it.
 chmod 755 /mnt/torrentdownload/


Finally, is to set a the cronjob for checking whether azureus is running or not and start it if it doesn't. The technique is simple. Just run
 cron -e 
and add this line into the cron task list
 * * * * * /home/azureus/azureus/start_daemon.sh 
Some of you might be asking why I didn't use an init script for this?. My reason is, if just somehow azureus crashed, it will be restarted automatically.

Alternative to set the configs
Some people might sees Azureus is pretty hard to be set through telnetUI. You can, as an alternative, use Xnest to run a remote X server and let Azureus' GUI rendered there.

Install Xnest in a computer that have X installed, disable firewall for a while and start it using
 Xnest -ac :1 

Then, at the Xless box, export the DISPLAY variable pointing to the remote Xnest in this case, we assume the IP is 192.168.1.3
export DISPLAY=192.168.1.3:1.0

Start Azureus by executing the provided azureus startup script from the tarball and the display will be redirected to the remote Xnest. You can set the options easier this way.

Step 3 (optional): Set Apache to host the downloaded files through HTTP

This step is easy if you only want to host the files. Install apache by running this command
 yum install httpd 
or installing it beforehand during the OS installation.

Then, create a symlink in /var/www/html/ that points to /mnt/torrentdownload/
 cd /var/www/html/
ln -s /mnt/torrentdownload/ files

Start apache by running
/sbin/service httpd start

You can set apache to start on boot by running
chkconfig httpd on

If everything is done correctly, you can enter the directory listing by pointing your web browser to http://192.168.1.2/files/

Step 4 (optional): Set up apache mod_proxy to open the htmlUI through apache

You might want to redirect the AzhtmlUI to be displayed at http://192.168.1.2/azureus/ . It is easy to do that using Apache. Edit your /etc/httpd/conf/httpd.conf and add these lines at the end of the config
ProxyRequests Off

ProxyPass /azureus/ http://127.0.0.1:6886/
ProxyPassReverse /azureus/ http://127.0.0.1:6886/

Restart apache and you're done. However, this method have a little bug. You MUST add the trailing slash at the end to enter the redirected page. http://192.168.1.2/azureus will not work properly but http://192.168.1.2/azureus/ will.

Step 5: Firewall
Last by not least, the firewall. You can choose to disable firewall altogether if you want. But to those paranoids, you might want to turn it on.

You can set your firewall using system-config-securitylevel or using Webmin. For the hardcores, you can edit the firewall script directly at /etc/sysconfig/iptables . I'm not going to cover about setting up the firewall here, it might make this article too long. Basically, allow port 80/TCP, 22/TCP, and 31234(your azureus port)/TCP+UDP .

For those who uses a router, goto PortForward.com for guide on how to forward TCP/UDP ports for your router.

Finish

Your dedicated Azureus box is now up and running. This box, besides for torrenting, you can also modify it to provide other services, eg: file hosting, media server, etc. Let your imagination go wild and enjoy~

If any of you spotted any mistakes in the HOWTO, please inform me and I'll fix it.

Wednesday, December 27, 2006

Earthquake at Taiwan : Internet in Malaysia and several south east asia countries down

The recent Richter 7.1 earthquake in Taiwan have caused a submarine cable fault between Shantou, China and Tanshui, Taiwan and between Lantau, Hong Kong and Chongming, China. This occurrence have severely damage communication between several south-east asian countries - including Malaysia - and Taiwan, Japan, Korea, and United States.

you can read the announcement from TMnet here .
And the news from niser here

I noticed the connection became alarmingly unstable early this morning. At first I thought it was a problem within the country until one of my friend in Terengganu pm'ed me and saying the same connection instability happened there. Then I checked the TM website and saw the earthquake announcement.

The connection was severely unstable during the morning, and gladly its becoming better as time goes. However, connections frequently timed out and interrupted a lot of my downloads and website loads.

I hope this situation will be fixed by the time I'm back at college. If not, Its gonna be a disaster. The internet connection there is not stable to begin with. Its like having this type of earthquake a few times a week.

Tuesday, December 26, 2006

Psalms of Planets : Eureka Seven

I just finished watching this Eureka Seven this afternoon ( yup, I'm kindof late) , and it was GREAT!. The series was a little bit slow in the beginning , but as the series develop , I grew to love this anime. The storytelling , the character development , everything, was done greatly if not perfect. The series gets interesting by each passing episodes of a total of 50 episodes.

The story is about a boy, Renton Thurston, who lives with his grandfather Axel Thurston in a city called Bellforest, until one day, a mecha , piloted by a mysterious girl, crashed onto his house. Starting from that day, his life changed and he set on an adventure with the girl, Eureka and a group of ex-military renegades The GekkoState. The story revolves around his relationship with Eureka , the conflict between the GekkoState and the Federation , and the mystery of the Coralians.

The storyline have plenty of high-flying mecha battles, confusing yet interesting scifi element, heart-touching conflicts, and love theme. After you finished watching the last episode, you'll end up having a very mixed emotions. The last time I felt like this was after the end of Sailormoon Season 1 (which I watched less than a year ago, considering that I'm into anime just recently, other sailormoon seasons is not as good as season 1), FateStayNight, and ShakuganNoShana (yup, 3 times in less than 6 months. I was marathoning animes which i've just downloaded).It makes depressed(because it ended)+happy(the ending is so happy)+craving for more. And now i'm in a state of withdrawal because of that. I just downloaded a different anime but I simply couldn't watch it. I WANT MORE EUREKA7!!

I noticed that this anime is not quite widespread in Malaysia. Anime lovers in Malaysia who havent watched this. Get it while there are still people seeding it. A good anime like this comes once in a blue moon and I really recommended everyone who loves anime to watch it or you'll regret it.

I'm not really good in writing reviews about TVseries of movie so I leave you all with the wikipedia entry of the anime. I need to find a way to get out of this withdrawal syndrom.

http://en.wikipedia.org/wiki/Eureka_Seven - Warning! A lot of Spoilers




Don't beg for it,
Go for it,
Do that and you'll get it.

Monday, December 25, 2006

Lolifox - Firefox for anime lovers

Yeah2, i know, the name sounds kindof erotic. But well, its their rights to put that name isn't it?. I got to know about this browser from a post at our new UTP-OSS Google Group so i decided to try it.

A visit to lolifox's site is a little bit of a disappointment. There are no screenies .. me wanna see screenies .. haha .. frankly, screenshot is one of the most effective way to bring people to use gui based apps .. Also, there a very little information about what are the uniqueness of this firefox fork/mod besides having some large collections of anime bookmarks and a modified interface for ftp/gopher browsing..

I downloaded the linux version of the browser to give it a try, there are no rpm/dep packages, the binaries is only compressed in a tarball - like hows firefox is packaged. Okay, this is a small matter, its not going to become a system's web browser anyway.

These are the screenshots from my first run of the browser. Nothing much impressive, it looks 90% like the vanilla firefox2.0. The most notable change is the ftp/gopher interface and the preview when you pointed at the tab ( i think this is just an extension that being coded into the browser directly )







IMHO, unless you want that good looking ftp/gopher interface , I think this mod can still be achieved by using the vanilla firefox browser. However, it is still too early to judge it, because currently its only version 0.3 . Perhaps in the future it will improve. I'll be looking forward for more improvement by the team. Until then, I'll stick with my current sleek FF2.

Getting Flash Player 9 BETA

If any of you are still sticking with the old Flash Player 7 , I think it almost time to upgrade yourself now. Flash Player 9 BETA for linux have been released for quite a while already, and they also have released a standalone player for it.

The installation step is simple .. just go to http://labs.adobe.com/downloads/flashplayer9.html and download the tarball .. extract it .. and copy libflashplayer.so to ~/.mozilla/plugins .. restart your browser and ure done ..

I know .. its sumthing that a little bit too easy for those geeks out there (its clearly stated in the readme on how to do it) .. I'm kindof out of idea on what to write though .. *sigh*

Saturday, December 23, 2006

New Official Fedora LiveCD Released!!

I came upon to this post while reading through Fedora People - An Official FC6 LiveCD!!!
Read the announcement here

Friday, December 22, 2006

Automatic Firefox Update in Linux

I guess everyone noticed that Firefox in Linux does not auto update using its update engine, and you'll need to use yum, apt, emerge, etc to update it. This is due to the reason that firefox from distribution packages is made to be installed into as read-only to the users. You can *fix* this problem by installing firefox into your home folder. By doing this, it allows firefox to be overwritten and make the update work. It worked for my Firefox2 on FC6.

You can read my guide in installing apps in your home folder here

as for me , I install firefox in ~/local/opt/firefox2 and a symlink to the firefox startup script in ~/local/bin

Btw, if you are using a compositing manager (eg. compiz/beryl ), you might need to add these two lines into the firefox startup script - right after the GPL notice - to keep firefox from crashing when opening sites with Adobe Flash
XLIB_SKIP_ARGB_VISUALS=1
export XLIB_SKIP_ARGB_VISUALS


G'luck and enjoy~ :)

Thursday, December 21, 2006

HOWTO: An organized way to install programs @ your home folder

Installing stuff in linux usually requires root access .. this is true especially when the program which you want to install is a later version that the one that already installed in the system ..

As for some people, they might not want to pollute their RPM/DEB/put-a-packaging-system-here installations with installation from source tarballs and making the system hard to maintain using their distribution's package tools

However, it is not impossible for users to seamlessly install/upgrade programs into their own home folder, leaving the main system untouch .. you only need the program's source code , a compiler , and the development libraries ...

NOTE: This method may work with most programs out there that uses the ./configure script, however, some applications might refuse to work in this environment.

NOTE2: This article is targeted to people who already know their way when using linux. Its not targeted to newbies. However, I wont stop newbies from trying this. Its a good learning experience ;-)

NOTE3: I will not be responsible to whatever damage it might cost you .. Try it at your own risk .. However, I dont think this will damage the whole system because u only work in your home folder without using root .. Normally if you do messed up, you'll only make the user unusable, just delete the user and create a new one.



Preparation

Before starting to install any programs using this method, we'll need to modify some PATH settings first.

First create these folders in your home folder : ~/bin , ~/local/ , ~/local/bin , ~/local/sbin , ~/local/etc , ~/local/opt , ~/local/lib , ~/local/share , ~/local/var ; These folders will be where you install your compiled programs

Then, open ~/.bash_profile and change this line (or similar)

PATH=$PATH:$HOME/bin

into this

PATH=$HOME/bin:$HOME/local/bin:$PATH

This will make the installed programs in your home folder have higher priority when executing it without full path.

Logoff and relogin for the settings to take effect.

Now we are done with the preparation, lets proceed in the method to install programs into your home folder

Compiling and Installing

Untar the source packages into somewhere you like ( I usually untar it in ~/local/src/build/ ). Change directory into the folder and run

./configure --prefix=$HOME/local/
make
make install

This will work with programs that uses the usual procedure of this method. Some might requires some extra stuff to be done first before make. Basically , the most important part here is the --prefix=$HOME/local/

After installation, try executing the command and check whether it works or not. For example, if you compile a new nmap, run

which nmap

if the output is ~/local/bin/nmap , congratulations, you succeeded XD .

If it works, you're done. And If not, you might have done something that made it doesn't work and good luck finding it ;-P

NOTE: Some programs might need you to export LD_LIBRARY_PATH=$HOME/local/lib before executing the program

How about packages that comes in a standalone tarballs? Eg. Azureus

Simple, just extract the tarball into ~/local/opt/ and create a symlink in ~/local/bin to the program's executables. And you're done.

You can also create a folder ~/local/opt/bin for symlinks related to ~/local/opt programs. Just make sure you add $HOME/local/opt/bin into the PATH declaration in ~/.bash_profile

Conclusion

Linux is a very flexible environment and a very fun one if you know how to use and manipulate it. Enjoy~~ (^-^)

Wednesday, December 20, 2006

Blogger BETA is now officially Blogger

I just noticed this today in the Blogger frontpage

The new version of Blogger in beta is dead!
Long live the new version of Blogger!

To see whats new in the new Blogger engine -> Click Here

Tuesday, December 19, 2006

Starting service after the login screen is loaded

GDM early login have been mising from Fedora for quite a while now .. I kindof missed it because it makes Fedora "appears" booting up faster ..

Being impatient, (and bored), an idea came out to my mind to do a script that might give similar function to GDM early login .. but with a little bit twist -> instead of we make the GDM start earlier, why dont we make the services start later? ... and so, postinit script was born ... Its juz a simple shell script that allow users to define what services they want to start later after GDM is loaded ..

These are the script , I packaged it for Fedora Core 6, other distros may use it , but it might require some tweaking in the code.

postinit-1.0-1.src.rpm
postinit-1.0-1.noarch.rpm

Usage:
postinit add [servicename]
- This adds a service into the postinit list
postinit del [servicename]
- This removes a service from the postinit list
postinit list
- This shows what services is set to be run using postinit

Note: postinit doesnt remove a service from the chkconfig, you'll need to remove it yourself using chkconfig or system-config-services.

configuration -> /etc/postinit.conf ... its just the entry for the sleep duration before starting the services and the entry to deny any services from being started using postinit.