Tuesday, September 11, 2012

CONKY SCRIPT



I have this simple conky script working on my laptop :-
# Conky sample configuration
#
# the list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.

# set to yes if you want Conky to be forked in the background
background yes

# X font when Xft is disabled, you can pick one with program xfontsel
#font 5x7
#font 6x10
#font 7x13
#font 8x13
#font 9x15
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*

# Use Xft?
use_xft yes

# Xft font when Xft is enabled
xftfont Bitstream Vera Sans Mono:size=8

# Text alpha when using Xft
xftalpha 0.8

# Print everything to stdout?
# out_to_console no

# MPD host/port
# mpd_host localhost
# mpd_port 6600
# mpd_password tinker_bell

# Print everything to console?
# out_to_console no

# mail spool
mail_spool $MAIL

# Update interval in seconds
update_interval 1.0

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Create own window instead of using desktop (required in nautilus)
own_window yes

# If own_window is yes, you may use type normal, desktop or override
own_window_type root

# Use pseudo transparency with own_window?
own_window_transparent yes

# If own_window_transparent is set to no, you can set the background colour here
own_window_colour black

# If own_window is yes, these window manager hints may be used
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 300 5
maximum_width 300

# Draw shades?
draw_shades yes

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Draw borders around graphs
draw_graph_borders no

# Stippled borders?
stippled_borders 8

# border margins
border_margin 4

# border width
border_width 1

# Default colors and also border colors
default_color OrangeRed
default_shade_color black
default_outline_color black

# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right
#alignment none

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 12
gap_y 12

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale no

# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer no

# Allow each port monitor to track at most this many connections (if 0 or not set, default is 256)
#max_port_monitor_connections 256

# Maximum number of special things, e.g. fonts, offsets, aligns, etc.
#max_specials 512

# Maximum size of buffer for user text, i.e. below TEXT line.
#max_user_text 16384




# variable is given either in format $variable or in ${variable}. Latter
# allows characters right after the variable and must be used in network
# stuff because of an argument

# stuff after 'TEXT' will be formatted on screen


