Yet Another Tech Blog

26Jan/110

Displaying Folding@Home Progress in Conky with Regular Expressions

Although this is titled "Displaying Folding@Home progress in Conky using Awk", I'm sure it could be applied to just about any statusbar, information widget, etc.

Let me begin by saying that I love Folding@Home (referred to as (FAH from now on for convenience). However, I don't have all day to stare at its progress in the terminal, and I would much prefer to have it integrated into my dwm status bar. But how does one do that?

As I discovered, FAH keeps a file called unitinfo.txt in its working directory (whatever directory you run FAH from). One of the lines lists your progress with both a progress bar and a percentage of completion, as so: "Progress: 62% [||||||____]". But how do you display this? With awk and regular expressions, of course. You can use awk to look for any line that contains a series of numbers and a percentage sign in a single column and it will print the output. The basic code line is: awk "/[0-9]+%/" unitinfo.txt. So, if your work directory is ~/fah/ like mine, the line would be: awk "/[0-9]+%/" ~/fah/unitinfo.txt. This is assuming that you always run FAH as the same user, otherwise you will want an absolute path. If you run FAH in /opt/fah{-smp}/ then you will want to specify this instead.

If you want a simple command to display the progress in the terminal, this is as far as you will need to go. However, the point in this article is integrating it into a status bar or something akin to this, so we will forge ahead with integrating it into conky. This can be
done simply with the variable ${execi 60 awk "/[0-9]+%/" ~/fah/unitinfo.txt}. This will display the entire line in whatever you output conky to. The "execi" variable is one of several options. It executes a binary at certain intervals; in this case, 60. For an in-depth explanation of what 'execi' does, I would suggest that you read its entry in the list of Conky variables.

This will accomplish the basic task; however, I would prefer something much more elegant and minimalist, something that would only display the percentage completion and nothing more. This is incredibly easy, and can again be done with awk. To display only the percentage completion, you simply append | awk '{print $2'}\ to the line. This will print only the second column.

Your final line should look like this: ${execi 60 awk "/[0-9]+%/" ~/fah/unitinfo.txt | awk '{print $2}'}. This will output a percentage (including the percent symbol) to wherever conky is being outputted to.

I hope this is useful to you; I am only posting this because I couldn't find anything similar on the internet other than a few ugly solutions using sed. I admit that my original solution (which used sed a great deal) was ugly, mainly chopping off everything around the percentage, and it was sudokode who provided the clean and elegant solution that used awk. You can see some of his other projects at his GitHub page.

Tagged as: No Comments
14Dec/100

Yes or No

I've put up another essay, this time a fairly general one comparing motivations in F/OSS and proprietary software, entitled "Yes or No: Motivations in Closed and Free or Open-Source Software." You can read it here.

Tagged as: No Comments
1Sep/104

Medal of Honor: Allied Assault Review

Medal of Honor: Allied Assault
I've written a review of Medal of Honor: Allied Assault. You can read it here.

16Aug/100

Left 4 Dead Review

I've written a review of Left 4 Dead. I hope you enjoy it.Left 4 Dead

Click here to read it.

Tagged as: , No Comments
7Jul/100

On June 7

I've decided that a good addition to my blog would be a variation on the old "On This Day" theme. Most of these deal with American history, and they are almost always obscure and dull. Whenever I feel like it, I'll add a picture and information about the event I consider important.

Japanese troops

Japanese soldiers starting a gas attack.

On June 7, 1937, troops of the Imperial Japanese Army invaded mainland China. It and the Spanish Civil War served as a prelude to the Second World War, and it ran concurrently with the Second World War. It is one of the most ignored and forgotten wars of the 20th century, despite being more brutal and devastating than the Second World War itself (except, perhaps on the Eastern Front), killing almost 20 million Chinese civilians and almost all of China's military.

26Jun/10Off

Forrest Gump Review

Forrest GumpI've written another movie review, this one on Forrest Gump. Enjoy!

Click here to read it.

12Jun/100

A Few Words On (and in) Helvetica

This is not a review, mostly because I don’t feel comfortable reviewing documentaries, and because I want to keep what I have to say short and sweet.

This is an underrated documentary, one that most people should see but few have, mostly because of its content. A documentary on typefaces? Surely only designers and typographers would be interested in this, right? Sort of. Everyone who has ever written anything in their life, drawn anything in their life, or done anything that can be considered communication should be interested in this documentary, because it sheds light on the way we think and how it has changed over time.

Some people have trouble understanding the differences between typefaces, but less now than in the 19th and 20th centuries. In the 19th century, typefaces were controlled by printers and typesetters, and were a sort of arcane magic. Often, they would become completely illegible due to poor-quality printing practices and inkblots. This changed during the modernist period of the 1950s. Suddenly, simplicity reigned supreme — clean, modern-looking art and design. This was also the dawn of corporate logos, which required a simple, easily readable typeface. This typeface was Helvetica.

Helvetica revolutionized typefacing because of its simplicity and neutrality. Its existence utterly destroys the “message is the medium” debate — it was a way of saying something so that it could be thought about based on the message’s own merits, rather than worrying about any impressions given off from the choice of typeface. It was the vanilla ice cream of typefaces. By far, it was (and still is) the most legible, neutral, and efficient typeface of them all — you could fit in more words for your given space than with other typefaces and still be more instantly readable. In fact, you’re probably reading this in a variant of Helvetica right now — Arial, most likely.

11Jun/10Off

Gran Torino Review

After an unfortunate hiatus, mostly due to switching hosts twice in the period of a single week, I've put up another movie review. It's of Gran Torino, hope you like it.

(here)

Get off my lawn!

Tagged as: Comments Off
2Jun/100

The Windows Prayer

This is a totally original piece of work, and in no way is it just a reworking of the Apple Prayer, and ultimately a ripoff of th3wiz0rd's work. Really.

Our Windows, which art in Redmond,
Windows Genuine Advantage be Thy name,
Thy Empire come;
Thy will be done (most of the time),
Crash in the present as you crashed in 1995.
Give us this day our daily patches,
and forgive us for downloading warez,
as we forgive the w4r3z d00ds for giving us malware.
And lead us not into downloading Ubuntu;
but deliver us more crappy software.
For thine is the idiot,
the market share and the Almighty Bill,
for ever and ever (or maybe not).
"What's Linux?"

28May/100

Why Arch is Better

This is very belated piece of news (in fact, almost a week old) but our good friends at Phoronix decided to benchmark Arch and Ubuntu, and publish the results here. While I understand their enthusiasm for benchmarking, it shows a basic misunderstanding of what Arch's strengths are. Their method of comparison was to take a standard Ubuntu 10.04 release, full of GNOME and bloat, and then compare it to a bloated version of Arch with GNOME and friends installed. This is completely missing the point; while Arch is probably not inherently faster, its strengths are flexibility and its rolling release model. The fact is that they compared a minority of Arch users. In my own experience, very few active Arch users (ones who will talk on IRC and post on the forum) use GNOME. Far more use KDE, Xfce, and standalone WMs.