Google offers free Mysql database

Search engine is very powerful tool but not just for search but also for beginner hacking. Some mysqladmin web tools are indexed with google which make them available for search. By searching with keywords:

“phpMyAdmin” “running on” inurl:”main.php” site:com

“phpMyAdmin” “running on” inurl:”main.php” site:org
or
“phpMyAdmin” “running on” inurl:”main.php” site:net
etc.

we can get a results for all google indexed mysqladmin. Since not all of them are secured by the password you can get lucky and find some which are free to use.

Display date-clock with simple bash command and while loop

Here is a simple example on how to display date/watch with simple bash command:

$ while true; do clear; date; sleep 1; done

List only hidden files with ls command

We all know how to list non-hidden and hidden files with ls command on shell. However I could not find out how to list only hidden files ( starting with “.” ) with only ls command. One, but not complete solution could by to using TAB key. For example ls . and pressing 2xTAB will display only hidden files. It seem that we need to call for help grep command:

ls -a mydir/ | grep '^\.'

If anyone knows how to do this trick with only ls command please let me know.

Extract STDERR and redirect STDOUT to /dev/null with bash

I always keep forgetting this bash syntax redirection. This is because of my short memory and also because I do not use it often. In many cases we need to remove a STDERR from the command output and keep only STDOUT. On the other hand there are times that we want to see STDERR and remove STDOUT.  Here is how to do it:

$ BASH-COMMAND 2>&1 > /dev/null

Lost screen resolution after restart with ubuntu and nvidia

I have been using my current kubuntu installation for many months already and I never had a problem with my nvidia driver settings except today. From no apparent reason I have started my linux box and my default and maximum resolution was 1024×768 instead my standard 1680×1050. I have tried reinstall envy packages, doing dpkg-reconfigure xserver-xorg and nothing helped.

Only what helped what that I manually configured xorg.conf file and changed from:

SubSection "Display"
Depth 24
EndSubSection

to:

SubSection "Display"
Depth 24
Modes "1680x1050"
EndSubSection

This solution is still mistery to me. May someone know the answer to this riddle please let me know.

System: Kubuntu Hardy, Nvidia 8800 Ultra

Recreating z25_persistent-net.rules file manually on debian

If from some reason you need to recreate networking udev z25 rules file you would use the following cammed to achieve that:

/lib/udev/write_net_rules all_interfaces

this will recreate a z25_persistent-net.rules and include all interfaces.

List all files and directories recursively but do not include full path

ls -R will list all files recursively. The output of such a command will produce a output containing not only a files but also full path the the each file or directory. One way to clean this output is to use grep and invert selection with -v option. Each path from ls -R command contains “:” symbol and we can use grep command to invert selection based on “:” :

ls -R | grep -v :

this will list all files and directories only. However output will still produce a empty lines. This can be again removed by -v where we invert selection and remove all empty lines ^$

ls -R | grep -v | grep -v ^$

invalid byte sequence for encoding “UTF8″: 0×8b – storing binary data

This error message took me lots of effort and time to solve it. The problem is that before storing binary data strings in the postgresql database the binary strings need to be escaped before storing them. There is on the google available subroutine for per which is doing this job. It is called escape_bytea. Anyway here is a whole script on how to store and retrieve binary data with perl form PostgreSQL database.

the other solution which a have not tried yet is to encode them with
Base64 Encoder Decoder
http://perldoc.perl.org/MIME/Base64.html

vim – vi text editor tutorial

Here is a very nice vim / vi text editor tutorial for beginnes as well as for more advanced users. Its very easy to follow as it has flash video attached to every section. vi editor tutorial

Create and install linux debian package for missing perl module with dh-make-perl

Sometimes you encounter situation when you need a perl module to support your program but perl module is not available from standard linux repositories. Installing perl module from source code is not always good idea so what would be the best is to create package for a particular module using dh-make-perl command. In my case I was missing a poerl module Linux::Usermod and here is what I did:

apt-get install dh-make-perl

dh-make-perl –build –cpan Linux::Usermod

You will need to answer some simple questions if you are running cpan for a first time. At the end dh-make-perl will spit out a debian package and in my case it was: liblinux-usermod-perl_0.69-1_all.deb. All I need to do now is to just use dpkg to install this package:

dpkg -i liblinux-usermod-perl_0.69-1_all.deb

This is nice and clen way of dealing with missing perl packages since its also easy to uninstall it once its not needed.