Friday, October 30, 2009

2 steps to ssh without passwords

Situation: You are on machine A, and you want to log in machine B without having to enter your password each time.

On machine A:
type: ssh-keygen -t rsa

then press enter for default settings, and make sure you don't enter any paraphrase.

Now, you need to send your public key to machine B.

type: cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'

That's it !

Thursday, September 24, 2009

Run python inside python and capture output

This is taken from http://techkr.blogspot.com/2007/02/python-how-to-get-output-from-ossystem.html:

How to execute python inside python and capture output:

A quick solution using popen :

import os
result=os.popen('command').read()
print result

where command is your command (expl. on windows: dir,ipconfig,...)

If you expect more than a line and want each word in a list:

import os,string
result=string.split(os.popen('dir/w').read())

Friday, September 11, 2009

Labspotting

I found this poster on a the Scientist Creative Quartely page at UBC, I thought it was funny ! That's a remix of the trainspotting poster.





Tuesday, September 8, 2009

Songbird - Ubuntu Jaunty

I had some error while trying to launch songbird on ubuntu jaunty 32 bit.

I found on a website that this package needs to be removed

sudo apt-get remove libvisual-0.4-plugins

libvisual is the plugin that displays some images while playing music in some music players like totem...

I removed it from the system and I can now launch Songbird.

Here is the error I was getting when running songbird:

