Archive for the ‘Tutorial’ Category
Creating Web Albums with gThumb
Posted by Éverton Arruda in Free Software, Linux, Planet INdT, Planet PSL-AM, Tutorial, Web on December 4th, 2009
If you want to create a web album with some images you have in your computer, with Linux as your OS, i recommend you to use gThumb.
gThumb is, as said in WikiPedia (http://en.wikipedia.org/wiki/GThumb):
… an open-source image viewer and organizer for the GNOME desktop environment released under the GNU General Public License. It was originally based on GQView, and is designed to have a clean, simple interface.
gThumb Homepage: http://gthumb.sourceforge.net/
INSTALLING GTHUMB:
I’m using Ubuntu 9.04, named Jaunty Jackalope, to write this tutorial, so the installation process is very simple, all you have to do is run:
1 | # aptitude install gthumb |
This should work the same way for Debian GNU/Linux, but if you’re using another distro Linux, you might have to compile gThumb.
CREATING WEB ALBUM:
When you run gThumb you’ll see this interface:
I mapped it to make it easier to follow:
The steps to create the Web Album are:
1 – Create directory to keep the images:
First create a directory and put the images you’d like to be in the album in it.
2 – Open directory with gThumb:
In gThumb interface, select the directory in which the images are (#1 in MAP)
3 – Select the images you’d like to show in the album:
After opening the directory, which contains the images, you’ll have to select the images you’d like to show in the album (#2 in MAP)
4 – Open the “Create Web Album” window and configure it:
Now, with all images selected, go to Tools > Create Web Album (#3 in MAP)
Then you should see a window like this:
![]()
This is where you’ll configure your web album. The options are:
#1 – Where the web album files will be saved.
#2 – The name of the page, i recommend you to leave it as it is.
#3 – How many images per line and per column will be shown.
#4 – The title of the page, or header message, if you preffer.
#5 – The footer message of the page.
#6 – The theme that will be used in the web album.
The other options are not so important for me, so i didn’t put them in here.
In the end, you’ll have something like this: http://am.softwarelivre.org/galeria/fedora12releaseparty/
:wq
IpForward from Computer with Linux to PS3
Posted by Éverton Arruda in Linux, Planet INdT, Planet PSL-AM, Tutorial on October 13th, 2009
I’ve recently bought my PlayStation 3 (FInaly!!!!!) and was thinking of a way to connect my PS3 to the internet using my 3G BroadBand internet connection, which is provided by the brazilian Phone Company Claro. The only thing that came to me was: IpForward.
So i did this:
1 – Connected my Notebook to the 3G Broadband:
Just connected as I normally do.
2 – Connected my PS3 to my Notebook:
Created a LAN between them, through my notebook’s interface eth0.
I configured my PS3’s network connection as follows:
In the PS3’s main menu go to Settings > Network Settings > Internet Connection Settings, then, go through this sequence of choices: custom, wired connection, auto-detect, manual (the ip settings are shown bellow), automatic, do not use (in my case i don’t use any proxy), enable.
The Ip Settings are:
Ip address: 192.168.0.2
Subnet mask: 255.255.255.0
Default Router: 192.168.0.1 (This is my Notebook’s Ip)
Primary DNS: 208.67.222.222 (This is Claro’s primary DNS Server)
Secondary DNS: 208.67.220.220 (This is Claro’s secondary DNS Server)
3 – Set Notebook to IpForward
I found a Script in the internet that does everything it needs to ipforward, all i did was add the final line, which sets a fixed ip to the interface that is connected to the LAN. I don’t remeber who wrote the script, but the credits are his/hers.
All you have to do now is save the script bellow and run it everytime you want to connect your PS3:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #!/bin/sh # Basic firewall and forward/masquerade setup PATH=/usr/sbin:/sbin:/bin:/usr/bin # Delete/Flush old iptables rules iptables -F iptables -t nat -F iptables -X # Set up IP FORWARDing and Masquerading iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE echo "1" > /proc/sys/net/ipv4/ip_forward ifconfig eth0 192.168.0.1 netmask 255.255.255.0 |
If you did as it is described in here, then it should work just fine.
Just for the record, I’m sing BrDesktop Lenny Linux as Operating System (a Debian Pure Blend).
Note: Everytime I try to test the connect through PS3, my notebook loses the ip 192.168.0.1 and starts o search for another one, breaking the connection between them. So i recommend you not to use that feature when using the connection method described in here.
:wq
Downloading files from Rapidshare through shell
Posted by Éverton Arruda in Free Software, Linux, Planet INdT, Planet PSL-AM, Tutorial on September 25th, 2009
I’ve seen, at Viva o Linux (http://www.vivaolinux.com.br, in portuguese), a post talking about a ShellScript that downloads files from RapidShare through shell. As, sometimes, i download files from that site, i decided to try it out and it worked fine for me.
This script uses wget to download the first html page, then it gets the link to the page that contains the link to the file, download this second page, checks the timer and waits for it to finish, after it finishes, the script starts the file download. I noticed that, if the download stops, this script continues from where it stopped.
This is how it goes:
1 – Download the ShellScript:
1 | $ wget http://tokland.googlecode.com/svn/trunk/rapidshare/rapidshare-dl.sh |
2 – Set execution permission:
1 | $ chmod +x rapidshare-dl.sh |
3 – Download File:
There are two ways you can do this:
Passing the link as an argument:
1 | $ ./rapidshare-dl.sh http://link.to.rapidshare |
You can also add more than one link:
1 | $ ./rapidshare-dl.sh http://link.to.rapidshare http://another.link.to.rapidshare |
Passing a text file as an argument:
Create a text file, named links.txt for example, and put each link in a different line, like:
1 2 3 | http://link1.to.rapidshare http://link2.to.rapidshare http://link3.to.rapidshare |
Then you run the script with the text file name as an argument:
1 | $ ./rapidshare-dl.sh links.txt |
You can create a link to the script in, or copy it to, the /usr/bin directory, making it executable from everywhere:
1 | # ln -s $PATH_TO_SCRIPT/rapidshare-dl.sh /usr/bin/rapidshare-dl |
1 | # cp rapidshare-dl.sh /usr/bin/rapidshare-dl |
NOTE: This script works only in Unix-like systems.
There is also plowshare, which is another shellscript that does the same thing, and more, but i haven’t tested it yet. In the project page it says that it supports Megaupload, Rapidshare, 2Shared, 4Shared, ZShare, Badongo, DepositFiles and Mediafire, and it also uploads files to those share sites.
PlowShare Page: http://code.google.com/p/plowshare/
Modem 3G Claro Huawei E226 no Debian Lenny/Ubuntu
Posted by Éverton Arruda in Linux, Planet INdT, Planet PSL-AM, Tutorial on July 28th, 2009

Comprei, recentemente, o modem 3G da Claro, fabricado pela Huawei, modelo E226, e infelizmente não consegui fazê-lo funcionar de cara no Debian Lenny, mas após alguns minutos de pesquisa a solução apareceu!
A solução que descreverei também funcionou do Ubuntu, nas versões Intrepid Ibex e no Jaunty Jackalope.
Você precisará do pacote wvdial, instale-o com o comando:
1 | # aptitude install wvdial |
Para saber mais detalhes sobre o pacote acesse este link: http://packages.debian.org/lenny/wvdial.
Após isso você deverá criar um arquivo de configuração para o wvdial, chamado wvdial.conf, com o seguinte conteúdo:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | [Dialer Defaults] Carrier Check = off Init1 = ATZ Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Password = claro Ask Password = 0 Check Def Route = 1 Phone = *99***1# Idle Seconds = 0 Modem Type = Analog Modem Stupid Mode = 1 Compuserve = 0 Baud = 460800 Auto DNS = off Dial Command = ATDT Modem = /dev/ttyUSB0 ISDN = 0 Username = claro [Dialer claro3g] Stupid Mode = on Password = claro Auto Reconnect = off Username = claro Phone = *99***1# |
conecte-se com o comando:
1 | # wvdial -C wvdial.conf |
E você estará conectado, mas ainda não será possível acessar qualquer endereço da internet, devido aos endereços dos servidores DNS estarem incorretos, então você deve adicionar as seguintes linhas ao arquivo /etc/resolv.conf:
1 2 | nameserver 208.67.222.222 nameserver 208.67.220.220 |
Agora você poderá acessar a internet normalmente.
No Ubuntu, a configuração foi mais fácil devido à versão do network-manager, ao conectar o modem ao computador, este foi reconhecido normalmente e um assistente de configuração foi aberto automaticamente. Tudo o que tive que fazer para acessar a internet foi adicionar as linhas acima no arquivo /etc/resolv.conf após estar conectado, e deve ser após estar conectado porque o network-manager sobrescreve o arquivo /etc/resolv.conf toda vez.
Você pode, também, adicionar os endereços dos servidores DNS nas configurações da conexão da Claro no network-manager fazendo o seguinte: Sistemas > Conexões de Rede > Banda Larga Móvel > Editar conexão da Claro > Configurações IPv4 e adicionar os IPs 208.67.222.222, 208.67.220.220 na linha dos Servidores DNS e aplicar as alterações, assim você não terá que adicionar aquelas linhas no /etc/resolv.conf toda vez que conectar.
:wq
VIM as a syntax highlighting pager
Posted by Éverton Arruda in Linux, Planet INdT, Tutorial on July 16th, 2009
I’ve been looking for a way to use less with syntax highlight and ended up in a page of Ubuntu Tutorials[0] website with a very good tip: Using VIM as a syntax highlighting pager[1].
All you’ll need is the package vim-full, só, in Debian-like systems, you’ll need to execute:
1 | # aptitude install vim-full |
Then, you’ll have to execute:
1 | $ vim -u /usr/share/vim/vim72/macros/less.vim <FILE> |
And you have it working!
NOTE: Depending on the version of your VIM, the path to less.vim might be different.
You can make this command simpler by creating an alias and adding it to your .bashrc file:
1 | $ echo "alias vless=\"vim -u /usr/share/vim/vim72/macros/less.vim\"" >> ~/.bashrc |
Now the system will need to re-read your .bashrc file, so the changes may be applied:
1 | $ . ~/.bashrc |
And after this you can test vless:
1 | $ vless <FILE> |
[0] http://ubuntu-tutorials.com
[1] http://ubuntu-tutorials.com/2008/07/14/use-vim-as-a-syntax-highlighting-pager/
:wq
Colored Man Pages
Posted by Éverton Arruda in Linux, Planet INdT, Tutorial on July 14th, 2009
I found an interesting tip about coloring man pages in Jônatas’ blog (http://tupinigeek.blogspot.com/2009/07/man-pages-coloridas.html <- in Portugese). This is how you do it:
1 – Install most (http://www.jedsoft.org/most/index.html):
You can download most here: ftp://space.mit.edu/pub/davis/most/
or by executing the line bellow in debian-like systems:
1 | # aptitude install most |
2 – Export MANPAGER variable:
After this you’ll have to execute the line bellow:
1 | $ export MANPAGER="/usr/bin/most -s" |
Now you should have your man pages like this:

If you don’t want to export that variable everytime you restart your computer, you can add that line to your .bashrc file:
1 | $ echo "export MANPAGER=\"/usr/bin/most -s\"" >> ~/.bashrc |
Qt Study
Posted by Éverton Arruda in Etc, Tutorial on May 16th, 2009

Soon I’ll be studying Qt, a cross-platform application and UI framework, owned by Nokia.
With Qt, you can write applications once and deploy them across many desktop and embedded operating systems without rewriting the source code.
Here is the source from where I’ll beggin my studies:
http://doc.trolltech.com/4.4/tutorials-tutorial.html
See more about Qt in http://www.qtsoftware.com/
:wq
Autocompletion on VIM
Posted by Éverton Arruda in Linux, Planet INdT, Tutorial on April 16th, 2009
Some time ago i read, in Renato Carvalho’s Blog (http://www.renatocarvalho.net/autocompletando-no-vim-dicionario-php.html), a post about autocompletion on VIM.
Autocompletion is a method which consists of completing a word when you write part of it, for example you write lin and press a key, on the keyboard, which is programmed to execute the autocompletion and it completes the word for you, giving you linux. For me it’s very useful.
If you want it too, all you have to do is:
1 – Create plugin and doc directories in ~/.vim:
1 | $ mkdir -p ~/.vim/doc ~/.vim/plugin |
2 – Download and install SuperTab plugin for VIM:
This plugin enables <tab> to be used for completion.
SuperTab Link: http://www.vim.org/scripts/script.php?script_id=1643
3 – Download functions list of a language and save it to ~/.vim/doc:
Using google you should be able to find the function list of a language.
For this tutorial i’ll use a PHP functions list, you can get it at: http://lerdorf.com/funclist.txt, save this file in ~/.vim/doc as php-funclist.txt
4 – Add a few lines inside /etc/vim/vimrc:
Edit /etc/vim/vimrc and add the following lines:
1 2 3 | if has("autocmd") autocmd FileType php set complete-=k/home/$USER/.vim/doc/php-funclist.txt complete+=k/home/$USER/.vim/doc/php-funclist.txt endif |
These lines tell VIM to read the php-funclist.txt file and load it for autocompletion.
You could use another language functions list, all you have to do is change the name of the functions list file from the lines above.
Now you can test it, open vim and write part of a php function, then press the <tab> key and see what happens.
This tutorial was written by Rodrigo Carvalho, i made some modifications and, with his permission, i posted here.
Creating a simple repository for .deb packages
Posted by Éverton Arruda in Linux, Planet INdT, Tutorial on April 15th, 2009
A few days ago i had to create an internal repository for some deb packages. As there weren’t so many packages, i didn’t need to create a huge repository, like the official ones, so, after a little research, i managed to get it working, and that is what i will explain here, how to create a simple repository for deb packages.
We’ll need this packages before we can continue:
- apt-utils
- dpkg-dev
In debian-like systems you can install it by executing:
1 | # aptitude install apt-utils dpkg-dev |
And now the steps:
1 – Select the directory in which the repository will be:
I recommend you to use a direcotory in /var/www , like /var/www/repository, making it possible for everyone to see and access it without the need change apache configurations, but for this you’ll have to have apache installed.
For this tutorial we will take /var/www/repository as our repository directory.
1 | # mkdir /var/www/repository |
2 – Move packages to the repository directory:
Move all deb packages you want to be in the repository to the repository directory, in our case: /var/www/repository.
1 | # mv *.deb /var/www/repository |
3 – Create index files (Packages and Sources):
These files tell apt wich packages are available in the repository, their version, author and other informations. These files must be in the repository directory.
To create them you’ll have to run:
1 2 3 4 | # dpkg-scanpackages /var/www/repository > /var/www/repository/Packages # dpkg-scansources /var/www/repository > /var/www/repository/Sources # dpkg-scanpackages /var/www/repository /dev/null | gzip -9c > /var/www/repository/Packages.gz # dpkg-scansources /var/www/repository /dev/null | gzip -9c > /var/www/repository/Sources.gz |
What there command do:
The first two commands scan the given directory for, repectively, .deb files and .dsc files and save their informations in, respectively, Packages and Sources.
The two last commands do the same thing, but instead of saving the files’ informations in a text file, it compresses the files’ informations and save it to a .gz file, which apt will also look for.
For more information about these commands check manpages for each one.
4 – Add repository uri to /var/apt/sources.list:
Now that you have a repository running you’ll, probably, want to access it, right?! To do that you’ll have to edit /etc/apt/sources.list .
If you want to access the repository from the same machine you’ll need to add the following lines:
1 2 3 4 | # For binary files repository: deb file:///var/www/ repository/ # For source files repository: deb-src file:///var/www/ repository/ |
If you want other machines to access it you’ll have to have those machines in the same network and add the following lines in their /var/apt/sources.list file:
1 2 3 4 | # For binary files repository: deb http://repository's.machine.ip/ repository/ # For source files repository: deb-src http://repository's.machine.ip/ repository/ |
5 – Check if the repository is up:
Now run:
1 | # aptitude update |
and see if everything is ok.
And that’s it, you should have your repository running.
TIP:
You can make a script to automatize the creation of index files, all you have to do is create a script in the /usr/bin/ directory and add the command lines for the dpkg-scanpackages and dpkg-scansources commands:
1 2 3 4 5 6 7 | # cd /usr/bin # echo "#!/bin/bash \ dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz \ dpkg-scansources . /dev/null | gzip -9c > Sources.gz \ dpkg-scanpackages . > Packages \ dpkg-scansources . > Sources" > createrepo # chmod +x createrepo |
The script above will scan for packages and source files in the directory it’s going to be executed and you’ll have to run it as root, you could add ’sudo’ before each dpkg-scan command so you could run it as a normal user, but it would ask you for the sudo password as well.
This tutorial was based on:
- http://ubuntuforums.org/showthread.php?t=42862
- http://www.debian.org/doc/manuals/repository-howto/repository-howto.en.html
:wq!




