Gradual Epiphany

An emacs mini-hack

There’s been a whole host of changes in my life since my last blog post. I left Ping back in August and am now working at The Hive. My wife and I also welcomed our first child into the world a few weeks ago. :)

At any rate, I’m now using emacs on a regular basis for editing C/C++ code and got tired of switching buffers manually between header (.h/.hpp) and implementation (.c/.cpp) files. So I hacked a little lisp for my .emacs to make life better. Maybe someone else will find this useful too..


;; Association list of extension -> inverse extension
(setq exts '(("cpp" . ("hpp" "h")) ("hpp" . ("cpp" "c")) ("h" . ("cpp" "c"))))

;; Process the association list of extensions and find the last file
;; that exists
(defun find-other-file (fname fext) (dolist (value (cdr (assoc fext exts)) result) (if (file-exists-p (concat fname "." value)) (setq result (concat fname "." value)))))

;; Toggle function that uses the current buffer name to open/find the
;; other file
(defun toggle-header-buffer() (interactive) (let ((ext (file-name-extension buffer-file-name)) (fname (file-name-sans-extension buffer-file-name))) (find-file (find-other-file fname ext))))

;; Bind the toggle function to a global key
(global-set-key "\M-t" 'toggle-header-buffer)

SSH Assistant for OS X

Over the past few weeks, I’ve been working on rewriting (for the most part) [SSH Assistant](http://sshassistant.org). The last version, 0.8.1 has a variety of issues with the installer and functionality. I really hate it when one has to run an installer with root access to install something that really doesn’t need root access. So, I’ve gone back and redesigned the app to be more amenable to a “normal” user install. I’ve yet to upload a build, but you can grab the source from my [personal repo](http://dizzyd.com/mercurial/sshassistant). I’m hoping to cut a 1.0.x release sometime in the next week or so.

When you build the new SSH Assistant, the output is a single pref pane bundle. Install that bundle by double-clicking on it. Then go into the pref pane and click the “enable” checkbox. You may have to logout so that it can setup your environment.plist properly, but that’s the extent of the install process.

Notes on creating an OpenBSD DVD

I recently rebuilt my gateway box using [OpenBSD 4.1](http://www.openbsd.org). It’s pretty easy to construct a DVD that ensures you have all the stuff you need for an install. The tricky thing is getting the DVD setup to boot. Herein are my notes so that the next time I need to do this I can remember how. :)

There are two tricks to get this to work. First, use the mkhybrid from [MacPorts](http://www.macports.org). Secondly, make sure that the location of the boot image is inside the hierarchy of files being burned to disk. I’m not sure why mkhybrid requires this, but it means the difference between working or not. Ultimately the command line should look something like:

> mkhybrid -joliet-long -iso-level 4 -r -b 4.1/i386/cdrom41.fs -c boot.catalog -o obsd.iso OpenBSD

← Before After →