./songbird
*** glibc detected *** ././songbird-bin: double free or corruption (out): 0xb199ed60 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7e55604]
/lib/tls/i686/cmov/libc.so.6(cfree+0x96)[0xb7e575b6]
/usr/lib/libvisual-0.4.so.0(visual_mem_free+0x21)[0xb1a7c141]
/usr/lib/libvisual-0.4.so.0[0xb1a73407]
/usr/lib/libvisual-0.4.so.0(visual_plugin_get_list+0x73)[0xb1a735e3]
/usr/lib/libvisual-0.4.so.0(visual_init+0x291)[0xb1a82ec1]
/usr/lib/gstreamer-0.10/libgstlibvisual.so[0xb267a273]
/home/alchemist/apps/Songbird/lib/libgstreamer-0.10.so[0xb3556b2a]
/home/alchemist/apps/Songbird/lib/libgstreamer-0.10.so(gst_plugin_load_file+0x93f)[0xb35576f1]
/home/alchemist/apps/Songbird/lib/libgstreamer-0.10.so[0xb3563ab6]
/home/alchemist/apps/Songbird/lib/libgstreamer-0.10.so(gst_registry_scan_path+0x135)[0xb3563c5b]
/home/alchemist/apps/Songbird/lib/libgstreamer-0.10.so[0xb350f34f]
/home/alchemist/apps/Songbird/lib/libgstreamer-0.10.so[0xb350f83b]
/home/alchemist/apps/Songbird/lib/libgstreamer-0.10.so[0xb350fea6]
/home/alchemist/apps/Songbird/lib/libgstreamer-0.10.so[0xb351046e]
/usr/lib/libglib-2.0.so.0(g_option_context_parse+0x5ab)[0xb6c34dcb]
/home/alchemist/apps/Songbird/lib/libgstreamer-0.10.so(gst_init_check+0xf1)[0xb350e60b]
/home/alchemist/apps/Songbird/lib/libgstreamer-0.10.so(gst_init+0x32)[0xb350e715]
/home/alchemist/apps/Songbird/lib/sbGStreamerMediacore.so(_ZN18sbGStreamerService4InitEv+0x9ff)[0xb33e89e7]
/home/alchemist/apps/Songbird/lib/sbGStreamerMediacore.so[0xb33f1a01]
/home/alchemist/apps/Songbird/lib/sbGStreamerMediacore.so[0xb3405a56]
/home/alchemist/apps/Songbird/xulrunner/libxul.so[0xb7702b89]
/home/alchemist/apps/Songbird/xulrunner/libxul.so[0xb770204b]
/home/alchemist/apps/Songbird/lib/sbGStreamerMediacore.so[0xb3402a3f]
/home/alchemist/apps/Songbird/lib/sbGStreamerMediacore.so[0xb3402a69]
/home/alchemist/apps/Songbird/lib/sbGStreamerMediacore.so[0xb3402215]
/home/alchemist/apps/Songbird/lib/sbGStreamerMediacore.so[0xb33f0071]
/home/alchemist/apps/Songbird/lib/sbGStreamerMediacore.so(_ZN27sbGStreamerMediacoreFactory4InitEv+0x46)[0xb33f08e0]
/home/alchemist/apps/Songbird/lib/sbGStreamerMediacore.so[0xb33f1961]
/home/alchemist/apps/Songbird/lib/sbGStreamerMediacore.so[0xb3405a56]
/home/alchemist/apps/Songbird/xulrunner/libxul.so[0xb7702b89]
/home/alchemist/apps/Songbird/components/sbMediacoreManager.so[0xb45761c5]
/home/alchemist/apps/Songbird/components/sbMediacoreManager.so[0xb45761f2]
/home/alchemist/apps/Songbird/components/sbMediacoreManager.so[0xb4575a8d]
/home/alchemist/apps/Songbird/components/sbMediacoreManager.so(_ZN8nsCOMPtrI19sbIMediacoreFactoryEC1ERK15nsCOMPtr_helper+0x2d)[0xb455d159]
/home/alchemist/apps/Songbird/components/sbMediacoreManager.so(_ZN18sbMediacoreManager4InitEv+0x1b9)[0xb455a15b]
/home/alchemist/apps/Songbird/components/sbMediacoreManager.so[0xb455a4f4]
/home/alchemist/apps/Songbird/xulrunner/libxul.so[0xb76df877]
/home/alchemist/apps/Songbird/xulrunner/libxul.so[0xb76dfe1c]
/home/alchemist/apps/Songbird/xulrunner/libxul.so[0xb6f6f7a0]
/home/alchemist/apps/Songbird/xulrunner/libxul.so(XRE_main+0x19af)[0xb6f6d481]
././songbird-bin[0x8048f40]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfc775]
././songbird-bin[0x8048bb1]
======= Memory map: ========
08048000-0804e000 r-xp 00000000 08:05 184263 /home/alchemist/apps/Songbird/songbird-bin
0804e000-0804f000 rw-p 00006000 08:05 184263 /home/alchemist/apps/Songbird/songbird-bin
095fb000-0961c000 rw-p 095fb000 00:00 0 [heap]
b1900000-b1a00000 rw-p b1900000 00:00 0
b1a62000-b1a9e000 r-xp 00000000 08:05 10294 /usr/lib/libvisual-0.4.so.0.0.0
b1a9e000-b1a9f000 r--p 0003b000 08:05 10294 /usr/lib/libvisual-0.4.so.0.0.0
b1a9f000-b1aa0000 rw-p 0003c000 08:05 10294 /usr/lib/libvisual-0.4.so.0.0.0
b1aab000-b1ab1000 rw-p b1aab000 00:00 0
b1ab1000-b1b00000 r-xp 00000000 08:05 10259 /usr/lib/libtheora.so.0.3.4
b1b00000-b1b01000 r--p 0004e000 08:05 10259 /usr/lib/libtheora.so.0.3.4
b1b01000-b1b02000 rw-p 0004f000 08:05 10259 /usr/lib/libtheora.so.0.3.4
b1b02000-b1b1d000 r-xp 00000000 08:05 22386 /usr/lib/sse2/libspeex.so.1.5.0
b1b1d000-b1b1e000 r--p 0001a000 08:05 22386 /usr/lib/sse2/libspeex.so.1.5.0
b1b1e000-b1b1f000 rw-p 0001b000 08:05 22386 /usr/lib/sse2/libspeex.so.1.5.0
b1b1f000-b1b8c000 r-xp 00000000 08:05 10190 /usr/lib/libschroedinger-1.0.so.0.1.0
b1b8c000-b1b8d000 r--p 0006d000 08:05 10190 /usr/lib/libschroedinger-1.0.so.0.1.0
b1b8d000-b1b8e000 rw-p 0006e000 08:05 10190 /usr/lib/libschroedinger-1.0.so.0.1.0
b1b8e000-b1b8f000 rw-p b1b8e000 00:00 0
b1b8f000-b1c3a000 r-xp 00000000 08:05 157729 /usr/lib/i686/cmov/libavformat.so.52.31.0
b1c3a000-b1c3b000 r--p 000ab000 08:05 157729 /usr/lib/i686/cmov/libavformat.so.52.31.0
b1c3b000-b1c41000 rw-p 000ac000 08:05 157729 /usr/lib/i686/cmov/libavformat.so.52.31.0
b1c41000-b1c8d000 rw-p b1c41000 00:00 0
b1c8d000-b214b000 r-xp 00000000 08:05 157707 /usr/lib/i686/cmov/libavcodec.so.52.20.0
b214b000-b214c000 r--p 004be000 08:05 157707 /usr/lib/i686/cmov/libavcodec.so.52.20.0
b214c000-b2155000 rw-p 004bf000 08:05 157707 /usr/lib/i686/cmov/libavcodec.so.52.20.0
b2155000-b2462000 rw-p b2155000 00:00 0
b2462000-b246f000 r-xp 00000000 08:05 157686 /usr/lib/i686/cmov/libavutil.so.49.15.0
b246f000-b2470000 r--p 0000c000 08:05 157686 /usr/lib/i686/cmov/libavutil.so.49.15.0
b2470000-b2471000 rw-p 0000d000 08:05 157686 /usr/lib/i686/cmov/libavutil.so.49.15.0
b2471000-b2474000 rw-p b2471000 00:00 0
b2474000-b24a6000 r-xp 00000000 08:05 157788 /usr/lib/gstreamer-0.10/libgstffmpeg.so
b24a6000-b24a7000 r--p 00031000 08:05 157788 /usr/lib/gstreamer-0.10/libgstffmpeg.so
b24a7000-b24a8000 rw-p 00032000 08:05 157788 /usr/lib/gstreamer-0.10/libgstffmpeg.so
b24a8000-b24e2000 r-xp 00000000 08:05 2616 /lib/libncursesw.so.5.7
b24e2000-b24e3000 ---p 0003a000 08:05 2616 /lib/libncursesw.so.5.7
b24e3000-b24e5000 r--p 0003a000 08:05 2616 /lib/libncursesw.so.5.7
b24e5000-b24e6000 rw-p 0003c000 08:05 2616 /lib/libncursesw.so.5.7
b24e6000-b2581000 r-xp 00000000 08:05 2666 /lib/libslang.so.2.1.3
b2581000-b2584000 r--p 0009a000 08:05 2666 /lib/libslang.so.2.1.3
b2584000-b2591000 rw-p 0009d000 08:05 2666 /lib/libslang.so.2.1.3
b2591000-b25c7000 rw-p b2591000 00:00 0
b25c7000-b25e3000 r-xp 00000000 08:05 9484 /usr/lib/libcaca.so.0.99.16
b25e3000-b25e4000 r--p 0001b000 08:05 9484 /usr/lib/libcaca.so.0.99.16
b25e4000-b266b000 rw-p 0001c000 08:05 9484 /usr/lib/libcaca.so.0.99.16
b266b000-b266f000 rw-p b266b000 00:00 0
b2678000-b267e000 r-xp 00000000 08:05 12597 /usr/lib/gstreamer-0.10/libgstlibvisual.so
b267e000-b267f000 r--p 00005000 08:05 12597 /usr/lib/gstreamer-0.10/libgstlibvisual.so
b267f000-b2680000 rw-p 00006000 08:05 12597 /usr/lib/gstreamer-0.10/libgstlibvisual.so
b2680000-b2683000 r-xp 00000000 08:05 108366 /usr/lib/gstreamer-0.10/libgstcacasink.so
b2683000-b2684000 r--p 00002000 08:05 108366 /usr/lib/gstreamer-0.10/libgstcacasink.so
b2684000-b2685000 rw-p 00003000 08:05 108366 /usr/lib/gstreamer-0.10/libgstcacasink.so
b2685000-b268e000 r-xp 00000000 08:05 186259 /usr/lib/gstreamer-0.10/libgstdccp.so
b268e000-b268f000 r--p 00008000 08:05 186259 /usr/lib/gstreamer-0.10/libgstdccp.so
b268f000-b2690000 rw-p 00009000 08:05 186259 /usr/lib/gstreamer-0.10/libgstdccp.so
b2690000-b26a1000 r-xp 00000000 08:05 186295 /usr/lib/gstreamer-0.10/libgstqtmux.so
b26a1000-b26a2000 r--p 00010000 08:05 186295 /usr/lib/gstreamer-0.10/libgstqtmux.so
b26a2000-b26a3000 rw-p 00011000 08:05 186295 /usr/lib/gstreamer-0.10/libgstqtmux.so
b26a3000-b26ab000 r-xp 00000000 08:05 133723 /usr/lib/gstreamer-0.10/libgstgdkpixbuf.so
b26ab000-b26ac000 r--p 00007000 08:05 133723 /usr/lib/gstreamer-0.10/libgstgdkpixbuf.so
b26ac000-b26ad000 rw-p 00008000 08:05 133723 /usr/lib/gstreamer-0.10/libgstgdkpixbuf.so
b26ad000-b26b6000 r-xp 00000000 08:05 186266 /usr/lib/gstreamer-0.10/libgstdvdspu.so
b26b6000-b26b7000 r--p 00008000 08:05 186266 /usr/lib/gstreamer-0.10/libgstdvdspu.so
b26b7000-b26b8000 rw-p 00009000 08:05 186266 /usr/lib/gstreamer-0.10/libgstdvdspu.so
b26b8000-b26c1000 r-xp 00000000 08:05 186299 /usr/lib/gstreamer-0.10/libgstrfbsrc.so

