Wednesday, July 30, 2014

Using sudo -l to check sudo rights

If you need to do a quick check whether on sudo rights for your userid, you can check quickly by
doing a sudo -l

$ sudo -l 

Matching Defaults entries for user1 on this host:
    requiretty, !visiblepw, always_set_home, env_reset, env_keep="COLORS
    DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS", env_keep+="MAIL PS1
    PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE", env_keep+="LC_COLLATE
    LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES", env_keep+="LC_MONETARY
    LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE", env_keep+="LC_TIME LC_ALL
    LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY",
    secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin

User user1 may run the following commands on this host:
    (ALL) ALL

Saturday, July 26, 2014

Installing GNOME Desktop on CentOS 6 on a console

To install GNOME Desktop and X Windows using the console for CentOS 6.5, do use the command
# yum groupinstall "Desktop" "Desktop Platform" "X Windows System"

Thursday, July 24, 2014

Using pip to install python packages

Pointer 1: To install specific version of packages do
# pip install 'numpy==1.5.1'
Pointer 2: To show what files was installed
# pip show --files numpy
---
Name: numpy
Version: 1.8.1
Location: /usr/local/python-2.7.8/lib/python2.7/site-packages
Requires:
Files:
../numpy/__init__.py
.....
.....
Pointer 3: Uninstall a package
# pip uninstall num
Uninstalling SomePackage:
Pointer 4: Upgrade a package:
# pip install --upgrade SomePackage
[...]
Found existing installation: SomePackage 1.0
Uninstalling SomePackage:
Successfully uninstalled SomePackage
Running setup.py install for SomePackage
Successfully installed SomePackage
Pointer 5: List what packages are outdated:
# pip list --outdated
SomePackage (Current: 1.0 Latest: 2.0)
References:
  1. pip 1.5.6 - A tool for installing and managing Python packages
  2. pip - installation

Wednesday, July 23, 2014

Installing and Compiling Python 2.7.8 on CentOS 5

Step 1: Download the Python 2.7.8 from Python Site Step 2: Use GCC44 to compile. If you have not done it, do
# yum install gcc44 gcc44-c++ gcc44-gfortran
Step 3: Update your alias in your .bashrc
alias gcc='gcc44'
Step 4: Configure python 2.7.8
# cd python-2.7.8
# ./configure --prefix=/usr/local/python-2.7.8
# make -j 8
# make install
Step 5: Update the PATH and LD_LIBRARY_PATH in your .bashrc
export PATH=$PATH:/usr/local/python-2.7.8/bin.........
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/python-2.7.8/lib
Step 6: Download get-pip.py For more information see pip installation site Create a directory inside python2.7 directory and put pip in that directory
# mkdir /usr/local/python-2.7.8/pip
# wget https://bootstrap.pypa.io/get-pip.py .
Step 7: Install pip with Administrator rights
# python2.7 get-pip.py
If setuptools (or distribute) is not already installed, get-pip.py will install setuptools for you. To upgrade an existing setuptools (or distribute), run
# pip install -U setuptools
# pip install numpy

Tuesday, July 22, 2014

Finding Performance bottlenecks in your application




This is an interesting blog How to find performance bottlenecks in your application by using gperftools and KCachegrind to profile performance bottlenecks.

Do take a look and happy reading.