Quick Web Searches Using the Terminal

Create shell aliases to quickly search reference sites from a terminal including DuckDuckGo, Wikipedia, Dictionary.com, AcronymFinder, Devhints, and FreshPorts.

I listened to episode #283 of The Changelog this week and learned about Devhints, which provides "cheatsheets" on a variety of development related topics. The hosts mentioned that the site looks good in Lynx, the text-based browser, but still asked about a shell script to parse it. I thought a shell script would be overkill: why not a simple alias that searches the site in Lynx?

Giving it a try, the obstacle is that aliases always include the space between the alias and its parameters. As usual, Stack Exchange provided the right direction. With some tweaking, I was able to add this alias to ~/.bashrc:

FreeBSD Shell Scripts Added to GitHub

I use some shell script libraries to make FreeBSD system configuration easier. They're now available as freebsd-scripts on GitHub for anyone to use and improve.

I recently switched my hosting provider from Digital Ocean to Vultr to get tighter control over the configuration—a more "pure" FreeBSD installation. While updating my notes to prep for the install, I considered how many configuration steps were basic file editing: add this line under that line, uncomment this line, comment that line, etc. I love the simplicity that comes when the code is the documentation, so I decided to create a small file I/O library to make it easier to write shell scripts for system configuration. Why bother maintaining notes to describe manual changes when I could write a script to perform the changes automatically?

I'm definitely not a shell scripting guru, but I thought these libraries could be useful for others as well. I leveraged them to create scripts that perform the full setup and configuration of my host and jail including the database and web server. I've released the libraries as part of a freebsd-scripts project on GitHub along with a couple of simple scripts to back up Apache and the system configs. I also added the portsfetch script, which I use to fetch the quarterly ports tree. I'm sure I'll share more shell scripts over time, so this gives me a single project to group them under. If you use them to create something useful, tell me about it in the comments below.

Enable Spell Check in Pidgin on FreeBSD

Easily enable Pidgin's spell-check feature on FreeBSD by adding a local dictionary.

Pidgin's spell-check feature doesn't work by default on FreeBSD, so I finally searched for a solution and found instructions to manually install spell-check support on Windows. That was useful enough information to get it working.

Simply download OpenOffice's U.S. English dictionary and save it to /tmp (or another convenient location). Then extract the required files as shown below:

Using Quarterly Ports on FreeBSD

FreeBSD 10.2 and higher use mismatched repos for packages and ports. This shell script simplifies updating your ports tree from the current quarterly branch.

Beginning with FreeBSD 10.2, binary packages installed using pkg are built from a quarterly SVN branch that only receives security and build updates once it's created. The goal is to provide a more stable software repository than the ports tree, which is constantly being updated and may even include broken ports at times. However, portsnap uses the latest/HEAD branch for the ports tree. Since mixing quarterly packages with current ports could lead to trouble, you have to choose one of these paths:

  1. Switch pkg to install packages from the latest/HEAD branch.
  2. Use SVN instead of portsnap to fetch and update your local ports tree.

Migrating from Feedly to Nextcloud News

It's easy to migrate RSS subscriptions from Feedly to Nextcloud News, but saved articles are more complicated. Here's a bit of JavaScript to simplify the task.

I'll admit to using a few cloud services in moderation, but I tend to choose privacy over storing my life on other people's computers. While I was on vacation at the end of 2016, I set up a Nextcloud server to replace my privately hosted and very outdated solutions for syncing contacts (Kolab over IMAP) and calendars (ICS over WebDAV). After setting it up, I was surprised to find a News app for Nextcloud that adds support for RSS/Atom feed subscriptions. Of course, there are also apps that provide access to those subscriptions from mobile devices. Stop allowing Feedly to monitor my online reading habits? That sounded like icing on the cake to me.

Nextcloud logo

Nextcloud: A safe home for all your data

Cruise to Jamaica, Grand Cayman, and Cozumel

For our 2016 vacation, we took a cruise to Jamaica, Grand Cayman, and Cozumel aboard the Carnival Splendor. It wasn't our favorite cruise, but we still had fun.