Saturday, July 25, 2009

Talking to BlueSMiRF RP-SMA Bluetooth with Putty

These are notes on how to talk to the BlueSmirf bluetooth chip.

I am trying to talk to a bluetooth chip from my ubuntu box. I have Putty installed, and a Serial to USB cable connected to a FT232R Breakout board. This board is then connected to the bluetooth chip by crossing Tx and Rx pins. The following hardware is used:

FT232R Breakout Board
BlueSmirf bluetooth

I am writing this post because I struggled for about an hour on how to talk to the chip with putty.
The solution ended up to be simple. Load putty with baud rate 115200, 8N1. Remember to use 115200, otherwise it will not work. Have I had followed the documentation closely, I would have been able to talk to the bluetooth chip in 5 minutes.

Thursday, July 23, 2009

Open Source Solution for multiple mobile platforms

This article is really interesting. Basically, why would we want to invest the time into learning how to code on a specific mobile platform if we could learn how to do it on a generic platform?

Read the article: Open Source Solution for multiple mobile platforms

Saturday, May 9, 2009

How to detect your android device on Ubuntu 9.04 Jaunty x32

To detect your Android Dev phone on ubuntu 9.04 (Jaunty, x32), do the following:

1. cd /etc/udev/rules.d/

2.a. if you have a file named 50-android.rules, then do:
mv 50-android.rules 51-android.rules

