Recette libre du jour: Gratin de céleris

Friday, April 11th, 2014

A pro­pos

His­toire de changer un peu le ton du blog, voilà une recette que j’ai con­cotée hier soir. Comme toute autre chose, la cui­sine peut elle aussi suivre le mou­ve­ment du libre et gratuit :)

Je suis loin d’être un grand cuisto, mais je prends plaisir de temps en temps à appli­quer l’approche Do It Your­self (DYI) en cuisine.

Aujourd’hui, je vais vous présen­ter une recette de gratin de céleris sous license GPLv3, donc si vous décidez de la mod­i­fier vous devrez partager votre recette en retour ^^.

Ingré­di­ents pour 4 per­son­nes (ou 2 goin­fres, ou 2 per­son­nes pour 2 jours, ou.…)

Je vous ras­sure tout de suite, ce plat n’a stricte­ment RIEN de light! =)

  • 1 bon gros céleri
  • 4 grosses pommes de terre
  • 1 oignon
  • 400gr de haché porc/boeuf
  • 2 cubes de bouil­lon de volaille
  • du beurre
  • de l’eau
  • 25cl de crème fraiche
  • 20-30cl de lait
  • 50gr de gruyere
  • 50gr de parmesan
  • 2 càs de farine
  • sel
  • poivre
  • mus­cade

Pré­pa­ra­tion des pommes de terre et du céleri

On com­mence par éplucher/nettoyer les pommes de terre et les couper en morceaux (larges). Ensuite on les met à l’eau (salée). On fait atten­tion à ne pas laisser les pommes de terre trop longtemps (le but n’est pas d’en faire de la purée après ^^).

On net­toie le céleri et on le coupe en petits dés. Une fois découpé, hop à l’eau! Con­traire­ment aux pommes de terre, on peut laisser le céleri un peu plus longtemps dans l’eau pour le ramolir un peu (pas trop non plus).

Une fois cuit on égoutte et on laisse de côté.

Pré­pa­ra­tion du haché

Pen­dant que le reste cuit, on va hacher un oignon et le faire revenir dans une poêle avec du beurre. Ensuite, ajouter le haché, saler, poivrer et cuire en mélangeant fréquemment.

Une fois cuit on laisse ça de côté également.

Pré­pa­ra­tion de la sauce

Pour la sauce, on va com­mencer par faire fon­dre un peu de beurre à feu doux et y ajouter pro­gres­sive­ment  la farine. A côté de ça, on fait fon­dre un ou deux cubes de bouil­lon de volaille dans de l’eau (égale­ment à feu doux). On peut met­tre un peu plus d’eau que de coû­tume, ça fera plus de sauce au final :)

Une fois le(s) cube(s) de bouil­lon fondu(s), on y ajoute le mélange farine/beurre, une pincée de muscade.

Une fois le tout bien mélangé, on va y ajouter pro­gres­sive­ment le gruyère en le faisant fon­dre, tou­jours à feu doux. On peut à présent ajouter la crème fraiche et con­tin­uer de mélanger le tout.

A présent, on va saler et poivrer le tout selon nos goûts respectifs :)

Si le mélange est trop peu liq­uide, on y ajoute pro­gres­sive­ment du lait en mélangeant bien. La sauce ne doit néan­moins pas devenir trop liquide.

Pré­pa­ra­tion du plat

Pen­dant qu’on pré­pare le plat, on va préchauf­fer le four à 170–180°.

On va à présent beur­rer un (grand) plat à gratin et y étaler une couche de pommes de ter­res coupées en tranches (~0.842cm d’épaisseur cha­cune). On y ajoute une bonne dose de cubes de céleri puis une dose de haché pour ter­miner par une couche de sauce.

On recom­mence l’opération jusqu’à tout avoir mis dans le plat en prenant soin de ter­miner par une couche de sauce cou­vrant toute la surface.

Finale­ment, on va recou­vrir l’ensemble avec le parme­san, voire une petite noix de beurre pour les plus gourmands.

