DPH.AM

I like to draw, code, and build stuff.

Chromebook for Developers

Acer Chromebook

I recently purchased a Chromebook to discover if it’s possible to effective code on it (spoiler: yes it is). I’ve been looking at cloud development options such as Digital Ocean and Nitrous.io for some time now. There were two reasons that finally pushed me to make the purchase; my awareness of the dust layer covering my Retina iPad and Kindle HDX, and the realization that I can replace both tablets with a light-weight 11” $200 laptop.

Acquiring the Chromebook was largely, as they say, for science. With that in mind, I kept track of everything I did since day one. The following is a hacker’s guide to configuring a fresh install of ChromeOS.

The essentials

Shortcuts

If you want to be efficient with any operating system, you must grok the default keyboard configuration and shortcuts. My first mistake on the Chromebook was remapping the Alt key to simulate the Ctrl key. The only benefit this added was allowing me to open new tabs the same I do on a Mac keyboard (Alt key is next to the Spacebar). I quickly realized how essential the Alt key is and how much I was missing by discarding it.

ChromeOS has a built-in shortcuts overlay which displays shortcuts on a virtual keyboard when a command key is held down. Access this menu by tapping Ctrl+Alt+/. Many other shortcuts stem from holding down the Alt key and some other key combinations. You can see other useful shortcuts in this blog post. Here are my personal favorites.

  1. Desktop Screenshot - Ctrl+switch window key
  2. Partial Screenshot - Ctrl+Shift+switch window key
  3. Task Manager - Shift+Esc
  4. Capslock - Alt+Search
  5. Mirror - Ctrl+Fullscreen

Trackpad

Why trackpads support physical clicks is beyond me. The first thing I do when I’m on a new Mac is change the trackpad gesture control - single tap triggers left click, double tap triggers right click, and three finger drag simulates left mouse down + mousemove (mouse drag). On ChromeOS, the first two are enabled by default. If you’re deranged, you can disable the single tap feature under Chrome Settings > Device > Touchpad Settings > Enable tap-to-click.

At default, the 3-finger drag gesture allows you to switch between tabs (a feature I’ve warmed up to), and there’s no way to change that gesture to mouse drag. The best thing you can get is one-finger tap drag. This option is hidden inside the “Show advanced settings…” section in the ChromeOS settings panel. Locate the “Enable tap dragging” option under the Accessibility section.

I must admit because of Apple inverted scrolling now feels natural to me. In fact, the normal scrolling direction invokes cognitive dissonance in me. On ChromeOS, this feature can be enabled by selecting “Australian scrolling” under the Touchpad Settings section.

Apps

  1. Secure Shell
    As a developer, this is the most powerful app you can arm yourself with. It’s absolutely essential for coding in the cloud. More on this app below.

  2. Remote Desktop
    Dead simple to configure! It’s good to have if you always keep your desktop on. If you have multiple monitors, it will show the screens side by side. I would prefer for it to shrink down to one monitor and take the screen resolution of the client, but I don’t use it enough for it to bother me.

  3. Image Editor - Pixlr Editor
    This is as close to Photoshop as you’ll get on the web.

  4. Image touchups and filters - Pixlr Touch Up
    A.K.A instagram filters app.

  5. Lightweight Text Editor - Text
    A general purpose text editor with dark and light themes as well as color syntax support for a wide variety of formats.

  6. Fully featured Code Editor - Caret
    I have this installed and used it only once, but only because I got Vim 7.3 along with all my config to work. I suspect this is the best option if you’re a Sublime Text fan.

Open App as Window

Chrome apps at default open in a browser tab. Right click on an app icon (either in the search panel or shelf) and you can change how the app will open. I like having dedicated windows for some of my apps. If you’re a Vim window-splittin’ ninja like me, this is an absolute must as Ctrl+w will close the current tab rather than send the window command.

Cloud development

I abandoned a ton of possessions when I left my Maryland suburban life and moved to Seattle 9 months ago. There wasn’t much of a choice; space is limited in the city, and so are the things we can stuff in there. I went from a 3500 sq ft single family home to a 780 sq ft one bedroom apartment (apparently that’s a decent size by Seattle standards). It turns out this was one of the most liberating experiences of my life. Detachment from physical belongings created a mindset shift that eventually got me yearning for a world where personal computing devices are obsolete. For developers, having a cloud dev environment is the first step towards this utopian world.

Free cloud environment with Nitrous.io

There are currently plenty of great options for cloud development. Digital Ocean offers SSD cloud servers at a very competitive price point. Cloud9’s free package gives you full shell/terminal access and an IDE workspace for a single private project. In the end, Nitrous.IO won me over because of three reasons: a feature-heavy product, a generous fremium offering, and an incredible Chrome application.

Nitrous.io makes it incredibly easy to set up a Ruby, Python, Go, or Node.js box with just one click. Of course you have a Debian shell and can install other packages using autoparts. They have a web IDE and terminal, allowing you to be productive anywhere you have access to a web browser. In fact, Nitrous.io’s Collaborative Code Editing service can create synergies between you and your fellow collaborators in a way a traditional local dev environment cannot achieve.