2.b. if you don't have the file, do the following:
vi 51-android.rules (note: it will create a new file)
In this file, add the following:

UBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"

3. Unplug and plug again your device, then type:
adb devices

and you should see something like:
List of devices attached
HT...... device

For more info, check out this post on Android Google Groups:

Ubuntu Jaunty and adb not playing well together

Tuesday, April 21, 2009

Wednesday, April 8, 2009

Tuesday, March 17, 2009

Vimperator

I have been learning vi for the last few months, and in an effort to use it more, I have installed Vimperator on Firefox. It is basically an add-ons that can be installed on Firefox and what it does it that lets you browse a page using vi commands.

It is pretty nice, it allows me to browse a page without using the mouse. It gets very addictive actually because you come to a certain point where you even *feel lazy* to grab the mouse to browse the page.... Well, feeling lazy is a bit of an exaggeration... It's more than sometimes I am in the mood to use the mouse, sometimes I would rather keep my fingers on the keyboard.

Anyhow, it doesn't work well all the time though... But here is a command I found very useful for copying and pasting

1. / to search for something
2. i to enter carret mode
3. v to enter visual mode
4. move by j,k to select the text
5. y to yank the text
6. ctrl-v to paste later on...

that's it !

Sunday, March 15, 2009

Android without sim card