Cuis­son

Une fois que le plat est prêt, il ne reste plus qu’à l’enfourner pour 25 min­utes, suiv­ies de 5–10 min­utes en posi­tion grill afin de bien faire dorer le parmesan.

Le résul­tat

Si tout se passe bien, ça devrait ressem­bler à ça:

Bon appétit! :)

Diablo 3 Stats Calculator v2 (EN)

Friday, March 21st, 2014

Whad­da­HellIsThis??

A few months after the release of Dia­blo 3, being a pas­sion­ate player & pro­gram­mer, I’ve devel­oped an online stats cal­cu­la­tor. With the release of patch 2.0 & the Paragon 2.0 sys­tem, I’ve decided to update it.

It will shortly come really handy with the release of the Reaper of Souls exten­sion (i.e., next week heh!)

Here’s the kind of infor­ma­tion that the tool will pro­vide you with:

 

 

Where is it?

The tool is avail­able online at the fol­low­ing address: http://dsebastien.net/d3FarmingXP/

 

How does it work?

In order for the tool to be able to cal­cu­late sta­tis­tics for you, you need to pro­vide it with infor­ma­tion about the XP that you gain. To do so, there’s a lit­tle form to fill-in for each “Run”.

A run can be a sin­gle game (i.e., I join a game, go berserk and kill every­thing in sight then leave the game) or it can be a series of games. Per­son­ally I usu­ally encode mul­ti­ple games at once, as it gives me a more real­is­tic view over the XP that I gen­er­ate per hour for a par­tic­u­lar run (e.g., CoTA).

You need to pro­vide the fol­low­ing information:

In the pic­ture above, here’s the infor­ma­tion that I’ve provided:

  • My paragon level before start­ing the run
  • My paragon level after start­ing the run (in this case I didn’t gain a level dur­ing the run)
  • The XP that I had at the begin­ning of the run (real value / 1000 for simplicity)
  • The XP that I had at the end of the run (real value / 1000 for simplicity
  • The dura­tion of the run (in minutes)

Basi­cally, noth­ing com­pli­cated. Once you click on ‘Save’, the run is added to the list and all the sta­tis­tics are cal­cu­lated again.

In order to make it eas­ier to track the time spent, there’s a lit­tle stop­watch below the form. You click the ‘Start/Pause’ but­ton once at the begin­ning and once at the end then press ‘Copy’ to get the amount of min­utes added to the form.

About the XP at the beginning/at the end, the value to insert is the real value (what you see on screen) divided by 1000. The goal is to sim­plify the encod­ing (I couldn’t care less typ­ing all that garbage XP details). To make it clearer, here are a few examples:

  • If I see 1.000.000 XP on screen, then I encode ‘1000’
  • If I see 429.000.000 then I encode ‘‘429000’
  • If I see 1.249.527.223 then I encode ‘1249527’

Happy grind­ing and don’t feel too depress­ing while look­ing at the time needed to get to Paragon 1000 ;-)

Diablo 3 Stats Calculator v2

Thursday, March 20th, 2014

Kézako?

Quelques mois après la sor­tie de Dia­blo 3, étant à la fois un joueur assez pas­sionné et infor­mati­cien, j’ai développé un petit cal­cu­la­teur de sta­tis­tiques en ligne. Avec la sor­tie du patch 2.0 et du sys­tème Paragon 2.0, j’ai décidé de le met­tre à jour.

Ca tombe à pic puisque l’extension Reaper of Souls sort dans moins d’une semaine!

Voici le genre d’informations que l’outil pourra vous donner:

 

 

Où qu’il est?

L’outil est disponible en ligne à l’adresse suiv­ante: http://dsebastien.net/d3FarmingXP/

 

Com­ment ça marche?

Pour per­me­t­tre à l’outil de cal­culer les sta­tis­tiques, il faut lui fournir de l’information sur l’XP que vous gag­nez. Pour ce faire, il y a un for­mu­laire à rem­plir pour chaque “Run”.

