brunotavares.net: ScrapBook

Notes. tech and a few thoughs

Raspbmc and Edimax EW-7811Un wifi dongle

Just bough a Edimax EW-7811Un wifi dongle to use on my RaspberryPi. It´s a media center so its running Raspbmc ( which is based on rasbian ).

First of all, from my experience, raspberry needs to be powered by an ( at least ) 1A power source for the dongle to work as expected.

No drivers needed if your using RC4/Rc5. Since its a realtek chipset you can update the firmware drivers by typing:

sudo apt-get install -y firmware-realtek

Prepare your raspbmc by installing some helper packages:

sudo apt-get install -y wireless-tools wpasupplicant

Raspbmc uses NetworkManager to manage all your connections, the easiest way i found to configure the dongle was:

  • Install the Network-Manager XMBC plugin
  • Go to main menu and enter “Programs”
  • Start Network-Manager program
  • Select your network

Since i have a strange setup on my router this didn’t work ( authentication with the AP failed ) so, here is an alternate manual method:

Create a file a new file called /etc/NetworkManager/system-connections/Wireless

Paste the following as content of the new file

[connection]
id=Wireless
uuid=de997907-591e-11e2-8e39-359453556e75
type=802-11-wireless

[802-11-wireless]
ssid="YOUR NETWORK SSID"
security=802-11-wireless-security

[802-11-wireless-security]
key-mgmt=none
wep-key0="YOUR WEP ASCCI PASSPHRASE"

[ipv4]
method=auto

[ipv6]
method=ignore

Edit according to your wireless network setup, you can find settings reference here: http://projects.gnome.org/NetworkManager/developers/settings-spec-08.html

Important: the uuid setting must be unique amongst all your connections, choose an unused one

Restart your raspberry and then:

$ tail -F /var/log/syslog

Check if the interface is connecting.

If its failling just edit the config file ( /etc/NetworkManager/system-connections/Wireless ) and adjust your connection settings. As soon as you save the file NetworkManager will update the connection and tries to reconnect.

Tags: ,

Comments (1)

Quick http server for static files ( for development )

If you have python installed, change to your static file directory and

$ cd /files/html/
$ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...

This will start an http server on port 8000 that serves all files in the current directory.
All the debug is written to console including incomming requests and the server reponse to them.

If you want a different port just pass it as argument:

$ python -m SimpleHTTPServer 9595
Serving HTTP on 0.0.0.0 port 9595 ...

Tags:

Leave a Comment

Test network throughput between two machines

Recently i needed to test the network troughput between my file server and one of the file server clients.

I came across iperf, its a client-server command line utility that sends data between the server ( one of the machines of the pair you want to test ) and the client ( the other machine of the pair )

The usage is pretty simple, in one of the machines ( that will work as server ):

iperf -s -p 65000

On the other machine ( the client ):

iperf -c <ip of the server> -p 65000

After a few seconds:

...
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.1 sec  8.88 MBytes  7.34 Mbits/sec
...

Tags: ,

Leave a Comment

Google Analytics data from multiple profiles

If you ever need to get a integrated data report for multiple profiles you can get one here: http://gaevolution.appspot.com

Simple webinterface that aggregates multiple profiles from your GA account and produces a tabular report.

.. or you can always script arround the Data API

Tags:

Comments (1)

Finding your Ubuntu version


$ cat /etc/lsb-release

Tags: , ,

Leave a Comment

Cloning VirtualBox disk images

If you hope that a simple copy will make it.. it doesn’t. Apparently the unique disk indentifier (UUID) is embbeded in the image file.


$ VBoxManage clonevdi sourceimage.vdi destimage.vdi

Leave a Comment

Visual Diffs

For some time now i started to notice the amount of time i wasted in solving version conflicts. The GNU diff works great with small change sets, but having a visual diff tool helps a lot when you’re dealing with long files with lots of diffs.

I used several visuall-diff-editors whit the several version-control software and i currently use Meld: it’s gtk, has in-line edition ( let’s you change the working copy with a real-time diff computing ) and its “command line diff” and diff3 compatible which makes it work smoothly with version-control software.

So, for the both version-control systems that i use currently here is my setup

SVN

For a quick diff using meld just run:

$ svn diff--diff-cmd meld

For a permanent setup edit ~/.subversion/config and set the diff-cmd to meld

GIT

Write a small wrapper:


#!/usr/bin/env sh
meld $2 $5

and the just configure svn to use the wrapper as diff tool

git config --global diff.external /path/to/wrapper

Tags: , ,

Leave a Comment

Pikeo::API 1.00

It’s now on CPAN: http://search.cpan.org/~bmavt/Pikeo-API-1.00/lib/Pikeo/API.pm

Project page still available: http://projects.brunotavares.net/projects/show/pikeoperlapi

Tags: ,

Leave a Comment

Maintaining your namespace clean in Perl

Some modules like XML::Simple export some functions by default into your namespace. Normally you don’t want this functions since the module has a OO interface; so, how to avoid the auto-export from taint your namespace ?

You can, at include time, be careful and explicitly tell the module not to export anything by doing this:


use XML::Simple qw();

But what if you are using a bunch of modules and you aren’t really sure of everything each one of them exports? You can either tell each one to export nothing ( qw() ) or you can use use namespace::clean.

namespace::clean defines a pragma that cleans up your namespace from exported functions. When you use the pragma all the exported functions to that point are cleaned-out from your namespace.

So if your using a lot of modules you can use it like this:


use strict;

use Foo;
use Bar;

use namespace::clean; #all Foo and Bar exported functions are cleaned out from your namespace

use Carp; #croak is available on your namespace

...

Tags:

Leave a Comment

If you use Live HTTP Headers for Firefox …

… you really should ckeck out HttpFox : https://addons.mozilla.org/en-US/firefox/addon/6647

It provides all the information that Live HTTP Headers do (and more, like request time tracking ) but with better organization.

Leave a Comment