Convert cbr files to pdf

Here’s a quick tip. Generally when some of my good internet pirate friends share with me a comic book,1 it comes in the cbr format. There is no application for my Ubuntu phone to read these files (yet), but there are some good pdf readers. All I have to do is convert the files with some handy terminal commands.

A cbr file is just a group of image files compressed in the rar format. So, let’s uncompress the files in a temporary directory:

  dir=$(mktemp -d)
  cd $dir
  unrar x /path/to/file.cbr

And then let’s convert them to pdf:

  convert * /path/to/file.pdf

Open the pdf to check it is OK:

  evince /path/to/file.pdf

And delete the temporary directory:

  cd ..
  rm -rf $dir

Transfer to the phone, and enjoy.

Sharing the Wi-Fi connection through Ethernet

My apartment was clearly not designed for the Internet of Things. I have a weird set up to connect all my devices: there’s ADSL, Ethernet, Wi-Fi, powerline networking, 4G from a free promotion until I download 3GB and then 3G for the rest of the month... It’s crazy, and getting crazier as I have to test more and more devices for snappy. When I was about to throw a cable from the kitchen to the office I found about sharing the network (thanks Luis!). Now let me repeat a slightly modified version of part of Luis’ answer to show how I share my wireless connection through an ethernet cable with my test board.

  1. Open the network indicator.

  2. Click Edit Connections....

    image

  3. On the Network Connections dialog, click the Add button.

    image

  4. On the Choose a Connection Type dialog, select Ethernet.

    image

  5. On the Editing dialog, enter a name for the connection.

  6. Go to the IPv4 Settings tab.

  7. Select the Method Shared to other computers.

    image

  8. Click the Save button.

What’s left is to connect an Ethernet cable from your laptop to the board, give power to the board and wait for it to finish booting.

To get the IP of the board you can run the arp command (Thanks to Alex for the tip). It will show you the addresses of the neighbour machines. The one of your board will be like 10.42.0.?. Now you can ssh into the board using the default credentials (username ubuntu, password ubuntu) or the ones you configured.

image

This also proved to be useful during our first snappy maker night, when we had to connect many boards to play with the system.

Pro tip: If you are having problems connecting through ssh, you can connect through the serial console to check for errors.

Connecting to Snappy through the serial console

I’m working on Snappy Ubuntu with a BeagleBone Black Rev C and a Raspberry Pi 2. You can connect to the boards through the serial console to watch for errors during the boot process and to control the system. After my first burned cable I decided to write down the instructions to connect the cables to reduce the likelihood of my boards catching fire.

First, of course, you should flash the SD card with snappy. Then, get one of these FTDI cables that convert USB to serial. As this cable has the plugs separated, it will work for both boads. The black wire is ground (GND), the white wire is receive into the USB port, the green wire is transmit out of the USB port and the red wire is 5V power.

BeagleBone Black

The BeagleBone Black Rev C has 6 pins. There’s a white dot next to the first pin. Connect the black GND wire to the first pin, the green wire to the fourth pin and the white wire to the fifth pin. On the BeagleBone NEVER connect the red power wire.

image

image

Raspberry Pi

The Raspberry Pi 2 Model B has 40 pins. Here you can find a nice pinout drawing with the numbers and functions of the pins.

Connect the black GND wire to the sixth pin, the white wire to the eight pin and the green wire to the tenth pin. You can optionally power the Raspberry connecting the red wire to the second pin, but if you do this DO NOT connect the USB power connector as you can’t have both power sources.

image

image

Serial console

Install screen:

  sudo apt-get install screen

Plug the other end of the cable to an USB port of your computer and figure out the name of the tty device:

  ls /dev/ttyUSB*

And start the screen session on the serial terminal, replacing the /dev/ttyUSB? with the number of your device.

  sudo screen {/dev/ttyUSB?} 115200

Finally, insert the SD card and plug in the power source of the board. You will see the boot messages on your terminal and in the end you will be presented with the login prompt. The default user is ubuntu and the default password is ubuntu too.

image

Snappy has an SSH server preinstalled, so once you booted successfully you can login through SSH, which will give you a better experience. You can use the serial console to query the IP address of the board:

  ip addr show

And from a different terminal, replacing ip with the board IP address:

  ssh ubuntu@{ip}

Now you are ready to start playing with snappy on the board. Don’t miss the tour.

To exit the serial console, press CTRL+a and then k.

More information about the cables and the serial console

Awful Shape, what art thou?

JUPITER
[...]
Awful Shape, what art thou? Speak!

DEMOGORGON
Eternity – demand no direr name.
Descend, and follow me down the abyss;
I am thy child, as thou wert Saturn’s child,
Mightier than thee; and we must dwell together
Hencefoth in darkness. –Lift thy lightnings not.
The tyranny of Heaven none may retain,
Or reassume, or hold succeeding thee...
Yet if thou wilt–as ’tis the destiny
Of trodden worms to writhe til they are dead–
Put forth thy might.

on Prometheus Unbound, Act III, Scene I

There is no God

I was an infant when my mother went
To see an atheist burned. She took me there:
The dark-robed priests were met around the pile;
The multitude was gazing silently;
And as the culprit passed with dauntless mien,
Tempered disdain in his unaltering eye,
Mixed with a quiet smile, shone calmly forth:
The thirsty fire crept round his manly limbs;
His resolute eyes were scorched to blindness, soon;
His death-pang rent my heart! the insensate mob
Uttered a cry of triumph, and I wept.
“Weep not, child!” cried my mother, “for that man
Has said, ’There is no God.’”

on Queen Mab, Canto VII