Tuesday, 20 August 2013

My Current Network

I just thought I'd create a diagram of what devices I have where in my network, with what names. It's beginning to get a little difficult to keep them apart.
Made a small batch script to check my network ips, just for fun.
for i in {1..150}
   ping -c 3 -w 100 10.0.0.$i | grep -e "icmp_req" -e "PING"
As you are no doubt aware, I've based the names of my devices, the naming scheme, on characters in Sir Arthur Conan Doyle's Sherlock Holmes.

Monday, 12 August 2013

Raspberry Pi


My current hardware setup seems to work okay with the Raspberry Pi.
  • Raspberry Pi model B
  • Pretty Adafruit Pi Box (Enclosure)
  • Belkin Gold Portable Audio Player-to-Stereo Cable (2xRCA male to 3.5 mm male)
  • Belkin USB 2.0 Micro B Cable
  • Sitecom USB 2.0 hub 4-port with power adaptor and weird USB port on top (ART. CODE CN-050 v1 002)
  • SanDisk Ultra SDHC Card 32 Gb class 10
  • Perimac USB 2 to Fast Ethernet Adapter
  • RCA cable (male to male) (I had one lying around)


  • mpd - Music Player Daemon (plays audio files in "/var/lib/mpd/music")
  • deluged - Deluge BitTorrent Client [2]
  • deluge-console - Deluge BitTorrent Client console
  • xbmc - X Box Media Center
  • Java JDK 8 - for the arm hf


  • wanted to have internet 'always on' without a lot of power/computers involved
  • wanted to be in control of the software
  • wanted to download stuff easily
  • wanted to be able to send my solar panels input to the internet during daylight hours
  • wanted to play music on my (very old) stereo
  • wanted to do stuff with our old TV
  • wanted new toys to play with

Trying Wheezy Raspbian

I've downloaded Wheezy Raspbian, nowadays with Hard Float, and put it on a 32 GB SD Card.
dd bs=4M if=2013-07-26-wheezy-raspbian.img of=/dev/sdb

Downloaded 2013-05-29-wheezy-armel.zip first, which is the Software Floating Point image. XBMC is compiled for the Hardware Floating Point image. So, it won't work. Originally, I had envisioned playing with Java, and Java SDK was not available for Hardware Floating Point at the time. This has now been remedied, luckily. So no reason not to use Hardware Floating Point.[5][6]

Installing XBMC

Now, I've already tried RaspBMC, and I didn't like the fact that my default linux network scripts were replaced by XBMC scripts. Especially, as I had a non-standard setup (two ethernet ports).

So I installed XBMC on a standard Wheezy Raspbian. [4]

My TV is Black & White?

My TV provided a black and white screen. Now, given I'm European, I assumed the TV to use PAL (Phase Alternating Line, 'Picture Always Lousy') and not the (American?) NTSC (National Television System Committee, 'Never The Same Colour'). NTSC is probably the default.

Added sdtv_mode=2 to /boot/config.txt (0 is NTSC, 1 is Japanese NTSC, 2 is PAL, 3 is Brazilian PAL.)[1]

Attaching a second Ethernet by means of USB

I'm wanting to use the thing (amongst other things) as my little firewall.

My second ethernet is detected. Yay! My /etc/network/interfaces file looks like:
auto lo eth0 eth1

iface lo inet loopback
iface eth1 inet dhcp
iface eth0 inet static

#allow-hotplug wlan0
#iface wlan0 inet manual
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp

I have my little firewall script in "/etc/network/if-up.d/" so it runs upon boot, after network setup. But I usually forget to turn on "net.ipv4.ip_forward" in /etc/sysctl.conf.

Root access

Root access to Raspbmc is disabled, and you should use 'sudo'. But you can turn it on. http://www.raspbmc.com/wiki/user/root-access/.

I was never a "sudo" guy, but I'm getting used to it.

Expanding the root partition by hand

My Second SD card provided the following problems, after indicating that the Raspberry Pi should expand the SD Card partition and reboot. As the other SD card I have did not have this problem, I surmise that the SD card is a bit dodgy. This is the message I saw (a lot) on the screen upon boot:

end_request: I/O error, dev mmcblk0, sector 137029
mmcblk0: error -110 transferring data, sector 137030, nr 185, cmd response 0x900, card statux 0xb00
So, I attempted to expand my SD Card partition on my labtop. That fixed the problem (for now).[7]


[1] RPiconfig
[2] How to Turn a Raspberry Pi into an Always-On BitTorrent Box
[3] RaspbianXBMC
[4] Michael Gorven's XBMC packages for the Raspberry Pi
[5] JavaFX on Raspberry Pi in 3 Easy Steps
[6] OpenJDK version for the Raspberry Pi
[7] RPi Resize Flash Partitions
Official Raspberry Pi Website

Tuesday, 6 August 2013

Old Gists

Recently found out I can refer directly to different revisions of a Gist, by adding the hashtag of a revision.

Instead of <script src="https://gist.github.com/maartenl/6048082.js"></script>.

This <script src="https://gist.github.com/maartenl/6048082/95c021aa4e2b1dc1570b5f70c2dcc95a26944fe1.js"></script> will show the revision with hashtag 95c021aa4e2b1dc1570b5f70c2dcc95a26944fe1.

It's very REST-y this way.

It provides an ideal way to show different refactorings in a blog.



Embedding a specific revision of a Gist on GitHub.com via JavaScript