Saturday, February 27, 2010

Linux or UNIX password protect files

Suppose you want to protect file pwd.txt

gpg -c pwd.txt

This will ask you to set new password and create a file called pwd.txt.gpg
Now you can delete pwd.txt.

If you want to retrieve pwd.txt, you can say

gpg pwd.txt.gpg

and it will ask you to enter password and create pwd.txt

Monday, February 22, 2010

Keep Firefox Open When Closing the Last Tab

The new Firefox 3.5 release brought a lot of great features, but one annoyance sent reader Mark looking for a solution: When you close the last tab, the browser closes instead of opening a blank tab.

Changing the behaviour back to the way it used to work is very simple: just type about:config into the address bar and find the browser.tabs.closeWindowWithLastTab entry in the list—using the filter makes it easy. Once you've found that key, double-click on it to change the value from true to false, and Firefox should no longer close when you close the last tab.

Sunday, February 21, 2010

Disabling selinux

Temporary disabling.

echo 0 >/selinux/enforce


Permanent disabling.

vim /etc/selinux/config

.. just change SELINUX=enforcing to SELINUX=disabled, and you're done.
Or we can also change /boot/grub/grub.conf.
On the kernel line of current distribution, add enforcing=0 at the end.

Tuesday, February 2, 2010

New wallpaper script

New wallpaper script. This had been on my mind for a long time. Using this we can change wallpaper any-time, unlike previous one in which we could change only once per day.


cat >> ~/Dropbox/new_installation/wallpaper/mast/wall.sh << END
folder="Dropbox/new_installation/wallpaper/mast/"
rm -f ~/$folder/*.jpg

limit=`wc -l < ~/$folder/list`
my_number=`expr $RANDOM % $limit`
name=`tail -n $my_number ~/$folder/list| head -n 1`

wget -O ~/$folder/pics_list http://www.wallpaperbox.com/Celebrities/$name/

limit=`wc -l < ~/$folder/pics_list`
limit=`expr $limit - 10`
limit=`expr $limit / 2`
my_number=`expr $RANDOM % $limit`
echo $my_number

wget -O ~/$folder/$name.jpg http://www.wallpaperbox.com/Celebrities/$name/$name-$my_number.JPG
gconftool-2 -t str --set /desktop/gnome/background/picture_filename ~/$folder/$name.jpg
END


and a bit improvised version of that is

#!/bin/bash
#folder=`pwd`;
folder="/root/Dropbox/new_installation/wallpaper/celeb";

cd $folder;
rm -f *.jpg;

limit=`wc -l < list`;
my_number=`expr $RANDOM % $limit`;
name=`tail -n $my_number list| head -n 1`;

wget -O pics_list http://www.wallpaperbox.com/Celebrities/$name/ ;

limit=`wc -l < pics_list`;
limit=`expr $limit - 10`;
limit=`expr $limit / 2`;
my_number=`expr $RANDOM % $limit`;

wget -O $name.jpg http://www.wallpaperbox.com/Celebrities/$name/$name-$my_number.JPG;
gconftool-2 -t str --set /desktop/gnome/background/picture_filename $folder/$name.jpg;