Remote desktop Openbox with VNC

On remote PC

  • Install ‘x11vnc’ – this merges and serves the current X session.
  • Start x11vnc:
    > x11vnc -display :0 -forever -shared -clear_all -threads -gui -scale 1280x720
    • – forever: keeps the server running forever {see -loop}
    • – shared: multiple clients can connect
    • -clear_all: reset pressed buttons {CAPS_LOCK}
    • -threads: thread / client
    • -gui: control tk based UI
    • -scale: target client screen size {see – xrandr}

On client PC

  • Install ‘xtightvncviewer’, any other client will also do.
  • Connect:
    > xtightvncviewer -compresslevel 2 -quality 3 $REMOTE_IP
    • you need to achieve a good balance between responsiveness and quality, basically strike a balance in:
      • cpu overhead in compresssion.
      • network overhead on cpu and routers with larger quality and compression.

Music, movies and the (linux client) samba

Linux Distros (Ubuntu/Gnome) support browsing samba network shares out of the box, assuming Gnome/Nautilus.

Except, somethings that don’t work correctly always.

  • Preview of images.
  • Playback of media – music/movies (tried mplayer and totem)
  • The problem I imagine is Gnome/Nautilus is not mounting on/or not using Linux VFS.

Hence to get media preview / playback just mount it the standard way.

> mount -t cifs //$host/$i /mnt/smbfs_$host/$i -o username=$user,password=$pass

Good to always protect share with a password.


As of writing this I’m on Debian 8 Jessy. 

And as to yhy not NFS: I usually have dumped media files over a fileserver and find it convenient to share it over samba, since I have Windows users over my subnet.

Process monitoring using top, gnuplot and ruby

Had been thinking a lot and (not doing anything) researching on the web to find methods to monitor specific application performances, i.e. %CPU, %RAM utilization, etc.

Having had a Lenovo G400 for about 8 years now with 1 GB RAM, and still making passes at compilers. Recent applications are all about user experience and all the unwanted glitter. And I had to be informed about ones that are a hog, to be blown out.

Finally got myself to script a monitoring.

In a nutshell, I launch the script to monitor resources using top and log to a file. Use the app, launch, do stuff, exit.Stop monitoring and generate the application performance profile.

> ./ptool.rb mtop
> ./ptool.rb mtop_kill
> ./ptool.rb mtop_report > mtop.csv

And a small script to generate the graph using gnuplot.
> ./mtop.plot

google-chrome-stable/Version 37.0.2062.120/Arch Linux 32bit

chromium/Version 37.0.2062.120 (281580)/Arch Linux 32bit

Below is the code listing:

# name: ptool.rb
# author:

require 'pp'


TI = { cpu: 8, mem:9 }

def mtop tag='sys', remote='localhost'
  cmd = "top -u #{PUSER} -d 2 -b > /tmp/top_#{tag}-#{remote}.log &"
  if remote != 'localhost'
    cmd = "rsh #{USER}@#{remote} "+cmd
  puts cmd

def mtop_kill tag='sys', remote='localhost'
  cmd = "pkill -f \"top -u #{PUSER} -d 2 -b\" &"
  if remote != 'localhost'
    cmd = "rsh #{USER}@#{remote} "+cmd