Un run peut être soit une par­tie unique (i.e., je ren­tre dans le jeu, je tue tout ce qui bouge, je sors et j’arrête) ou une suite de par­ties. Per­son­nelle­ment j’encode en général des suites de par­ties en une fois afin d’avoir une vue plus réal­iste de mon taux d’XP par heure (puisqu’il prend alors en compte le temps entre par­ties, …). Il m’arrive d’encoder une par­tie bien spé­ci­fique quand je veux une idée pré­cise de l’XP générée dans cette par­tie particulière.

Les infor­ma­tions à fournir sont les suivantes:

Dans l’image ci-dessus, voilà ce que j’ai entré comme informations:

  • Mon niveau paragon avant de com­mencer le run
  • Mon niveau paragon une fois le run ter­miné (dans ce cas-ci je n’ai pas passé de niveau pen­dant le run
  • L’XP que j’avais au début du run
  • L’XP que j’avais en fin de run
  • La durée du run (en minutes)

En gros, rien de bien méchant. Une fois qu’on clique sur “Enreg­istrer”, le run est ajouté à la liste et les sta­tis­tiques sont recalculées.

Pour le temps, il y a un petit chrono en dessous du for­mu­laire que vous pou­vez utiliser pour compter à votre place :)

Con­cer­nant l’XP en début/fin de run, la valeur à entrer est la valeur réelle / 1000. Le but est sim­ple­ment de faciliter l’encodage. Quelques exemples:

  • j’ai 1.000.000 d’XP au début du run, alors j’entre ‘1000’
  • j’ai 429.000.000 d’XP au début du run, alors j’entre ‘429000’

 

Bon farm­ing et ne déprimez pas trop en regar­dant le temps néces­saire pour arriver Paragon 1000 ;-)

New gaming rig

Monday, December 23rd, 2013

Comme tout être humain bien con­sti­tué, un geek a besoin de se nour­rir.. sim­ple­ment pas comme les autres :)

La dif­férence se situe surtout au niveau du régime ali­men­taire; à côté du choco­lat, des chips, du coca & autres saloperies, le geek moyen a surtout besoin de bons com­posants électroniques.

Si des com­posants comme un Arduino, un Rasp­berry Pi, des strips de LEDs sont sym­pa­thiques, dans mon cas les com­posants prin­ci­paux com­mençaient sérieuse­ment à dater et sont à présent assez indigestes:

  • CPU: Intel Core 2 Duo (dual core)
  • Carte mère: Asus P5W DH Deluxe
  • RAM: 6GB Cor­sair XmX (je préfère ne pas me sou­venir de leur fréquence/CAS :p)
  • Carte graphique: Nvidia GTX 550 TI (1GB RAM)
  • Disque dur prin­ci­pal: Intel SSD 330 240GB
  • Tour: Ther­mal­take Xaser III maxi tower (sou­venir de gamer :p) (http://www.ldlc.be/fiche/PB00016773.html)

Cette con­fig était sympa il y a quelques années (4–5? :p) mais fin 2013 c’est devenu p-é-n-i-b-l-e.

C’est pour ça que je me suis décidé à remon­ter une machine un peu plus mod­erne. Après un petit tour du côté de Hardware.fr, AnandTech, Tom’s Hard­ware & co, mon choix a été vite fait:

Le tout pour un “petit” 1000€, ce que je trouve plutôt raisonnable au final. J’aurais pû viser plus haut au niveau de la carte graphique mais bon, il faut savoir rester raisonnable ;-)

Avec ça, je devrais être ras­sasié pour quelques années (au moins 2–3 j’espère ^^). En tout cas dans l’immédiat, je pour­rai enfin prof­iter des titres récents en 1920x1080 avec VSync, FSAA 48000x en gar­dant un bon framerate :)

Update 27/12:

Bon ben j’ai zappé un change­ment oblig­a­toire à ma con­fig: l’alimentation! Mal­heureuse­ment pour moi, la carte graphique et le CPU c’est plus gour­mand que dans le temps.. ;-)

Plus qu’une chose à faire, courir me chercher une Cor­sair RM 750 (http://www.corsair.com/us/power-supply-units/rm-series-power-supply-units/rm-series-rm750-80-plus-gold-certified-power-supply.html) et je pour­rai enfin prof­iter de l’engin..

Update 05/02:

 

Farewell Google Reader

Thursday, June 20th, 2013

Oh dear GReader, you’ll be missed!

greader trends

Raspberry Pi project — Car Audio improvement #3

Tuesday, May 28th, 2013

Update 2013-05-31:
I’ve received the hard­ware, time to play around! ;-)
In the mean­time, I’ve cre­ated a repos­i­tory on GitHub for this project. I’ll upload all the setup instruc­tions, code, etc in there: https://github.com/dsebastien/audioPi.

AudioPi Hardware

AudioPi Hard­ware

Update 2013-05-28:
I’ve ordered the hard­ware I needed for the project:

Now I just hope that I’ll be able to plug them both in, given that both USB ports are pretty close and I guess that the sound card is a big large ;-)


After pulling my hair over the fol­low­ing schema for a few minutes:

Scary ;-)

I’ve read stuff about Linux’s audio land­scape (grave­yard?) for a few hours. It reminded me of things long for­got­ten and made me dis­cover a lot I did not know about. Briefly said, I read about ALSA, PulseAu­dio, Jack, OSS, GStreamer (not enough yet), . This has been pretty instruc­tive I must say ;-)

I now have a bet­ter view of what’s hot and what’s not and more­over, about the pos­si­bil­i­ties. My con­clu­sions are that:

  • I want to out­put sound towards PulseAu­dio, which will then for­ward it towards ALSA & the sound hardware
  • I want to lever­age PulseAudio’s RTP sup­port so that I can use the sys­tem for multi-room audio

While doing my research, I’ve also read more about the Music Player Dae­mon project, and I think that it’s exactly what I need. Since it’s an head­less music player with a client/server archi­tec­ture, I can rely on it for the server side of things: actu­ally play­ing the songs, main­tain­ing the playlist, inter­act­ing with PulseAu­dio & ALSA, etc. I can also lever­age the dif­fer­ent plu­g­ins it pro­vides, such as the out­put ones.

Another ben­e­fit of using MPD as back­end is that it auto­mat­i­cally broad­ens the usabil­ity of the solu­tion since there are (LOTS) of MPD clients (e.g., CLI, desk­top, web based, Android apps, etc), which is pretty awe­some as it pro­vides the means of con­trol­ling music play­back from many dif­fer­ent places.

On the other hand, I can imple­ment the client API of MPD in my audio engine (A) in order to extend the pos­si­bil­i­ties, as explained in my pre­vi­ous post (e.g., A2DP sup­port, LCD dis­play, etc).

It’ll soon be time to cre­ate the project’s GitHub repo ^^
I’ll try to find some time to update the schema and the rest of the pre­vi­ous post.. ;-)

Related links:

Raspberry Pi project — Car Audio improvement #2

Sunday, May 26th, 2013

I’ve worked a bit on my lit­tle side project. The more I think about it, the more I feel like it could be more than just a car audio improve­ment; it could be a full blown music box, as use­ful in the car as out­side of it.

Here’s an overview of what I cur­rently have in mind. Note that I’m still in the brain­storm­ing process, so I can imag­ine crazy stuff too.. ;-)

audioPi

A: Audio Engine

The Audio engine would be the con­trol cen­ter for the project. Its responsibilities:

  • Detect plugged-in USB devices and scan them for music to play
  • Receive orders from (B), ©, (F)
  • Fetch music from a con­fig­ured NAS or other online source (e.g., web radios, etc)
  • Man­age the playlist
  • Out­put audio towards (K)
  • Out­put song infor­ma­tion towards (I)
  • Inter­pret orders from (N)
  • Expose a Web UI (e.g., Lighttp + python/django)