TEXT
${font Verdana:style=Bold:size=9}Acer Aspire running....
$sysname $kernel $machine
$stippled_hr
To Do List
${execi 30 cat ~/TODO.txt}
$stippled_hr
${color lightgrey}Uptime:$color $uptime ${color lightgrey}- Load:$color $loadavg
${color lightgrey}CPU Usage:${color #cc2222} $cpu% ${cpubar}
${color red}${cpugraph 0000ff 00ff00}
${color lightgrey}RAM Usage:$color $mem/$memmax - $memperc% ${membar}
${color lightgrey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar}
${color lightgrey}Processes:$color $processes  ${color grey}Running:$color $running_processes
${color lightgrey}Battery: $color ${battery}
$color$stippled_hr
${color lightgrey}Networking:
 Down:${color #8844ee} ${downspeed eth0} k/s${color lightgrey} ${offset 80}Up:${color #22ccff} ${upspeed eth0} k/s
${color #0000ff}${downspeedgraph eth0 32,150 ff0000 0000ff} ${color #22ccff}${upspeedgraph eth0 32,150 0000ff ff0000}
${color lightgrey}File System Usage:
 / $color${fs_used /}/${fs_size /} ${fs_bar /}
enc: $color${fs_used /media/enc}/${fs_size /media/enc} ${fs_bar /media/enc}

${color}Name              PID     CPU%   MEM%
${color #ddaa00} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
${color}Mem usage
${color #ddaa00} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${color lightgrey} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${color lightgrey} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}

$stippled_hr
${color #ddaa00}Port(s)${alignr}#Connections  
${color}Inbound: ${tcp_portmon 1 32767 count}          Outbound: ${tcp_portmon 32768 61000 count}${alignr}ALL: ${tcp_portmon 1 65535 count}
${color #ddaa00}Inbound Connection ${alignr} Local Service/Port$color
 ${tcp_portmon 1 32767 rhost 0} ${alignr} ${tcp_portmon 1 32767 lservice 0}
 ${tcp_portmon 1 32767 rhost 1} ${alignr} ${tcp_portmon 1 32767 lservice 1}
 ${tcp_portmon 1 32767 rhost 2} ${alignr} ${tcp_portmon 1 32767 lservice 2}
${color #ddaa00}Outbound Connection ${alignr} Remote Service/Port$color
 ${tcp_portmon 32768 61000 rhost 0} ${alignr} ${tcp_portmon 32768 61000 rservice 0}
 ${tcp_portmon 32768 61000 rhost 1} ${alignr} ${tcp_portmon 32768 61000 rservice 1}
 ${tcp_portmon 32768 61000 rhost 2} ${alignr} ${tcp_portmon 32768 61000 rservice 2}




Thursday, May 26, 2011

reinstalling GRUB2

GRUB --- is Truly Grand !
And forgiving too.....


I have a triple boot system - fedora 11, ubuntu (Maverick Meerkat) and windows Vista.
The last one is purely due to my love for Microsoft Flight Simulator !

My fedora install is more than a year old, my ubuntu install is also a few months old and both are robust and fine. But as is expected...I have had to reinstall Vista three times during the last one month or so. Twice due to the trojans and once just becoz the OS decided that some file is missing and quit on me with the blue screen of death.

This post is about my experience with reinstalling windoz and getting GRUB back on the MBR so that I can boot up all the OSs.

As we all know, if one reinstalls windoz after installing linux, then the MBR is overwritten and GRUB is removed during the windoz installation without any prompt. This will lead to a situation wherein, one can boot only into windoz and the linux OS though existing can't be booted into. So the only solution is to get GRUB back on the MBR. But how to do that ?

Follow these easy steps :-
  • Boot up using a ubuntu live CD.
  • Fire up a terminal.
  • Check the partition info to ascertain where is the linux distro located:-
sudo fdisk -l
( For this post we will assume the ubuntu install is in /dev/sda6)
  • Next mount it
sudo mount -t auto /dev/sda6 /mnt
  • Reinstall GRUB2 using the following command
sudo grub-install --root-directory=/mnt /dev/sda
( The first loc i.e /mnt will ensure the grub2 required files are put in the
respective locations and the second argument /dev/sda specifies the
MBR of sda is to be replaced.)
  • Reboot your system

Congrats you have your familiar GRUB2 menu back and you can now boot back into both linux and windoz !

For a nice tute on GRUB2 check out this link.

Sunday, May 15, 2011

My journey with ubuntu

I have been using ubuntu 10.10 for a few months now..... And I seem to have forgotten the fedora altogether.
Everything works like a breeze and I have started getting a feeling akin to using the windoz......just kiddin.
BTW I am running my ubuntu install off a 8 GB hp thumb drive and though it is slowing down with every day (due to my never ending quest for more and more applcns)......it still is quite amazing and decent. So let me recount my experience !

Firstly, the install is simple and I did it with a Linux For You Mag DVD. I chose to install in a thumb drive and have chosen ext4 as the file system. I think I did a mistake here and I should have kept atleast 1 GB of FAT32 partition space to maintain portability of files across windoz and linux platforms.

Secondly, I did a whole lot of enhancement to my basic install. I did most of my install from the command line using apt-get . However, I have used Ubuntu Software Centre and Synaptic Package Manager too from time to time. I have maintained a sort of journal for the installed softwares alongwith the commands I have used to install them. Here is the list :-

//for mp3 integration with nautilus file browser.
// when we mouse over a mp3 file , it will play the music. No need to use movie player, vlc, etc.
sudo apt-get install mpg123

// for reading pdf docus.
acroread // installed using software centre.

// photoshop like image editing software.
sudo apt-get install gimp

// additional gstreamer plugins to ensure all codecs are usable on the linux distro.
sudo apt-get install gstreamer0.10-plugins-bad gstreamer0.10-ffmpeg gstreamer0.10-plugins-ugly

// also installed vlc from the command line.
sudo apt-get install vlc

######## FFmpeg install : A nice tool to do transcoding between various codecs.#############
Medibuntu is a third-party repository that contains packages that are unable to be included in the official Ubuntu repositories. To install FFmpeg from Medibuntu open Terminal (Applications -> Accessories -> Terminal) and run the following:

sudo wget http://www.medibuntu.org/sources.list.d/`lsb_release -cs`.list --output-document=/etc/apt/sources.list.d/medibuntu.list && sudo apt-get -q update && sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring && sudo apt-get -q update


Now install FFmpeg:
sudo apt-get install ffmpeg libavcodec-extra-52

try out a screencast with ffmpeg :-
findout the absolute x and y coord using xwininfo command.
Next try this
ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 656x464 -i :0.0+203,85 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 output.mkv

*****

// Google earth install is slightly different.
sudo apt-get install googleearth package // then makepackage and get the deb file and use dpkg.
sudo apt-get install lsb-core // reqd by googleearth if the icon shows up but the program donot start even after clickin on it.

// for viewing youtube vids.
sudo apt-get install adobe-flashplugin
// for downloading youtube vids using keepvid website download and install the jre using ubuntu software centre:-
java runtime environment
I have additionally install NetVideoHunter plugin for firefox and it is very nice.

// for voip and video conf
sudo apt-get install skype

Next I shall tell how I have taken a backup of my full pen drive install as a file using the dd command and how I restored it on a new 8 GB pen drive and made it a full clone of my hp thumb drive. I did the following steps to copy my flash drive installation onto a new usb drive :-

Link :-
http://www.linuxquestions.org/questions/ubuntu-63/how-to-backup-a-installation-869813/
Quote:
Step 1 :- first I created the same filesystem as the existing usb drive's fs which is ext4.
mkfs.ext4 /dev/sdc1
Step 2 :- next I copied the contents to the new usb drive using the dd command :-
dd if=/dev/sdb1 of=/dev/sdc1
Step 3 :- Finally, I made the usb bootable by using grub-install :-
mount -t auto /dev/sdc1 /mnt
cd /mnt
chroot .
mount /proc
mount /dev
grub-install /dev/sdc
Just note that I have used the device name and not a partition name in the final step with grub-install i.e sdc and not sdc1.

Thanks for the help in the linuxwiki and a bit of common sense.
It feels gr8 to have the usb backed up ....I spent too much time customizing the installation and it looks gr8 too.

Also it would be nice to share my experience of creating an offline repo of all the softwares installed on my thumb drive, with others. By creating an offline repo, I have now got a way to first do a basic install of ubuntu on any stand alone PC, and also get all the additional softwares which I have installed on my thumb drive over the internet, without bothering to connect the standalone PC on the net.


######## Building a local repository ########

you may have to install build-essential and dpkg-dev to use the dpkg-scanpackages command in step 3.
sudo apt-get install build-essential
sudo apt-get install dpkg-dev

# 1. make a dir accessible (atleast by root)

sudo mkdir /var/my-local-repo

# 2. copy all the deb files to this directory.

# 3. cd to the /var/my-local-repo directory and run the following command to create the
Packages.gz file that is needed to for Synaptic to “see” your repository:

sudo dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz

# Please note that every time you add any more .deb files to this folder, you have to create a new Packages.gz file using the above command before the new file(s) will show up in
Synaptic (or Aptitude).

# Be sure to install the build-essential package (sudo apt-get install build-essential) before
running the above command.

# 4. Edit the /etc/apt/sources.list file and insert this on a new line (preferably the first):

deb file:/var/my-local-repo/ /

# the forward slash at end is not a typo and also note the single space between the last two
slashes.

# 5. Reload the package index like this:

sudo apt-get update

# 6. Now open System->Administration->synaptic package manager and do the following :-
Settings->Repositories-> Deselect every repo other than the file:/var/my-local-repo under
the Ubuntu Software and Other Software tabs.

Click the reload button.

# 7. To install your favourite software from the local repo just do :-

sudo apt-get install

######## Building a local repository ########

I shall also share my experience on creating a cool desktop effect with my ubuntu install, fully loaded with - compiz, conky, cairo dock and a video wallpaper.

####### Kool Desktop effects ########

Install compiz, compiz-fusion-plugins-main,compizconfig-backend-gconf,compiz-plugins, compiz-gnome, compiz-core and compiz-fusion-plugins-extra using the Synaptic Package Manager.
sudo apt-get install compizconfig-settings-manager
Next enable System->Preferences->Appearence->Extra
After completing above step , you can customize compiz by going to System > Preferences > CompizConfig Settings Manager.

// this software gives a apple-Mac like dock panel at the bottom edge of the screen.
sudo apt-get install cairo-dock

// this software will run a transparent window on the desktop which will show the hardware / software status realtime. It can be configured to show news, weather, and sticky notes, etc. The script is placed in home folder and called .conkyrc . To start conky you may use conky& from a terminal or configure it to start auto after login completes.

sudo apt-get install conky

// The link :- http://www.ubuntu-unleashed.com/2008/04/howto-loop-movie-or-video-as-desktop.html
// to display any video as a desktop wallpaper we need to install xwinwrap and mplayer software
// the steps are :-
sudo apt-get install build-essential libx11-dev x11proto-xext-dev libxrender-dev libxext-dev cvs
cvs -d :pserver:anoncvs@cvs.freedesktop.org:/cvs/xapps co xwinwrap
cd xwinwrap
make
sudo cp xwinwrap /usr/bin
sudo apt-get install mplayer

Now enjoy your movie wallpaper -
nishith@nishith-Aspire-4720:~/xwinwrap$ xwinwrap -ni -fs -s -st -sp -b -nf -- mplayer -wid WID '/media/clean/moviesFtp/CSI Miami S03E19 Sex & Taxes.avi' -loop 0

####### Kool Desktop effects ########

Since I am quite keen on cyber security issues, I tried and added ettercap, nmap, wireshark and metasploit with postgresql support , on my thumb drive.

######### Network Security ##########
sudo apt-get install ettercap
sudo apt-get secure-delete // for deleting data.
truecrypt // Installed using the truecrypt zip archive which has the installer.
sudo apt-get install zenmap // GUI for nmap. Nmap is included.
*****
installing nessus.
download the nessus.*.deb file from the internet
install - dpkg -i nessus.*.deb

the nessus executables are in the folder /opt/nessus/sbin/
add a user to nessus using : cd /opt/nessus/sbin and then ./nessus-adduser
request for a registration on the nessus site
*****
######### Network Security ##########

Cool isn't it !?!