Posts

Showing posts from 2010

Deleting a exact line from a file without opening it

sed -i "23 d" file_name

Best way to get IE on ubuntu

I was doing web development(???) and I needed to check page on IE. so this is what I found out. sudo apt-get install wine sudo apt-get install cabextract wget http://www.tatanka.com.br/ies4linux/downloads/ies4linux-2.99.0.1.tar.gz tar xzvf ies4linux-2.99.0.1.tar.gz ./ies4linux-2.99.0.1/ies4linux ln /root/bin/ie6 /usr/bin/ie6 ie6 And nice IE for testing...

popup=popup, not popup=newtab

For some reason or other, Firefox does not have the option under the Tabs option items to “force links that open in new windows to open in:”. I have Firefox 2.0.0.7 now, and I don’t have that under Tabs options. But, if you open about:config in your address bar, you can change the setting manually. Change: browser.link.open_newwindow Mine was set to 3, which told the popups to always open in a new tab. I like that, mostly. But some web sites, TinyMCE editor in this case, like to open a popup and return you back the the original page. I keep losing that original popup. So I wanted to turn off my popup forced to new tab option. To make this behave normally, I set it to 2. All worked just peachy!

Disabling touchpad while typing

cat >> /etc/hal/fdi/policy/shmconfig.fdi <?xml version="1.0" encoding="UTF-8"?> <deviceinfo version="0.2"> <device> <match key="input.x11_driver" string="synaptics"> <merge key="input.x11_options.SHMConfig" type="string">True</merge> </match> </device> </deviceinfo> END In start-up programs, add command syndaemon -i 1 -d and reboot!!!

Listing files by decreasing directory size / space left

Nautilus doesn't give you total size of folder. It just gives the number files in the folder. If you want to see how is your disk being used, you can use du -s * | sort -k 1 -rn If you want to see hidden files, du -s .* | sort -k 1 -rn Unfortunately, I couldn't combine both of them and also couldn't use -h option of du If you want to see size of different partition, you can also use df -h

Removing ^M from end of the line in VI

To remove the ^M characters at the end of all lines in vi, use: :%s/^V^M//g The ^v is a CONTROL-V character and ^m is a CONTROL-M. When you type this, it will look like this: :%s/^M//g In UNIX, you can escape a control character by preceding it with a CONTROL-V. The :%s is a basic search and replace command in vi. It tells vi to replace the regular expression between the first and second slashes (^M) with the text between the second and third slashes (nothing in this case). The g at the end directs vi to search and replace globally (all occurrences).

Invisible plugin in pidgin

Want to become invisible in pidgin?? wget http://fahhem.com/pidgin/gtalkinvisible.tar.gz tar -vxf gtalkinvisible.tar.gz mv gtalkinvisible/gtalkinvisible.so ~/.purple/plugins/ rm -rf gtalkinvisible*

Changing base of a number

Suppose we want to convert 0xFACE into decimal value. echo "ibase=16; obase=A; FACE" | bc 'ibase' is input number base. 'obase' is output number base in ibase number.(10 is A in hexadecimal format). 'FACE' is the number. when we dont specify any of the value, its assumed to be 10.

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

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.

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.

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 folder="Dropbox/new_installation/wallpaper/mast/" rm -f ~/$folder/*.jpg limit=`wc -l 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 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 my_number=`expr $RANDOM % $limit`; na...