The Audio Engine could expose its ser­vices through Web Ser­vices (e.g., rest­ful API)

B: Remote Con­trol Host

This com­po­nent (cus­tom hard­ware exten­sion?) could fur­ther extend the Audio Engine API by inter­pret­ing and for­ward­ing com­mands received from remote con­trol devices (e.g., RF commands).

To for­ward com­mands towards the Audio Engine, it could lever­age the Web Services.

C: Blue­tooth module

The Blue­tooth mod­ule could fur­ther extend the Audio Engine API by expos­ing it to paired devices. The paired devices could then send com­mands towards the blue­tooth mod­ule, which would inter­pret and for­ward the orders towards the Audio Engine.

Related links:

D: Phone application

As an exam­ple usage of the Blue­tooth mod­ule, a smart­phone appli­ca­tion (e.g., Android, iOS, Win­dows Phone) could lever­age the Blue­tooth fea­tures to pair with the Rpi and con­trol the Audio Engine. For example:

  • con­trol music play­back (play, pause, next, pre­vi­ous, enable/disable ran­dom mode, …
  • shut­ting down the Rpi
  • view­ing the cur­rent playlist, …

Related links:

E: Remote Con­trol Device

A cus­tom remote con­trol device could be cre­ated that would send com­mands towards the Remote Con­trol Host Device (B).
These com­mands could be a sub­set of those of (D).

Pos­si­bil­i­ties:

  • Wired
  • RF
  • IR -> use LIRC (http://www.lirc.org/)

On the

F: A2DP Module

The A2DP mod­ule would pro­vide stan­dard A2DP functionality.

Open ques­tions: link with the audio engine? Over­ride the cur­rent playlist?

Related links:

G: USB Devices

USB mass stor­age devices could be auto­mat­i­cally detected & scanned by the Audio Engine (A) in order to find & play music present on them.

Open ques­tions: how to detect USB devices as they’re plugged in? Behav­ior if music is already played from other sources?
Idea: cre­ate a list of all pos­si­ble audio sources and how to react when one of them is added/removed…

H: Car HUD

If we sup­pose that the Rpi does have a Blue­tooth mod­ule, it implies that it can con­nect to the Car. Now, even if the car does not sup­port A2DP, it could still expose some func­tion­al­ity through Blue­tooth. One of these might allow for some level of inte­gra­tion with the car’s HUD.

Although, this is more of a bonus than any­thing, I would place it at the bot­tom of my goals list for the project…

I: LED Display

A LED dis­play could be added to the project and could be used in dif­fer­ent fash­ions. For example:

J: Online audio

The Audio Engine (A) could fetch music from the Web if it gets Inter­net access (e.g., via Wi-Fi or Eth­er­net). There, pos­si­bil­i­ties are numer­ous: get music from a NAS, from Web radios, from online music ser­vices, etc.

The Inter­net access could also be used to send infor­ma­tion about playing/played music online (e.g., towards LastFM, Face­book, etc).

K: Audio output

The project could either use the onboard audio capa­bil­i­ties or an USB sound card or DAC. From there it could be plugged in dif­fer­ent types of speakers.

L: Smart­phone music streaming

As explained for (F), if the project sup­ports A2DP, music could be streamed from a smart­phone or other device…

M: SD card audio

If audio files are present on the SD card, these could also be played.

N: Voice recognition

Again I con­sider this as bonus, but it would be nice to be able to plug in a micro­phone and give orders to the Audio Engine (A) by speak­ing to it. It could be as “sim­ple” as rec­og­niz­ing orders such as “Play, Pause, Next, …”.

Related links:


The project could go even fur­ther than that, for exam­ple by pro­vid­ing a full blow Web interface, …

Raspberry Pi project — Car Audio improvement

Wednesday, May 22nd, 2013

Update 2013-05-24:
Thanks to Lau­rent, I now know more about the audio capa­bil­i­ties of the Pi. Sad news is that the on-board audio out­put ain’t that great (to say the least :p). One pos­si­ble solu­tion could be to use an USB sound card or

A sec­ond solu­tion would be to hook an A2DP adapter to the RCA inputs of the car, such as this one from Logitech.

Although the sec­ond solu­tion seems over­all bet­ter (pos­si­ble to pair dif­fer­ent devices to the A2DP adapter and stream any­thing to the car’s audio sys­tem of rely­ing on the pres­ence of an USB stick on the Pi, I think I’ll go with the Pi at first (oth­er­wise all the fun is gone :p).

My cur­rent idea is to use an USB sound card, maybe with the addi­tion of an USB Wi-Fi / Blue­tooh adapter so that I can obtain at least the same func­tion­al­i­ties as with the A2DP adapter. I found some, tuto­ri­als to do what I have in mind. I’ll check that out in the com­ing days.. :)

Some other links that might be use­ful (to me that is :p):


In my last posts, I’ve explained what I cur­rently do with the two Rasp­berry Pi I own. In this post, I’ll describe one project I now have in mind that I will prob­a­bly start work­ing on in the com­ing days.

My goal with this project is to extend the audio sys­tem of my car.

Cur­rently, all I can do in my car is to either lis­ten to CDs (clas­sic or MP3, which is pretty stan­dard by now) or the radio. Appar­ently, I can’t stream music towards the car using Blue­tooth because either my car, its spe­cific firmware ver­sion or my blue­tooth device does not sup­port the cor­rect Blue­tooth pro­file (A2DP protocol).

Rather bor­ing eh? Clearly, the Rasp­berry Pi could help here ;-)

For­tu­nately, my car has an RCA stereo socket that I can take advan­tage of.

For starters, my idea is to have the Rasp­berry Pi hooked up on the RCA socket and auto­mat­i­cally play­ing any audio files it finds (either on the SD card itself or on any plugged in USB disk). So that I don’t have to worry too much about it, I also want it to do that with­out any inter­ac­tion, mean­ing that from the moment it is booted up:

  • it should start play­ing the music it finds
  • if a USB device is plugged in, it should scan it for audio files to queue

Option­ally, it should remem­ber the last played song and start from there, or it could just play songs ran­domly. For this first phase, I think that con­sole music play­ers such as these might help me get started: cmus, sox, …:

  • http://archive09.linux.com/feature/124907
  • http://www.tuxarena.com/2011/12/10-console-music-players-for-linux/
  • http://ubuntuforums.org/showthread.php?t=1699260

Later on (and if I’m not sat­is­fied with what I’ve described above), I have addi­tional ideas:

  • since I want to learn elec­tron­ics, I could add some switches to sup­port basic con­trols (play, pause, next, previous)
  • since I also have music on other devices with Wi-Fi, I could add a USB Wi-Fi don­gle and be able to send music towards the Rpi
  • if I have the USB Wi-Fi don­gle, I could also find ways to remotely con­trol music play­back using a smartphone
  • I could try to find a way to plug into the car’s dis­play sys­tem and use it, like that thing does:

As with any project, the pos­si­bil­i­ties are end­less and so are the pos­si­ble paths from start to fin­ish. We’ll see how I get there! ;-)