Here's how I managed to use android without a sim card:

Credits goes to this person: http://android-tricks.blogspot.com/2009/01/using-adp1-without-sim-card.html

Connect the device to your computer using the USB cable. You should be able to see a listing for your device if you run adb devices. Then execute the following commands.
  • $ adb shell
  • $ su
  • $ cd /data/data/com.android.providers.settings/databases
  • $ sqlite3 settings.db
  • INSERT INTO system (name, value) VALUES ('device_provisioned', 1);
  • .exit
  • $ reboot
After reboot:
  • $ adb shell
  • am start -a android.intent.action.MAIN -n com.android.settings/.Settings

Friday, January 30, 2009

transparent shell xfce

alltray --borderless --skip-taskbar xfce4-terminal --hide-menubar --hide-borders --geometry 600x600-10+10

Thursday, January 29, 2009

This part of my life is called Xfce


I have been using gnome for some times now, and I feel like I want to experience other X Window. I have used Fluxbox in the past, but it was affecting my productivity, so I never really made the switch.

This time, I will try Xfce for a little while. We used to have this window manager at McGill, and it is very light, and fast.

The cool thing about xfce is that I can setup a transparent shell on the background.

Here is a picture:

Monday, January 19, 2009

Cut/Copy and paste in vi

To cut and paste in vi:

Get to command mode (press esc) and type mx at the start of the place you would like to cut and go to the position where you want to stop cutting and type d'x.

Explanation: m
starts a buffer with name x and d'x will cut it.

To copy and paste in vi:

Type mx and y'x

Explanation: same as above except that y'x is meant for yanking (copying) buffer with name x.

Friday, January 2, 2009

My first Apple product !

I finally bought my first Apple product. To be honest, I am not a real fan of Apple but that being said, their IPhone kicks ass!! I don't really want to get into a discussion on whether we should go for Apple products because this would sound similar to asking whether Windows is better than Linux or whether KDE is better than Gnome...

The IPhone I recently bought is my second smartphone. The first one was a Nokia N95 8GB, which was very comparable to the IPhone in terms of features. I have been using the N95 for 4-5 months, and the IPhone for only 3 or 4 days, and let me tell you that the IPhone is my best choice!

To be more fair, let say Nokia has features that the IPhone doesn't have (like 5MegaPixel camera, very good video recording), and the IPhone has .... the rest ! I encoutered some problems with the IPhone, though. I wanted to do some simple tasks but the IStore doesn't have the application (for free of course!) that can help me with that. For instance, think about these simple tasks:

1. Sync Iphone calendar application with Google Calendar
2. Read PDF offlines, Save PDF on IPhone for offline reading
3. Save YouTube videos for offline viewing.

On my N95, I can do these things very easily by downloading goosync, acrobat reader, and Mobitubia or E.M.Tube. On the IPhone, I couldn't find anything on the IStore that helped me do that until I heard about "jailbreaking" the IPhone. The idea is simple: Jailbreak allows you to install 3rd party applications that are not available on the IStore. How great is that !?!

I followed this blog:http://iclarified.com/entry/index.php?enid=1881
and I started to like my IPhone a lot more!!!

1. I can sync my IPhone with Google Calendar the program NemusSync.
2. I can save YouTube videos with MxTube
3. I will eventually be able to read pdfs and store them ( I am still looking into this)

Once the IPhone was jailbreaked, I used Cydia to download these applications.

I also found from Cydia, I can install OpenSSH and tranfer files from my computer to the IPhone using the ssh protocol :)

Many more blogging to come about some cool things to do with the IPhone.