The most relevant reason why Nitrous.io is the perfect cloud service for ChromeOS is their Chrome app. The app provides an easy way to manage your dev box and comes equipped with an IDE and terminal. And yes, opening the app in window mode gets you around Vim’s Ctrl+W issue clashing with Chrome’s close tab functionality.

With Nitrous.io, you’ve essential resolved all your cloud development woes. If you don’t already have an account, I highly encourage you to sign up and take it for a spin. It’s free after all.

Secure Shell

Most cloud providers authenticate your connection using the ssh public key associated with your machine. Luckily Secure Shell gives you the option of importing a key and assigning it to a connection. Go to any Unix machine and run ssh-keygen to generate a pair of keys and store them on your Google Drive. You can now assign this pair to a connection in Secure Shell. If you have sudo access on the server machine, including this public key in the server’s authorized_keys file allow you to connect without authenticating.

I have stellar vision; the Secure Shell app comes with a default font size of 15pt which was a tad big for my taste. Further, at this font size, a vertical split in Vim does not provide adjacent buffers with at least 80 columns. To fix this, open up the console on any Chrome tab (Ctrl+Shift+i) and enter term_.prefs_.set('font-size', 12). Visit the Secure Shell FAQ page for other useful preferences.

Local Dev Environment

In the early days, all the “Chromebook for Devevelopers” guides showed you how to replace ChromeOS with Ubuntu. I’m currently composing and previewing this blog post off a local ruby server on my Chromebook, and I can assure you I still have ChromeOS installed.

Getting the full shell

ChromeOS ships with a shell called crosh which you can bring up by tapping Ctrl+Alt+t. It’s completely useless unless you enable developer mode and install crouton. Their Github repo contains installation instructions. If you need it spelled out for you, just follow steps 1 and 2 in this blog post.

Open Crosh in Window

Launching crosh actually activates the Secure Shell app, but for some reason it opens as a Chrome tab even though Secure Shell is set to open as a window. This wasn’t cutting it for me; as I mentioned above, the tab-close shortcut conflicts with the window operations in Vim. It turns out you can create a connection in the Secure Shell app to your local crosh shell. Just create a new connection, give it whatever label and username you want, but you must set the value in the hostname field to >crosh. There’s a Crosh Window app which automatically opens crosh in a dedicated window, but I’m partial to having all my shell connections under the same app (Secure Shell).

This gets you to the basic crosh shell, you must still type shell to enter full shell mode. At this point, you’ll save yourself a ton of time by adding the following to your .bashrc file: alias s='sudo enter-chroot'. Now jumping into your crouton environment is just a matter of sending the s command (short for start).

Locale issues

After cloning my unix configuration, I started to see warning messages related to locale. I traced it to the rbenv init call in my .zshrc. If you’re running rbenv (which you should) and have locale issues, here’s how you fix it.

  1. sudo apt-get install locales
  2. sudo locale-gen
  3. sudo dpkg-reconfigure locales

Extending your Storage

My Acer Chromebook has 16GB of flash memory, most of which are occupied by the Operating System. You only have storage issues if you’re utilizing your Chromebook for local development; Google gives you 15GB of Google Drive storage and is currently offering Chromebook users 100GB extra free of charge for a year. I have nothing in my Downloads folder - after installing node.js, ruby, python, and other essentials, I only have 8GB of storage left.

At the rate I was going, it won’t be long until I reach the capacity of the internal storage. I set out to find the best storage option based on three requirements: adequate storage space (at least 32GB), low profile attachment, and lightning fast speed.

Since I already have a 32 GB class 10 MicroSD card lying around, I went with a low-profile MicroSD adapter. It doesn’t sit as flushed in the SD card reader as I would’ve liked. However, it also doesn’t stick out far enough to worry me about accidentally breaking it in half the same way I worry about standard-size SD cards (photo). If you’re taking the SD slot route, here’s an alias that will save you a ton of time: alias sd='cd /media/removable/SD\ Card'. I keep the adapter glued to the SD slot and having an alias to jump directly to the SD card directory has been invaluable.

A note about low-profile MicroSD readers: there are plenty of Raspberry Pi MicroSD adapters smaller than what I’m using. Beware of the bulge from the MicroSD slot on these adapters, they will not fit in a standard SD card slot.

Another option if you already have a MicroSD card is a tiny USB 2.0 card reader. This is the smallest MicroSD card reader I found during my search. Many critical reviews claim that the reader stops working after a number of insertions. With our use case, the USB device is treated like a permanent fixture and will endure much fewer physical stress.

If you don’t have a MicroSD card handy, the most reliable and affordable storage option is the SanDisk Cruzer Fit. The MicroSD card I’m using has a 30MB/s transfer rating, but I’d be lucky to achieve 15MB/s reads. According to this review, the customer ran a simple test on a 1GB file and got 4.10MB/s write and 16.5MB/s read. This transfer rate should be more than enough to handle standard development.

Most Chromebooks are equipped with a USB 3.0 port, it’s a shame that the low-profile USB 3.0 flash drive market is so sparse. The best option I found is a line from Patriot with an overwhelming number of reviews about the device overheating. If ~15MB/s read is inadequate, it’s worth giving this USB 3.0 drive a try.

Comments