Repairing a Botched Arch Linux Kernel Upgrade

I made the jump to Arch Linux on my personal and work computers a few years ago. Ubuntu was a dependable experience, but a combination of issues with the Debian way of life (slow progress) and Canonical's stewardship of the project (e.g., Snaps) convinced me it was time to try another distribution.

It's been a great experience. Pacman is a wonderful package manager, and AUR is everything I wanted PPAs to be. I get the latest versions of packages (including the Linux kernel) shortly after they're released. Of course, that isn't always a good thing, but rolling back to an older version is straightforward.

I recently stubbed my toe in a way that's unique to Arch - my computer crashed while I was in the middle of upgrading my kernel. What's great is I was able to recover with only an hour or so of downtime. What happened?

Read more…

Switching to NeoVim (Part 1)

2016-11-03 Update: Now using the XDG-compliant configuration location.

NeoVim is all the rage these days, and I can't help but be similarly enthused. Unlike other editors, which have varying degrees of crappiness with their Vim emulation, NeoVim is Vim.

If it's Vim, why bother switching? Much like all squares are rectangles, but not all rectangles are squares, NeoVim has a different set of aspirations and features. While vanilla Vim has the (noble and important) goal of supporting all possible platforms, that legacy has seemingly held it back from eliminating warts and adding new features. That's both a good thing and a bad thing. Good because it's stable, bad because it can lead to stagnation. A Vim contributor, annoyed with how the project was seemingly hamstrung by this legacy (with its accompanying byzantine code structure, project structure, and conventions), decided to take matters into his hands and fork the editor.

The name of the fork? NeoVim.

It brings quite a lot to the table, and deserves a blog post or two in its own right. I'll leave the diffing as an exercise to the reader. I plan on writing about some of those differences as I do more with the fork's unique features.

Read more…

Accessing Webcams with Python

So, I've been working on a tool that turns your commit messages into image macros, named Lolologist. This was a great learning exercise because it gave me insight into things I haven't encountered before - namely:

  1. Packaging python modules
  2. Hooking into Git events
  3. Using PIL (through Pillow) to manipulate images and text
  4. Accessing a webcam through Python on *nix-like platforms

I might talk to the first three at a later point, but the latter was the most interesting to me as someone who enjoys finding weird solutions to nontrivial problems.

Perusing the internet results in two third-party tools for "python webcam linux": Pygame & OpenCV. Great! Only problem is these come in at 10MB and 92MB respectively. Wanting to keep the package light and free of unnecessary dependencies, I set out to find a simpler solution...

Read more…

TrackPoint controls in Linux

So it seems as if the most recent updates to Kubuntu 12.10 have resulted in a stable graphics experience on my NVidia optimus chipset. As a result, I can now live in penguin land 24/7.

However, transitioning from a fully Lenovo-supported OS (Windows) to a "we'll allow it" OS (Linux) presents it's own set of issues. One can mostly muddle through with enough Google-fu, but one thing that has always vexed me is configuring my TrackPoint (the "red eraser" that TPs are infamous for). The default pointer calibration settings exposed by KDE's system settings are pretty minimal - only allowing me to configure a handful of settings that would apply to both the TrackPoint as well as the touchpad. Not very fun. I set about digging, and found something that worked for my ThinkPad T530:

  1. Install Sysfs: sudo apt-get install sysfsutils

  2. Then, enter a root shell: sudo su

  3. Observe the values of the two settings we care about:

    cat /sys/devices/platform/i8042/serio1/serio2/speed


    cat /sys/devices/platform/i8042/serio1/serio2/sensitivity
  4. To alter your TrackPoint's speed,

    echo -n 110 > /sys/devices/platform/i8042/serio1/serio2/speed

    Possible values fall within the the range of 0 - 255, inclusive. Since the results are immediate, you can use trial and error to find a suitable speed.

  5. To alter your TrackPoint's sensitivity,

    echo -n 260 > /sys/devices/platform/i8042/serio1/serio2/sensitivity

    Possible values fall within the the range of 0 - 255, inclusive. Since the results are immediate, you can use trial and error to find a suitable sensitivity.

  6. Once you've settled on the appropriate values, you'll need to make things permanent. Open your rc.local file and insert the following lines before the "exit 0" return statement:

    echo -n 160 > /sys/devices/platform/i8042/serio1/serio2/sensitivity
    echo -n 110 >  /sys/devices/platform/i8042/serio1/serio2/speed

    Be sure to replace my values with the ones you deduced in the previous two steps.

And that should do it! There's a graphical tool for managing this, called configure_trackpoint, but it has a whole bunch of Gnome dependences. shudders