Thursday, January 27, 2011

How to change or modify the openSuse 11.3 KDE4 "My Computer" sysinfo window background color to match your desktop theme color

Sometimes you change your Desktop background image and change the theme to your favorite eye candy style. But "My Computer" stays the same old green color.

The images for the KDE4 sysinfo "My Computer" are stored at
/usr/share/kde4/apps/sysinfo/about/images


-rw-r--r-- 1 root root 2.5K 2008-06-19 11:01 sysinfo.png
-rw-r--r-- 1 root root 4.0K 2008-06-19 11:01 network.png
-rw-r--r-- 1 root root 4.1K 2008-06-19 11:01 mem.png
-rw-r--r-- 1 root root 3.1K 2008-06-19 11:01 launch.png
-rw-r--r-- 1 root root 5.8K 2008-06-19 11:01 inner-bcg.png
-rw-r--r-- 1 root root 2.9K 2008-06-19 11:01 hdds.png
-rw-r--r-- 1 root root  773 2008-06-19 11:01 hdd.png
-rw-r--r-- 1 root root 1.1K 2008-06-19 11:01 dirs.png
-rw-r--r-- 1 root root 2.7K 2008-06-19 11:01 cpu.png
-rw-r--r-- 1 root root 3.7K 2008-11-11 08:11 display.png
-rw-r--r-- 1 root root 591K 2010-07-05 19:05 background.png






1. Make a backup copy of the images, 'background.png' and 'inner-bcg.png'
2. Open them with Gimp > Colorize > Change to your favorite color
3. Replace the original
4. Now open My Computer from Desktop and you should see the new colors.


Right click on "My Computer" and 'open with' > kwrite... You must see a lot of information now on the XML page
/usr/share/kde4/apps/sysinfo/about/my-computer.html

This html page has more details to explore

Friday, January 14, 2011

Helpful commands for Linux cluster job management

qstat

qstat -a

qstat -an

qstat -f : to see full details of a job
gstat -a

finger
qdel

To kill all of your jobs: (queued and running)
for x in `qstat -a | grep 'username' | awk -F. {'print $1'}`;do qdel $x; done


To run a python program script command in a cluster node:


        ####################################################

        # /usr/bin/python   # XY run on linux cluster.
        # Run as $python XY-v1.0.py prg_script(.py)
        # Advantage of the scripts is that this can be used to run XY # in any node processor
        # of the cluster (or any linux cluster with PBS). But 1 job runs only on a single cpu

        import sys, posix, fileinput, string, re

        # XY path installed in your system
        path = "/XY/bin"
        stem = sys.argv[1]
        cwd = posix.getcwd()
        N = 0
        jobname = """%s""" % (stem)
        command = """echo "#PBS -l nodes=1

        #PBS -m ae
        #PBS -M your_e-mail
        #PBS -l walltime=3:00:00
        #PBS -l mem=512mb
        #PBS -S /bin/bash

        cd %s
        %s/bin/xy %s.py" > %s.j
        chmod +x %s.j
        qsub %s.j


        """ % (cwd, path, stem, jobname, jobname, jobname)
        posix.system(command)
         ####################################################

Tuesday, December 7, 2010

BASH customizing: Spice up the way your bash looks

Display multiple colors in bash shell prompt

Add this line to your .bashrc file
# Prompt text background by orange: two lines, title is full path of pwd,
PS1='\e[42m\d \@ \! \# \[\033]0;\h:\w\007\]\u@\h:\w\e[0;0m\nbash$ '


For changing prompt line color, use values from 40 to 47 instead of 42 in "\e[42m" 

\d - the date
\@ - the current time
\! - The history number of the command
\# - the command number of this command
\u@\h -Username@hostname (Useful when you use SCP to copy files between workstations)
\w – Current working directory (Full path)
\e[0;0m - Color ends here so that your shell color is not changed after this
\n - End of line; For prompt to be in the next line so that you have more space to type
bash$ - Just a prompt word and space for you to type

 Change the prompt color using tput

You can also change color of the PS1 prompt using tput as shown below:
$ export PS1="\[$(tput bold)$(tput setb 4)$(tput setaf 7)\]\u@\h:\w $ \[$(tput sgr0)\]"

Reference:
http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/