Monday, September 27, 2010

Disk Usage on a Remote host: Enable X11 Forwarding for ssh and run x11 application

Lately I was in the of analyze analyze disk space on a remote server, when you are on *nix you can do such things quite easliy.
ssh into your remote host and Enable ForwardX11
  1. For  enabling it for sshd (ssh deamon):
    •   sudo vi /etc/ssh/sshd_config 
    • and modify X11Forwarding no to X11Forwarding yes
  2. Restart sshd:
    • sudo /etc/init.d/ssh 
  3. Exit from current session
  4. ssh into remote host again with -X flag
    • ssh -X username@hostname
  5. Run your application in my case $ baobab
Disk Usage Utility
Have Look at JDiskReport for a cross platform app.
For Macs Edit  sshd_config  located in /etc
  1. sudo vim /etc/sshd_config 
  2. ssh to your mac
  3. Run the app $ java -jar jdiskreport-1.3.2.jar 
JDiskReport


Ruby IRB Auto Completion and Highlight - Linux

Install wirble

laptop:~$ sudo gem install wirble
Successfully installed wirble-0.1.3
1 gem installed
Installing ri documentation for wirble-0.1.3...
Installing RDoc documentation for wirble-0.1.3...

vim ~/.irbrc
Put the following in this file:

require "rubygems"
require "wirble"
Wirble.init
Wirble.colorize

IRB.conf[:AUTO_INDENT] = true
IRB.conf[:USE_READLINE] = true
IRB.conf[:LOAD_MODULES] = [] unless IRB.conf.key?(:LOAD_MODULES)
unless IRB.conf[:LOAD_MODULES].include?('irb/completion')
IRB.conf[:LOAD_MODULES] << 'irb/completion'
end


type
:wq

Thats it on irb prompt use tab for auto completion

Example:

Install random_data

laptop:~$ sudo gem install random_data
Successfully installed random_data-1.5.1
1 gem installed
Installing ri documentation for random_data-1.5.1...
Installing RDoc documentation for random_data-1.5.1...

-laptop:~$ irb
>> require 'rubygems'
=> false
>> require 'random_data'
=> true
>> Random.al
Random.allocate Random.alphanumeric
>> Random.alphanumeric 11
=> "w1KbPVLzE2l"