Raspberry Pi

Image source

For a very long time I have been trying to find a way to maintain my blog on my iPad that doesn’t leave me frustrated. With the Raspberry Pi and the new ecosystem of iPad apps that are centred around the Files app, I finally have a way that is comparable with what I can do on my Mac. This setup provides the “distraction free” environment that those beautiful nerds have been raving about for so long, and will give me the countless hours of tinkering that I crave.

It all started with a Tweet

That lead to YouTube videos

That lead down this rabbit hole.

Basic Configuration

After purchasing a Raspberry Pi 4 and case, we install the Raspbian OS in the usual way, you can find out how to do so on the raspberrypi.org website. Since Ethernet over USB-C is not enabled by default you’ll have to follow Ben Hardill’s guide. In Ben’s guide, his last instruction is to add the line /root/usb.sh to the /etc/rc.local file. The added line should be sh /root/usb.sh - note the extra sh at the start.

To configure the Raspberry Pi you’ll want to run sudo raspi-config, if you want to access the GUI you’ll want to turn on VNC from the Interfaces menu and set a resolution under Advanced -> Resolution. You can then access the Pi from the RealVNC client on your iPad.

To manage multiple Wifi networks: sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

To view that the wifi interface is connected: iwconfig

Generate ssh keys: ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

The mosh shell provides stabler SSH connections when on a mobile device and be installed by running sudo apt-get install mosh and that’s it!

Don’t forget to used the sudo shutdown now command to shutdown when done.

File Server

To install a Samba server sudo apt-get install samba samba-common-bin, the samba server has issues with the files app when creating new files but is useful for interacting with a Mac (or PC).

Configure with sudo nano /etc/samba/smb.conf

To add additional directories to smb.conf

[mystorage]
   comment= my home storage
   path=/home/storeuser/share
   browseable=Yes
   writeable=Yes
   only guest=no
   create mask=1770
   directory mask=1770
   public=no

To add a user sudo smbpasswd -a pi

To restart Samba sudo service smbd restart

Disk Management

exFAT is my preferred filesystem for external froves since it is platform agnostic, to add support for this I ran sudo apt-get install exfat-fuse exfat-utils.

Since the Linix command line doesn’t automatically mount disks, we need to do this with the command line. First we need to list all the disks sudo fdisk -l to find the path of the disk and then to mount and exFAT run something like sudo mount -t exfat /dev/sda1 /mnt/usb0 -o uid=pi,gid=pi. For fat32 run something like sudo mount /dev/sdb1 /mnt/usb1 -o uid=pi,gid=pi. When you’re done unmount with something like sudo umount /mnt/usb1. If you get a message saying the target is busy, check what is using the device with something like sudo lsof +f -- /mnt/usb0 and then kill it in the usual fashion or just shutdown.

iPad apps

Files

The built-in Files app is the center of this system. Its integration with third party apps makes it a go-between for all the other apps, so much so that if an app doesn’t integrate it’s a deal breaker.

Blink Shell is a SSH and Mosh (mobile shell) client for the iPad, seems good so far. What I like about this over prompt is that you are provided with a shell as soon as you open the app.

Secure Shellfish

Secure Shellfish is a SFTP client that integrates nicely with the files app, it is a integral part of this system.

iA Writer

iA Writer is an app for writing markdown on the iPad. Previously I had been using Drafts for this but it had bugs with moving the cursor with the two finger gesture. So far this app has been excellent, I look forward to exploring it further.

Shortcuts

The canonical automation app for iOS has a SSH action, it can also create files on the Pi through Secure Shellfish. I can’t wait to see what I create with this.

Textastic

Textastic is the way to do development in this ecosystem of apps, it allows you to select a directory from the files app as a project and then work on the files I that project. It has tabs, supports all the main languages with syntax highlighting and autocompletion. I have only begun to scratch the surface of what this app can do.

Working Copy

Working Copy is a git client that integrates with the Files app. It is what I use when I don’t need or want to plug in to the Pi.

Jekyll

Jekyll is a static site generator that I use for this blog, it is nice to have a preview before I publish a post. To install I ran:

sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-get install ruby-full
sudo gem install jekyll
sudo gem install bundler

and then ran bundle install from the project root. Now I can run bundle exec jekyll serve --host 0.0.0.0 --incremental and view the page in Safari at http://10.55.0.1:4000 while I edit the files via Secure Shellfish.

Calibre

Calibre is a powerful eBook management system, you can use it to manage books and comics that you get through places like Humble Bundle. It has a pretty comprehensive set of command line utilities, a decent web interface, a GUI front end, some powerful integrations and an extremely impressive conversion engine. Highly recommended for anyone who owns an eReader.

To install Calibre run apt-get install calibre

To run the web interface run something like calibre-server /mnt/usb0/calibre/, this will create a web interface on 10.55.0.1:8080. Very handy if you want to read on the iPad.

Run a search to get the id calibredb list --search "Charles Stross" --with-library /mnt/usb0/calibre/

Export to Kindle using something like sudo calibredb export --with-library /mnt/usb0/calibre/ --to-dir /mnt/usb1/documents/ --progress 1234 where 1234 is the id from your search. The problem with this is that it will not convert to the Kindle format. So if you don’t have the a copy in that format in your Calibre library, you won’t be able to read it on your Kindle. Therefore, the best way to copy files to the Kindle is through the GUI.