Agadir (2)
   Computers (13)
   Gadgets (4)
   General (36)
   Howtos (4)
   Japanese (5)
   Linux (12)
   Movies (4)
   Old Blog (90)
   Programming (5)
   Software (6)
   Web & Design (7)

 Subscribe to Posts
 Subscribe to Comments

readline wrapper

68 views
Linux, Old Blog

Some unix tools (MaxDB’s dbmcli for example) don’t have a readline support. It’s quiet annoying when you want to correct a misspelled word.

You can use rlwrap as a work around for this problem.

$ rlwrap command
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
No Comments »

Notifications using ssh and dbus-python

84 views
Howtos, Linux, Old Blog
  • first make sure dbus-python is installed on the remote host.
  • download the mesg.sh script:
  • 1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    #!/bin/bash
     
    if (($# < 2));then
      echo "Usage: ${0##*/} dest text [text ...]" >> /dev/stderr
      exit 1
    fi
    dest=$1;;
    shift
     
    ssh ${dest} "DISPLAY=:0 python" &lt;<eof>
    import dbus
    no = dbus.SessionBus().get_object('org.freedesktop.Notifications',
                                    '/org/freedesktop/Notifications')
    ni = dbus.Interface(no, 'org.freedesktop.Notifications')
    ni.Notify("python", 0, '', "${USER} says:", "$@", {}, {}, 0)
    EOF
    </eof>
  • make it executable:
  • $ mv mesg.sh.txt mesg.sh; chmod 755 mesg.sh
  • to send a message to a user at a remote desktop:
  • $ ./mesg.sh user@host "Are you ready for lunch ?"
  • You can also use html-like syntax to send URLs:
  • $ ./mesg.sh shikamaru@host '&lt;a href=\"http://www.dattebayo.com/t/ns031.torrent\"&gt;Naruto Shippuuden 031&lt;/a&gt; is out'
  • he will receive the following notification:
  • 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    No Comments »

    Mount remote directories with ssh

    62 views
    Linux, Old Blog
  • Install sshfs-fuse and make sure fuse is loaded:
  • $ lsmod | grep fuse || sudo modprobe -v fuse
  • mount the remote dir:
  • $ sshfs user@host:/path/to/dir ./dir_at_host/
  • to umount it:
  • $ fusermount -u ./dir_at_host/
    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    No Comments »

    rsync over ssh

    63 views
    Old Blog
    $ rsync –progress -avz -e ssh user@host:data/ ./data/ 
    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    No Comments »

    Sudo & Multiple command line

    60 views
    Old Blog
  • problem:
  • $ sudo 'for i in 1 2; do echo $i; done'sudo: for i in 1 2; do echo $i; done: command not found

  • solution:
  • $ sudo bash -c 'for i in 1 2; do echo $i; done'12
    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    2 Comments »
    Page 1 of 11
    WP Theme GlossyBlue Modified by Fahdos