PDFs from man pages

This is an old post. It may contain broken links and outdated information.

I’m constantly consulting man pages as I blunder about in bash, and a way to quickly reference man pages while in the middle of something else is very valuable to me. The easiest way, at least for me, is to have the man pages saved somewhere so that I can consult them without breaking away from whatever deep shell-fu I’m immersed in. There’s a quick way to convert man pages into PDFs on OS X, and a slightly different but similarly quick way to do the same thing on Ubuntu.

Read more

Easy PS1 colors

This is an old post. It may contain broken links and outdated information.

Some time back I found a nifty little function to nicely and neatly add color to my bash prompt, and to do so in a readable and easily editable way. I forget the site where I originally saw the function, so I apologize to its author for displaying it here without attribution, but it’s certainly made my life easier; I have my prompt set to display the time, the user name and host name where I’m logged in, the directory I’m in, and the root/other token. I’m a visual kind of guy, too, so I alter the user/hostname so that it’s a different color for each of the boxes I’m regularly accessing at home.

On GNU/Linux and OS X, the two operating systems I’m most frequently using, the prompt the user most often sees is stored in a variable named PS1. PS1 contains some pretty boring default values for most OSs, especially OS X, but fortunately we can make it a lot more informative and useful by modifying its value in the .bashrc file in your home directory, assuming you’re using bash as your shell—if you’re familiar enough with Unix and/or BSD to use a shell other than bash, you probably have your own ideas what PS1 should look like and probably think including colors in a prompt makes the baby Stallman cry. Or you use emacs for your operating system.

Read more

Reverse-proxying to a Drobo

This is an old post. It may contain broken links and outdated information.

Some time ago, I bought a Drobo FS to use as a home NAS device. My reasons for going with the Drobo instead of either rolling my own with something like FreeNAS or using a faster home NAS box from Synology or QNAP are complex, but they come down to a desire for an extremely simple-to-use NAS that I can throw hard disks into without worrying about doing anything at all with the disk layout (for a lot more on why and how, check part one of my two-part Ars Technica Drobo FS review). I gained many things coming to the Drobo FS from Windows Home Server v1, but one of the things I lost was the ability to easily and securely access the files on my NAS via the web.

The Drobo FS (and, indeed, most Drobo models) have the ability to run homebrew applications directly on the boxes themselves, though one barrier to simply porting a bunch of awesome utilities over and running them is that the Drobo FS runs on an ARM processor and aspiring Drobo app devs need to construct an ARM toolchain & cross-compiling environment in order to produce programs which will run. Drobo provides a small number of ported essential apps on their site, but the apps aren’t well-maintained or officially supported. There are a couple of web servers, an FTP daemon, an NFS daemon, an SSH daemon, and a few other things—enough to get you excited about the possibility of doing something really neat, but not enough to really do more than play around.

Enter DroboPorts, a site maintained by ambitious and skilled Drobo owner Ricardo Padilha, which offers an awesome variety of ported applications and libraries for the Drobo FS, including current versions of bash, OpenSSH, Python, PHP, lighttpd, Ruby, MySQL, and many others (along with instructions on building the aforementioned cross-compiling environment). The Drobo family of boxes will never be renowned for being speed demons or for having scads of free RAM or CPU to throw around on extra processes & applications like these, but there’s certainly enough capacity on board to let you run a web application or two, and this got me excited.

Read more

Setting up Octopress

This is an old post. It may contain broken links and outdated information.

I’m no superhacker, and the reason I at first passed up Octopress (which this blog uses) in favor of things like Wordpress and Drupal and Joomla is because of the wealth of documentation available for those platforms—and, more to the point, the ease of googling for the inevitable error messages. I tend to measure GNU/Linux activities not by the amount of time they take to conclude, but rather by their NTO rating—that’s “Number of Tabs Opened”. Every time I read about a configuration gotcha or pitfall that I need to remember, I’ll pop open a new tab and leave the important info up in its original; when I hit a roadblock or something doesn’t work right, it’s another Firefox tab and another trip to Google. Most of my Linux projects have extremely high NTO ratings, and getting Wordpress and MySQL/MariaDB going was no exception (and it didn’t help that I made an abortive attempt to use PostgreSQL as my back-end database, just for the hell of it).