Raspberry Pi SSH server

Wednesday, May 22nd, 2013

In this post, I’ll describe my Rpi SSH server con­fig­u­ra­tion. The media cen­ter Rpi is also inter­est­ing, but I didn’t have to cus­tomize many things since Open­ELEC is more like an appli­ance and apart from installing exten­sions and tweak­ing the sys­tem set­tings, there’s not so much one needs to do to get up and run­ning (which is good!).

RPi SSH server

I use my Rpi SSH server as a gate­way to reach home when I’m out­side (on the train over 3G or on some Wi-Fi net­work). It basi­cally allows me to access any­thing on my per­sonal net­work in a secure fash­ion (more over this after the setup details).

The con­fig­u­ra­tion is built on top of Arch­Linux and uses OpenSSH (who would’ve guessed ^^).

I’ve cho­sen Arch­Linux mainly because I’m already famil­iar with it, I could also have installed the Debian dis­tri­b­u­tion, I don’t think it would’ve pre­vented me from doing any of the following..

For the basic setup of Arch­Linux, I’ve fol­lowed this guide: http://elinux.org/ArchLinux_Install_Guide

After boot­ing it up for the first time, I still had a few things to configure.. :)

  • First things first: chang­ing the pass­word
    passwd
  • Updat­ing every­thing
    pacman-key --init (init pacman)
    pacman -Syy (update the packages db)
    pacman -Syu (full update)
    pacman -Syu (just because I'm a tad crazy)
  • Mod­i­fy­ing the time­zone
    nano /etc/timezone
  • Mod­i­fy­ing the host­name
    hostnamectl set-hostname rpissh
  • Set­ting a sta­tic IP
    actually not done yet, I rely on a DHCP reservation for now..
  • Mod­i­fy­ing the keymap
    localectl list-keymaps
    localectl set-keymap be-latin1
  • Updat­ing the hosts file in order to eas­ily access my home machines
    nano /etc/hosts
    ...
  • Resiz­ing the root par­ti­tion (because it sucks to use only a part of the avail­able space on the SD card)
    fdisk /dev/mmcblk0
    
    Welcome to fdisk (util-linux 2.22.1).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    Command (m for help): d
    Partition number (1-4): 2
    Partition 2 is deleted
    Command (m for help): n
    Partition type:
    p primary (1 primary, 0 extended, 3 free)
    e extended
    Select (default p): p
    Partition number (1-4, default 2): 2
    First sector (194560-31512575, default 194560):
    Using default value 194560
    Last sector, +sectors or +size{K,M,G} (194560-31512575, default 31512575):
    Using default value 31512575
    Partition 2 of type Linux and of size 15 GiB is set
    Command (m for help): w
    The partition table has been altered!
    Calling ioctl() to re-read partition table.
    WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
    The kernel still uses the old table. The new table will be used at
    the next reboot or after you run partprobe(8) or kpartx(8)
    Syncing disks.
    
    After a reboot:
    
    We’re deleting the rootfs partition, and creating a new one. Since there is no space between the boot and the root partition in the first place, the new partition will start at the exact same position as the just deleted partition. This means, we’ve got a bigger partition, with a smaller filesystem in there.
    We also observe the re-reading of the partition failed, since the partition is currently in use. Therefore we have to reboot in order for the new partition table to be known to the kernel. After reboot we can perform the resizing of the file system itself
    
    And finally, I could resize the partition:
    
    resize2fs /dev/mmcblk0p2
    
    resize2fs 1.42.6 (21-Sep-2012)
    Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
    old_desc_blocks = 1, new_desc_blocks = 1
    Performing an on-line resize of /dev/mmcblk0p2 to 3914752 (4k) blocks.
    The filesystem on /dev/mmcblk0p2 is now 3914752 blocks long.
  • Adding a user (which will be the only one allowed to log on via SSH)
    useradd -m -g users -s /bin/bash johndoe
        -m: create home folder
        -g: default group
        -s: shell
    passwd johndoe
    
    The same can apparently be done using:
    pacman -S adduser
    adduser
    > johndoe
  • Configuring/Hardening the SSH dae­mon
    Reference: https://wiki.archlinux.org/index.php/Secure_Shell
    
    nano /etc/ssh/sshd_config
    
    ...
    Port xxxxx # because the default port (22) is too dangerous to expose since it is targeted by all script kiddies & bots
    ServerKeyBits 4096 # because I'm paranoid even though it doesn't have huge security benefits :p
    LoginGraceTime 30 # 30 seconds to log on, after which the client is disconnected
    PermitRootLogin no # root cannot log in, even though I only allow public key authentication (again, doesn't protect me that much more, but still)
    PasswordAuthentication no # I don't allow password authentication, only public key auth
    ChallengeResponseAuthentication no # ...
    PrintMotd no # the less people know, the better I feel :)
    PrintLastLog no # same logic
    UsePrivilegeSeparation sandbox      # Default for new installations.
    AllowUsers johndoe # only user allowed to authenticate
    MaxStartups 10:30:100 # limit the number of connections -> http://stackoverflow.com/questions/4812134/in-sshd-configuration-what-is-maxstartups-103060-means

    I can prob­a­bly do more than this, but for now I’m ok with that. See my todo list below for more around this

  • Gen­er­at­ing & import­ing my pri­vate keys
    ...

Finally, since my plan was also to be able to wake up com­put­ers at home in case I need them, In installed the wol pack­age which allows to send magic pack­ets. All you need to use it is the mac address of the device you want to send a wake up call towards ;-)