My family loves to travel and see new places. For vacation this year, we took a cruise to Jamaica, Grand Cayman, and Cozumel aboard the Carnival Splendor. While the ship wasn't great, it still got us to the places we wanted to see. Without finding yourself in a natural disaster, it would be tough to have a "bad vacation" in the Caribbean.

Carnival Splendor

How to Create Keyboard Shortcuts for PHP

I finally grew tired of typing the awkward PHP object operator. Learn how to create keyboard shortcuts for KDE and use my shortcuts for PHP as a starting point.

My preferred server-side language is PHP. It's powerful and flexible, but it's certainly not perfect. One of my pet peeves is the object operator (->). I've programmed in C++, so I can appreciate its heritage. It's simply not needed in this case, so it feels like overkill to have to repeatedly type such an awkward key combination. Why should I move my hand to the top row for one key and hold shift for another when a single dot would be perfect for the task? Is it solely a byproduct of the poor decision to use the dot for string concatenation? I finally got fed up enough to look for a solution.

As with many desktop environments, KDE allows you to configure keyboard shortcuts that trigger a specific set of keystrokes. You can create your own in System Settings -> Shortcuts and Gestures -> Custom Shortcuts. From the Edit menu, select New -> Global Shortcut -> Send Keyboard Input. On the Trigger tab, click the button and provide the shortcut you want to use. Then select the Action tab and enter the keystrokes you want the shortcut to send. Type out the words for meta keys like Shift and Alt, use + to indicate keys that should be pressed simultaneously, and separate the keys using a colon. For example, -:Shift+. will output - and > (the object operator). You can also use directional words (e.g., Left and Right) for the arrow keys to position the cursor within the output.

Getting Started With Estate Planning

We all die eventually and someone has to take our financial reins. A few hours of work now could save your survivors a lot of trouble in their time of grief.

This is my first blog post related to personal finance, but it's one of my favorite subjects to read about and discuss. I've loved numbers and math since a very young age, and personal finance gives me the opportunity to plan and strategize with numbers. What could be more fun? Needless to say, not everyone reads that question without thinking of a long list of things that would be more fun for them. My better half is one of those people, so I manage our household finances while she remains blissfully unaware. Like many other couples, that arrangement works well for us.

Although I enjoy planning for our future, there's one event no one likes to think about: their own death and/or their partner's. You could be the most fit 138-year-old the world has ever seen and still get hit by a self-flying car one day. Without a plan in place, your loved ones could be left not only grieving but panicking as well. I can only imagine how difficult it would be for the little woman to take over our finances even if I were here to answer questions. Going solo without my help would be a total mess. What about you: would your spouse or partner be prepared? What if the scenario were worse due to dying together in an accident or very close in time? In that situation (or for single people), someone even less familiar with your finances such as a child or parent would have to figure things out.

Search Shell History Using Arrow Keys

FreeBSD's root user can easily search its shell command history using the arrow keys. Add the same search capability in the Bash shell with this change.

By default, the FreeBSD root user can type part of a command and then search through history for previous commands beginning with those characters using the up/down arrow keys. If you're new to FreeBSD or csh, you might think the convenient shell history search is specific to root or csh/tcsh. Fortunately, it's not. You can get similar functionality in Bash by creating or editing ~/.inputrc to add the following lines:

# Allow history searching with the up/down arrows:
"\e[A": history-search-backward
"\e[B": history-search-forward

Chromebook for Power Users: Part 3

After installing Debian Linux in a chroot on my Chromebook, I slimmed LXDE down a bit before connecting to my FreeBSD desktop running xrdp.

This is the final post in a 3-part series on using a Chromebook as a power user. Part 1 gave a high-level overview of how I'm using my Chromebook and some basic Chrome OS configuration steps. Part 2 dug deeper to show advanced users how to use crouton to install Debian Linux in a chroot. This post finishes up by configuring LXDE and connecting to a remote FreeBSD desktop running xrdp.

Configuring LXDE on Debian