Featured: Raspberry Pi + Ruby + GPIO = AMAZING FUN
My little Ruby Gem (Pi Piper) has been featured in a video, courtesy of Josh Adams!
The original article can be found here.
Thanks Josh!
Backup and restore a Raspberry Pi SD card
This topic has been discussed numerous places throughout the Internet, but I always find myself having to re-google this every time I need it. For my own reference, the steps to backup an SD card on OS X are:
- Insert the SD card into your Mac (seems obvious)
- From terminal, run `df -h` and make note of your SD card. My shows up as "/dev/disk2s1"
- Launch Disk Utility, and "unmount" that partion. (Note: do not eject it).
- From terminal, run dd to backup. If the partion noted in df was "disk2s1" we'll be backing up "disk2". For example: "sudo dd if=/dev/disk2s1 of=my-backup.img bs=1m"
That is it for backing up. To restore an SD card from backup:
- Insert the target SD card into your Mac (again, obvious, right?)
- From terminal we'll run `df -h` again to verify the correct device. Though unlikey to have changed from the restore step, it's always good to double check this. A mistake here will result in you toasting something.
- From Disk Utility "unmount" the partion noted in step 2. (again, do not eject it)
- From terminal we'll run dd to restore our SD card from backup. If the partiion noted in step 2 was "disk2s1" we'll be restoring to "disk2". For example:
When storing a backup image long term (e.g., for anything longer than simply backing up to immedately restore to a new SD card), I compress my backup files.
To compress, simply:
- gzip -9 my-backup.img
To decompress:
- gzip -d my-backup.img.gz
That should be it, have fun!
Ruby 2.0 on the Raspberry Pi
With Ruby 2.0 having just been released, I figured I'd give it a try on my Raspberry Pi (Raspbian OS). Other than, obviously, taking a while to compile the steps were pretty similar to those I've used before on OS X.
Firstly, if you don't already have RVM installed, installed RVM.
One odd thing I noticed about installing RVM on the Pi was that it automatically started compiling Ruby 2.0. I don't remember RVM automatically compiling any previous version of Ruby, but in either regard it's for not. Allowing it to complete the compilation will result in a somewhat functional Ruby, but the moment you run "gem install" you'll be greated with the following error:
ERROR: Loading command: install (LoadError) cannot load such file -- openssl
The solution for this is to allow RVM to install an openssl package, and then to re-compile Ruby.
rvm get head rvm pkg install openssl rvm reinstall all --force
Powered by Typo – Thème Frédéric de Villamil | Photo Glenn