def mtop_report tag='sys', remote='localhost'
  r, t, acpu, amem =[], 0.0, 0.0, 0.0"/tmp/top_#{tag}-#{remote}.log") do |f|
    f.each_line do |line|
      # accum
      if (line =~ /#{PNAME}/)
        # puts line
        cpu, mem = line.split(" ")[TI[:cpu]].to_f, line.split(" ")[TI[:mem]].to_f
        acc << [cpu, mem]

      # reduce/iter
      if (line =~ /^top/)
        #pp acc
        #puts '-------------'
        ccpu, cmem = 0.0, 0.0
        acc.each do |e|
          ccpu, cmem = ccpu+e[0], cmem+e[1]
        acpu, amem = acpu+ccpu, amem+cmem
        r << [t += 2, ccpu, cmem]
  # average
  r << [acpu/r.size, amem/r.size]
  cvs_out r

def cvs_out rlist
  av = rlist.pop
  puts "time,cpu,mem,acpu,amem"
  r = rlist.each do |e|
    puts "#{e[0]},#{e[1]},#{e[2]},#{av[0]},#{av[1]}"

self.send ARGV[0]
# adapted from (
# name: mtop.plot
# author:

#set terminal pngcairo  transparent enhanced font "arial,10" fontscale 1.0 size 800, 300 
set terminal pngcairo  enhanced font "arial,10" fontscale 1.0 size 800, 300
set output 'mtop.png'
set key inside right top vertical Right noreverse noenhanced autotitles nobox
set datafile missing '-'
#set style data linespoints
set style data lines
set xtics border in scale 1,0.5 nomirror rotate by -45  offset character 0, 0, 0 autojustify
set xtics  norangelimit font ",8"
set xtics   ()
set title "app. perf. data"
set datafile separator ","
plot 'mtop.csv' using 1:2 title '%cpu',\
      '' using 1:3 title '%mem',\
      '' using 1:4 title 'a-cpu',\
      '' using 1:5 title 'a-mem'

share linux partitions using samba over LAN

Partitions can be automounted either by linux or nautilus on access.

set up partition mounts points correctly

Partitions can be automounted either by linux or nautilus on access.

  1. partitions automounted on access from nautilus don’t work well with samba

    this is something todo with ‘fuseblk’ driver or access parameter

    line from mtab that quirks with samba

    /dev/sda6 /media/swetha/sg fuseblk rw,nosuid,nodev,allow_other,default_permissions,blksize=4096 0 0

  2. edit /etc/fstab to manually configue mounting.

    below config works and is accessible for all users.

    /dev/sda6 /media/sg ntfs-3g defaults,windows_names,locale=en_US.utf8 0 0

  3. remount

    sudo umount /dev/sda6 sudo mount -a

set up samba share correctly

Nautilus provides a way to create temporary network shares.

  1. don’t create shares from nautilus, disable all shares managed by nautilus.
  2. install smbd, samba
  3. install system-config-samba.

    apt-get install system-config-samba

  4. create shares using system-config-samba run as root with sudo.

    sudo system-config-samba

    select the folder to which to partition is mounted

    set visible

    set access to users

  5. restart samba

    sudo service smbd restart

Given your ubuntu box IP address is

You should now be able to access all the linux shares at \\ or from another linux box at smb://

Filing my first RTI

Noted a discrepancy in claim settling with a bank. Decided to get the records of the recurrent deposits made.

RTI Act, 2005 is a Law that provides a machinery for a Citizen to exercise and realize his basic right – Right To Information.

Its actually quite simple to seek information under this Act and it is very legally binding.

I’ll elaborate more on that later. For starters, it’s just best to read up the Act publication. It’s about 27 pages in total, the first 14 being relevant and adequate for a first time applicant.

The documentation does not provide for a requisition form template, hence created one for the above purpose – template.

Dawn unto the dinosaur

Been out of blogging for a while and now just out of curiosity, just logged in. Glad I started it a couple of years back. But it’s just that if feel the world or my thoughts have regressed. I’ve just become or am becoming like everybody else, in a way of saying that I’m becoming a nobody.

Well, actually I don’t really fret not blogging this whole duration of blog-a-llectual slumber. Its just that I had to switch between a couple of jobs to better my financial stand in order to find a bride and get married (the way it is in this geo-social-space ). Now having done that, feel a bit relieved.

Nevertheless the sense of accomplishment that was always a part of for having done nothing that add path to anything worth having, is being efferently evasive. That again to say that I have it but I don’t quite have it altogether as opposed to the saying earlier that I have it, but not quite yet.

I need to definitely clean up stuff, start from scratch, root & reboot.

Afraid? Try faith!

First came friendship, life found a way to keep itself by having a friend always around in need, in face of danger, to ward of a threat, as a means of rescue or to better affect preemption.

Then came the clan-ism, a higher order social construct with rigid rules enforcing efficiency and planning.

Present day society lies somewhere in between, where the clan-ism has faded into a backdrop that’s diluted to what stands as ‘governing body’ in civilizations. And the rules are malleable and fluid, perhaps to allow expansion than survival as if the former has been guaranteed.

Except, its not the individual’s but rather the society’s that’s granted. Yes, society does perceive individualism as it’s greatest threat. And hence an individual is granted everything the society offers, as long has he remains a part of and progresses it’s ideals, and nothing when he goes against its norm’s.

Individualism occurs in society for 2 reasons as best as I can comprehend. Individual’s vested interest. Another, is evolution.

Evolution is the tendency of anything living, organism or an idea that is society. But why this resistance to anything that’s good. Well, it’s evolution again at play. Evolution occurred by survival of the fittest. Hence, domination of the fittest change needs to be resisted, that’s the objective.

To pass on a good and that advocation is individuality. To be dominated and extinguished by a germ that is a better change is society’s fear. That’s everyone’s fear.

Religion, was it one of society’s response to preserve itself. Make it immune to individualism by granting it hypothetically for it’s subjugation in the present. Or to make established norms more difficult to be unseated, hence demand better individualism, or continuation of the best yet. Those are 2 deliberate line of thought surrounding religion, but one thing religion itself did not expect to come along, evolution.

Currently it’s the later line of thought that’s evanescent in its proceedings. Demand better individuals. Allow for personal growth. Encourage change but with test. Rather suppression of development.

Enter Faith.