pacman -S wol
su johndoe
cd ~
touch wol-pc1.sh
chmod +x wol-pc1.sh
nano wol-pc1.sh
> wol aa:bb:cc:dd:ee:ff

With that in place, I can now cre­ate a secure tun­nel from any­where towards my Rasp­berry Pi at home and feel “pretty” secure. It may not be so (I’m no secu­rity expert), but at least I’ve taken the nec­es­sary steps to ensure that only a moti­vated attacker will be able get in (using that chan­nel that is :p).

Once the SSH tun­nel is estab­lished, I can (for exam­ple) use the Rasp­berry Pi as a socks proxy to surf the Web more securely (e.g., if I’m on a pub­lic Wi-Fi hotspot).

I can also access any machine within my home net­work (router, NAS, PCs, etc) and wake them up if they’re not up and run­ning. This means that when I leave home, I can shut down every­thing and just leave the Rasp­berry up (3W ain’t gonna kill me :p) and use it to wake up the device(s) I need. I can also trans­fer files over SFTP, etc.

What I also do from time to time is estab­lish a Remote Desk­top ses­sion towards one of my Win­dows PCs using port for­ward­ing and it works sur­pris­ingly well..

My todo list for this project

  • install/configure fail2ban
  • con­fig­ure and auto­mate back­ups of the configuration
  • install/configure log­watch and send mail noti­fi­ca­tions once in a while (just in case)

