Raspberry Pi for Secret Agents

Raspberry Pi for Secret AgentsI recently had the honor to participate in the technical reviewing of a cool book about Raspberry Pi and fun applications for the famous mini computer. It shows you how to do many cool things like video/audio spying, GPS tracking, “network security analysis”…
If you liked my posts about the Raspberry Pi you will definitely love book, so I encourage you to grab a copy of the eBook or the printed book, because you will learn a lot, and it won’t let you down!

Partitura Polseres Vermelles per a piano

Polseres Vermelles (Pulseras Rojas, The Red Band Society) s’ha convertit en la sèrie del moment no només a Catalunya, també arreu del món. La banda sonora està composta en la major part per temes de grups catalans, però també hi ha algunes peces d’orquestra per Arnau Batallé. Per petició popular he fet la partitura d’una peça que en algunes ocasions sona amb piano sol, en d’altres acompanyat dels violins, però que per si sola ja té bastant de cos.

Descarrega la partitura de Polseres Vermelles (comenteu si us agrada :D )

For how long does “X” play Minecraft a day?

If you are a parent, a brother, a boyfriend or a girlfriend of someone who plays Minecraft you must have asked yourself this question: How many f**** hours does my son, girlfriend, boyfriend, father or mother play Minecraft a day? They are literally stuck to their computers day and night and you come to wonder if they actually do anything else.

The thing is you can’t control them, because you are not always there to check if they are playing or not, and they can lie you about how long they have been playing. In most cases they don’t even know the number.

Average Minecraft Player

Average Minecraft Player

Continue reading

Pianoforte 2010 – Jake Shimabukuro

Aquest cap de setmana he tingut temps per gravar una cançó que porto uns dies intentant amb ukelele però que encara no he aconseguit dominar. Davant la frustració he decidit interpretar-la fent una versió per a piano i dues flautes travesseres, i ho he gravat amb video per poder-ho penjar a Youtube.

La cançó és una obra de Jake Shimabukuro, un músic Hawaià i virtuós de l’ukelele de qui em vaig comprar un llibre de partitures recentment. El meu objectiu final és poder-la tocar tal i com la va concebre, per a 3 ukeleles, però em queda un llarg camí a recórrer abans no hi arribi!

Fins la propera!

Minecraft server recipies

These are some pieces of code I use to make my life easier when managing the Minecraft server I run.

The first of them is updating the server, because as everyone knows, every now and then the server needs to be updated in order to accept players with updated versions of their clients.

wget -O $HOME/server/minecraft_server.jar https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar

This line simply downloads the file from the Minecraft webpage server to the directory I have mine, overwriting it.

My server is open to almost everyone, and sometimes there is people that destroy things I build, maybe even without willing. For that purpose I have a mini script I run every now and then (although it could be added to a cron job for it to be executed periodically) that simply backups the current world status to a backup directory I called “world_backups”.

World backup mini script:

!/bin/sh
d=$(date +%Y%m%d%H%M%S)
mkdir $HOME/sever/world_backups/"world_at_"$d
cp -r $HOME/server/world/* $HOME/server/world_backups/"world_at_"$d
echo "Done!"

It uses the current date as an ID to differentiate one world from the other. It might take a while, but once it’s done, you will get prompted.

And finally one of the most useful scripts, the one that starts the server. It checks if it is already running, and if it is not, it starts it using the “screen” command.

Server start mini script:

#!/bin/sh
running=$(netstat -tulnap | grep 25565)
if [ -z "$running" ]
then
 echo "Minecraft server not running, starting it..."
 cd $HOME/server
 screen java -Xmx512M -Xincgc -jar minecraft_server.jar
 fi
else
 echo "Minecraft server already running!"
 screen -x
fi

I use the “screen” command because the server does not have a display so I access it through an SSH console. You don’t want your server to shut down whenever you close your connection to the server… If the server is already running, the command “screen -x” is executed so you get access to the Minecraft console again.

And this is everything for now!

Linux Minecraft Server 101

This post will guide you through the process of setting up a server as your Minecraft playground and opening it to the world to join and play.

Setting up a Linux Minecraft server for anyone to play in it is not difficult, but involves 3 steps.

  1. Make your network reachable from anywhere
  2. Make your router point your server machine
  3. Install the Minecraft server
Ironically, the third point is the easiest, so I’m going to try to make everything clear.

 

Continue reading

Raspberry Pi into an audio spying device

If you are a spy or work for the CIA or the FBI, this will come in handy in your knowledge. Given the size and price of the Raspberry Pi, it occurred to me that using it as a spying device (which are actually really expensive) would be really appropriate.

In this case, I’ll explain how to convert your Raspberry Pi into an audio streaming device, or audio spying device, however suits best to you. Use it under your own responsibility.

Plugging the microphone and loading the module

The Raspberry Pi has an audio output jack, but unfortunately there is no input port. We will then need a USB microphone. If you have one, keep reading, if not, go buy one ;) (or plug a webcam with microphone).

Once the microphone is plugged in, you might have to load the audio module by typing the following command if it isn’t.

sudo modprobe snd_bcm2835

Recording and playing a test file

Now we can try to record some audio into a file by running:

arecord -D plughw:1,0 test.wav

Just press CTRL+C once you think you’ve got enough recording. Now let’s play it to see if it works! But first, plug your earphones to the audio output of your Raspberry Pi!

aplay test.wav

Did you hear anything? Great! Your Raspberry is ready to “rock”ord some audio!

If you want to record louder or adjust some parameter, you can use the alsamixer tool to play with the input/output levels of your microphone.

alsamixer
Alsamixer
Alsamixer

Once you have set your settings, remember to store your changes:

sudo alsactl store

Streaming the audio to another PC

What we want to do next, is to give the Pi the capability to send this audio through the network, maybe to a server we have somewhere. In order to tho that, we will pipe the audio from the microphone into an ssh communication to the destination computer. As simple as:

arecord -D plughw:1,0 -f dat | ssh -C user@remoteip aplay -f dat

Now you have everything set! Switch on your speakers in the destination PC, and hear what the Raspberry Pi is spying from hundreds of miles!

Raspberry under the bed
Raspberry under the bed

In this (two overlapped and faded) pictures you can see my Raspberry Pi set under a bed, using a Wifi dongle, set to work as a baby-cry transmitter.

This might be useful in some situations ^^

See you!