Wednesday, November 14, 2007

Improvements on the Wikipedia Script

(Edit: Blogspot is lame, if I set nowrap on an element then it will cut off the text at the preconfigured length.)

(Edit: apparently blogspot's preview of the code tag behaves differently from the actual post, so I had to insert the newlines manually.)

In my previous post I introduced a script that would create a start and end point for the six degrees of wikipedia game. In retrospect, I shouldn't have worked so hard to keep it on one line when it sacrificed so much readability. The following code is a little more DRY (Don't Repeat Yourself (Pragmatic Programmer)), and I hope at least slightly more readable.

for ((i=0;i < 2;++i))
        echo "$(wget -nv 2>&1 | sed "s/^.* URL:\([^ ]*\) .* \"\([^\"]*\)\".*$/<a href='\\1'>\\2<\\/a>/")

There are still a couple outstanding issues, but they're fairly minor:

  • Escaped double quote in page title breaks regex.
  • Underscores in link text should be replaced with spaces.

Tuesday, November 13, 2007

Six Degrees of Wikipedia Game Generator

(Edit: Blogspot is lame, if I set nowrap on an element it cuts off the text at the preconfigured length.)

(Edit: I seem to have made up the codeblock tag, so I'm replacing it with the code tag, which actually exists.)

My friend Mike made a blog posting last month and I thought I'd write some code to generate games. I was originally going to write it in lisp, but since I've been studying bash lately I wrote a one-line command.

This generates links to two wikipedia articles, it's not the prettiest script, but it gets the job done. There are still a few bugs so if anybody has an improvement they should let me know. (I'd say post it in the comments, but I believe code tags aren't accepted, so just email it to me)

echo -e "$(wget -nv 2>&1 | sed "s/^.* URL:\([^ ]*\) .* \"\([^\"]*\)\".*$/<a href='\\1'>\\2<\\/a>/")\n$(wget -nv 2>&1 | sed "s/^.* URL:\([^ ]*\) .* \"\([^\"]*\)\".*$/<a href='\\1'>\\2<\\/a>/")"

Wednesday, November 7, 2007

Additional thoughts on Hyperproductivity and Useful Computer Tools

After another week of trying to adhere to a structured life, I'm finding that a couple things are a little more difficult to maintain. The first is my calendar, although I've created a rather strict schedule, sticking to that schedule is a little more difficult then I anticipated, if I get even slightly off I stop following it altogether. This blog post is a perfect example of that, as I stopped checking my calendar and thus forgot until the last minute that I intended to write a post today.

One solution I began adopting earlier this week was to move anything that didn't have to happen at a specific time to my to do list. This was greatly simplified when my girlfriend introduced me to the recurring task functionality, which I did not realize existed.

Although task organization is an important part of hyperproductivity, it's not the only place where one can increase the amount of tasks accomplished each day. As I spend most of my day on the computer, any tool that allows me to shorten the amount of time I spend doing a repetitive task quickly overwhelms the time lost to the learning curve. The rest of this post will be devoted to tools I've found useful in increasing my productivity.

The first tool I want to talk about is Launchy. This little program is a really handy keyboard launcher, allowing me to skip crawling through the start menu. The way it works is no matter what application I'm in, I can hit Alt-space and start typing in my program name. Once the desired program is auto-completed, you can hit enter to start the program. I'm also obligated to mention that it has a number of plugins and skins you can use to customize it, but I honestly only use it for the primary function.

Next, I want to talk about my sidebar. This is a rather new addition to my productivity suite, and so I haven't fully customized it yet. I actually had a bit of trouble determining who to go with, but ultimately decided on Desktop Sidebar. I chose this one mainly because it allowed me to import an opml file, which neither Google Desktop nor SideSlide did. Although it still doesn't have all of the functionality I'd like, it does most of what I need right now, and I plan on creating a few panels to extend its functionality.

I can't really talk about tools that increase my productivity without mentioning emacs. I know there's a lot of controversy over text editors, but this one's really powerful and I'm significantly more productive when working in it. The Pragmatic Programmer talks about how you should pick one text editor and use it for everything, which I've taken to heart. I've invested a significant amount of time learning all of its various features, and it has made a noticeable difference in my development speed.

These are just a few of the tools I've adopted to improve my productivity. I was introduced to most of them through Lifehacker, which I highly recommend for anybody interested in tips on how to improve their productivity.