Raspberry Pi

Wednesday, May 22nd, 2013

Raspberry Pi

What it looks like

The Rasp­berry Pi has opened up a lot of pos­si­bil­i­ties for many peo­ple. Even though there are prob­a­bly bet­ter alter­na­tives on the mar­ket by now, it remains a very attrac­tive plat­form for hack­ers, schools and even busi­nesses (who would’ve guessed). Many oth­ers have already cov­ered this in great lengths, so I won’t try to con­vince you for too long that the Rpi is pretty cool ^^.

This should tell you enough imho: being able to build a small (size of a credit card), pow­er­ful (capa­ble of play­ing videos in full HD), low power (ARM based, around ~3W) com­puter able to run mul­ti­ple Linux dis­tri­b­u­tions (Debian, Arch­Linux, etc) for as cheap as 50–70 EUR is just pure awe­some­ness ;).

In the upcom­ing posts, I’ll describe my cur­rent projects with the Rasp­berry Pi as well as some I still have in mind for later on.

My cur­rent config

Cur­rently, I own two of these lit­tle beasts and a third one might join these soon (more on this later). I use the first one as an SSH server, while the other one serves as a media cen­ter run­ning XBMC (Open­ELEC dis­tri­b­u­tion).

Build­ing those two didn’t take me long, although it’s the kind of never-ending project, there’s always some­thing to tweak, improve, fix, … you know what I mean.

Still I’m pretty happy with their cur­rent state ;-)