Friday, July 17, 2015

Building Ruby on Raspbian

Building Ruby on Raspbian using rbenv & ruby-build will fail:
$rbenv install 2.2.2
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?


You need the package libssl-dev to resolve the above error and also package libreadline-dev to fix issues with irb.

Monday, April 06, 2015

Playing music using omxplayer on the terminal

On my Raspberry Pi I use something called omxplayer on the command line to play MP3 & MP4 files. omxplayer by default should be installed on Raspbian. To play music using the hdmi monitor speaker issue the following command:
omxplayer -p -o hdmi my_music_track.mp3

Useful key bindings to control omxplayer while playing:
q exit omxplayer
p / space pause/resume
- decrease volume
+ / = increase volume

I use the following command in the terminal to play all my music in the directory ~/music in shuffle mode:
for f in $(ls ~/music/*.mp3 | shuf); do echo "Playing: $f";omxplayer -p --vol -1800 -o hdmi $f; done

Enabling firewall on Raspbian

One of the first lines of defence in securing your Pi or Linux is a functioning firewall. In the past, this was often done through complicated and arcane utilities. There is a lot of functionality built into these utilities, iptables being the most popular nowadays, but they require a decent effort on behalf of the user to learn and understand them. Firewall rules are not something you want yourself second-guessing.

To this end, UFW is a considerably easier-to-use alternative. UFW, or Uncomplicated Firewall, is a front-end to iptables. Its main goal is to make managing your firewall drop-dead simple and to provide an easy-to-use interface.

First you will need to install it on Raspbian:
sudo apt-get install ufw

Then enable it by:
sudo ufw enable

UFW’s defaults are to deny all incoming connections and allow all outgoing connections, once you need to change the defaults rule, then you can use man page for UFW. The defaults are in most cases all you need.

You can check the status of your firewal rules by typing:
sudo ufw status verbose