Installing Octopress, on the other hand, is a relatively simple activity because the preinstall tasks aren’t that complex. There’s no database to configure and no PHP or perl to screw with; in fact, you don’t even need a web server, as Octopress comes with the built-in ability to publish itself to Github. You simply need Git, in order to pull down the software, and a functional Ruby framework, to do the page generating and compiling and publishing.

Here at Bigdinosaur.org, we’re currently running Ubuntu Server 11.10, with Nginx and php-fpm for serving static and dynamic web content. I didn’t have Git or Ruby installed, so I had to install these. There also ended up being two additional prerequisite packages I didn’t have, and not having them prior to installing Ruby caused significant problems with making Octopress work. To save any readers the same frustration I went through, I’ll list them along with everything else below.

Read more

Octopress and Nginx

This is an old post. It may contain broken links and outdated information.

Getting Octopress set up took a bit more time than I was expecting, because of the missing libraries issues I encountered. Fortunately, actually putting Octopress published and visible on the web took a lot less time.

The Bigdinosaur.org web server runs the latest stable version of Nginx, an event-driven web server which serves static pages faster than a fat kid eats pancakes. Nginx has a roughly similar concept of virtual hosts as Apache does, and because Octopress doesn’t require any databases and doesn’t use PHP or perl, it can be served with a very simple site definition file.

Most folks tend to be comfortable doing virtual hosts in the Apache way. If you install Nginx on Ubuntu from a repository (there is a Launchpad PPA with the latest stable release, which is several revisions newer than the one in the default sources), you’ll end up with an /etc/nginx/sites-available directory and an /etc/nginx/sites-enabled directory, with the former containing site definition files and the latter containing symlinks to those files, just like Apache. We’ll use those directories here.

Read more

Custom error pages

This is an old post. It may contain broken links and outdated information.

We gain a lot of quick flexibility with running Nginx on our back-end. I’m sure that there are ways to make Ruby & Ruby Rack do lots of nifty things, including fancy rewrites (and indeed theres a good amount of information out there to show you how to do just that), but it’s always going to be faster and more efficient to let the web server handle redirects and rewrites where possible, since it can do those kinds of things without having to pass information up and down the stack to another process.

Rewrites are a rich subject, but none are really necessary for hosting a simple blog. If you’re migrating to Octopress and Nginx from something else and you’ve got a significant amount of posts & history to bring along with you, you might indeed want to spend some time with Nginx’s rewrite module, which isn’t as deep as Apache’s but which is more than capable of addressing nearly every need. Rewrites are such a rich subject, in fact, that I’m not going to go into them any more than I already have. Chances are if you need to set up a bunch of rewrite rules, you’ve already dug up a bunch of other tutorials. For a single-user site with no history or cruft to bring forward, rewrites aren’t necessary; Octopress’s simple static layout is already “SEO friendly,” or at least uses human-parsable URIs.

However, error pages are something that we can quickly and easily customize. Nginx (as with most web servers) lets you specify custom error pages; the problem at first glance is generating a custom error page with the same look and feel as your Octopress blog, and that changes as your blog changes. Fortunately, Octopress’s ability to generate generic pages as well as blog posts comes to the rescue!

Read more

My God, how did I get here?

This is an old post. It may contain broken links and outdated information.

I had a blog once, a long time ago. Blogging is horrible and tiresome activity—one that made me feel rushed when I was updating and guilty when I wasn’t. Yet, here we are.

I think I’m doing this again for the experience of doing it with some modern software. My first blog ran Greymatter, a positively ancient piece of blogging software which its creator had abandoned even before I started using it. It let me shit out banalities as if they were chunks of golden wisdom, but it was clunky and difficult to deal with, though I didn’t know at the time that things got better.

Lately I’ve been hosting my own web site, which you can see by clicking the “Main Site” link at the top of the page. I used Apache on Ubuntu like every other newbie out there, but I knew as I dug more into making Apache do what I wanted that there had to be an alternative—using Apache to host a small personal web site is like your mom using Microsoft Word to write a shopping list. Yeah, it works, but does it really have to be that complex?

Read more