Weekend Project - Exploring /usr/bin/ and /usr/sbin/

Have you ever wondered what all that stuff in your /usr/bin/ and /usr/sbin/ directories does? 

Probably not, but I have. 

True UNIX geeks will most likely scoff at me for my ignorance, but everybody has to start somewhere, right? The brute force approach to exploring those directories would have been to get a listing of every command and run man on each one individually. But that strikes me as awfully tedious and it seems like something that is just begging to be automated. So in my usual hacky manner I did. 

The NAME section of a man page usually gives a nice, succinct description of what the command does. I found a shell script that would extract sections from a man page. Unfortunately, OS X does weird formatting things when you pipe man’s output to a file, so I had to pipe it through the col command as an intermediate step. I then wrapped everything up into a Python script that would iterate through all of the commands in those two directories, grab the NAME section, and finally output it to file. 

This is far from a perfect solution, and I’m sure I’m missing out on some useful information or better ways of doing it. For example, error handling is managed by piping stderr away and then completely ignoring it. But it’s good enough for my casual browsing needs and it taught me a little bit about sed and some of the other tools available to me on my system. 

Pygame Examples - Pygame is something I’ve been meaning to look into. I’m not much of a game developer, but it supposedly does a good job just teaching you about Python.

Brati’s Lover - AppleScript Collection - A nice collection of useful AppleScripts. (via Macdrifter)

Linux Distribution Chooser - I’m not sure why I put this here, but if you should be looking for Linux distribution that fits your needs, this is a pretty neat way to go about it.

Interesting Links - Week 50, 2011

Platypus - Turn scripts into applications (via Brett Terpstra)

CodeRunner - More than a text editor, not quite an IDE.

Wake In Progress - Finnegans Wake, illustrated.

DeckPub - Interesting approach to publishing on iOS. 

Evernote Quick Search with LaunchBar

For the next installment of my Evernote and AppleScript series, I present a really simple script that allows me to search my Evernote database from LaunchBar:

Instead of switching to Evernote, clicking on the search field and typing my search, this lets me do it all from the keyboard without leaving whatever other application I happen to be using. I just invoke LaunchBar, switch to text entry mode, type my query and hit Return. Boom. A new Evernote window pops up with my search results.

Interesting Links - Week 49

Stallion Python Package Manager - A simple local-running web app that shows what Python packages are installed on your system.

SiriProxy - Hacking the Siri protocol for fun but not profit (incidentally, The Siri Protocol would make a great science fiction title).

Move The Web Forward - A bunch of great links about web technologies and how you can get involved in making the web work better.

How to use Firebug on your iPad and iPhone - Ever wanted to debug web pages on your iPad or iPhone? Well here you go.

Besides just being generally useful, this post is also a great example of making a simple prototype and iterating to make it better. Because how often do you land on the “best” answer on your first try, especially when it comes to programming?

Gabe was also a guest on a recent episode of the Mac Power Users podcast. They talked extensively about Keyboard Maestro, which is a tool I have on my radar to check out. If you’re interested in automating things, it’s definitely worth a listen.

Speaking of styli, this looks pretty damn cool.

(via Macgasm)

Devin Coldewey:

…despite being a third-class citizen in our world of capacitive touchscreens, being publicly ridiculed by Steve Jobs, and generally being considered a nuisance, the stylus isn’t something we should relegate to the company of floppy disks and CRT monitors just yet.

I can’t believe I’m linking to a TechCrunch piece, but I actually agree with most of it. A stylus can be extremely useful in certain circumstances. Ever tried signing a contract or endorsing a check with your finger? It comes out looking like a five year old got into a pack of magic markers.

I had the pleasure of hanging out (read: drinking) with Daniel at the Voices That Matter iPhone Developer Conference in 2009. He’s a great guy and an awesome Mac developer. His products MarsEdit and FastScripts make this blog happen.

Interesting Links - Week 48

Text Processing in Linux - Useful on the Mac too

einstein - NewtonOS emulator. Not something new to me, but it’s been getting some more love lately.

Amazon Kindle Source Code - I’ll never look at this, but still pretty nifty

playterm - Like looking over someone’s shoulder as they do stuff in a terminal.

70Decibels - Fun podcasts. British accents.

pickleDB - Kinda like plists.

Evernote Daily Log with LaunchBar

I’ve always thought Evernote would make for a workable place to keep something like a daily log, but I could never find a friction free workflow to make it happen. However, I was recently reminded that LaunchBar is more than just an application launcher and can execute actions, which can be AppleScripts. Since I know a little AppleScript, I wrote one that would basically solve this problem:  

Now all I have to do is invoke LaunchBar, hit space the switch to text entry mode, and type my text. A new note is created in the Log notebook with the current date as the title. If a note with that title already exists, the new text is appended to it. Each “entry” is prepended with a timestamp and the pipe character like this: 12:34:56 |. It also pops up a nice friendly message if, for some reason, there are two notes with the same name in the Log notebook.

If you choose to use this, and the format I chose doesn’t appeal to you, or you want to use a different notebook, it should be fairly straightforward to see where those things can be changed in the script. Of course after writing this I found another daily diary script that I’m sure is much better written than mine, so you can check that out as well if this sort of thing interests you.

I’m pretty happy with how this turned out, but sadly I can only use it on my Mac (and even then only until Apple kills off AppleScript support). It would be nice if I could use it on my iPhone/iPad and especially useful on the shitty PC they make me use at work. It’s not impossible to do on either platform, just not quite as smooth. If Evernote on iOS supported TextExpander Touch it would be helpful, but it doesn’t. Fastever does support TextExpander and could be used for creating the initial note for a given day, but I don’t think you can append to notes once they’ve been created. At work, I’m experimenting with Breevy and the PC client and it’s working ok so far. But these are still workarounds; no amount of text expansion will change the fact that I still have to launch the application instead of just hitting a quick keyboard shortcut. That friction could make all the difference between actually using it regularly and not.

Interesting Links - Week 47

I really enjoy Brett Terpstra’s web excursions, so I’ve decided to shamelessly steal the idea. Look for new installments Saturday-ish (unless I don’t find anything interesting to share).

Here are this week’s links:

Calepin - Markdown + Dropbox = Blog.

(An ((Even Better) Lisp) Interpreter (in Python)) - Title says it all.

SmalltalkHub - A source code repository for, and written in, Smalltalk

Followup: Book Cover Images

A quick followup to my stealing Amazon image cover images post. I wrote a short AppleScript that will let you grab a one-off. First you’ll need to visit the book’s page on Amazon, highlight the ASIN in the location bar and copy it to the clipboard. Then run this little guy:

Assuming you stay on the item’s Amazon page, it’ll be replaced with just the image, which you can then drag out of Safari. 

If, for some crazy reason, you use Google Chrome, this script will mostly do the same thing:

This whole process is still not as automated as I’d like it to be, but it’s getting better.

Send keystrokes from your Mac to your iOS (or Android, if you must) device. It even works with a Bluetooth keyboard that’s paired to your Mac.

(via osxdaily)

Current status (Taken with instagram)

Current status (Taken with instagram)