ratpower.sh: a power menu for ratpoison

Coding,Geekery,Linux,My Projects — April 19, 2009 at 7:02 pm

I’ve started to use ratpoison on my netbook. I’ve made a script that displays a menu of power-related actions and the current state of the battery. Here is a screenshot:

[discharging 58%] SLEEP HIBERNATE REBOOT SHUTDOWN LOCK

The script uses ratmenu to actually display the menu and uses dbus to send signals.

download ratpower.sh

Simple XSLT and Delicious API

Geekery,My Projects — April 7, 2009 at 8:46 pm

I decided I wanted to take five minutes today to implement a simple idea I’ve had for a long time. When I get home, I typically eat dinner while reading news in my RSS reader and I’ve found less and less time to write my own posts. I simply wanted to be able to bookmark the things I found interesting and have them automatically appear as a weblog entry.

Part one was getting the data from Delicious, which is the obvious choice for bookmarking. They make it really easy to get all bookmarks made on the last day of activity with a given tag with their posts/get function. To get all bookmarks I made today with a tag of “viewed”, I simply ran:

$ curl 'https://minusnine:password@api.del.icio.us/v1/posts/get?dt=2009-04-07&tag=viewed' > todays.xml

which saves an XML form of the posts.

Transforming the XML into a list is a trivial task but I saw two approaches: sed would do nicely for the crufty old sysadmin in me, but XSLT satisfies the young whippersnapper in me.

The XSLT is very simple and elegant:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"></p>

<p><xsl:template match="/posts">
    <span>Posts around the web that I found interesting today:</span>
    <ul>
        <xsl:apply-templates select="post">
        </xsl:apply-templates>
    </ul>
</xsl:template></p>

<p><xsl:template match="post">
    <li>
        <a href="{@href}">
            <strong>
                <xsl:value-of select="@description"/>
            </strong>
        </a>: <xsl:value-of select="@extended"/>
    </li>
</xsl:template>
</xsl:stylesheet>

Combining these with xsltproc:

$ xsltproc posts.xsl todays.xml

yields a cut-and-pastable post. The next step is to pipeline these (also trivial) and upload it to my WordPress installation.

Screen: Renumbering Windows to Fill Gaps

Coding,Geekery,My Projects — February 3, 2008 at 3:08 pm

After running a single session of screen for a long time, I often find that I have several gaps in the numerical ordering of windows. Using :number is definitely feasible, but it takes a bit more effort than I’d care to contribute every time I want to make my windows contiguously numbered.

I’ve created a patch against CVS HEAD to fill in the holes of the window numbering. It simply moves windows to lower positions until there are no holes left. Any [constructive] comments are welcome.

The patch can be found here. It was also sent to the screen-devel mailing list.

RSS added to Horde IMP

Coding,Geekery,My Projects — January 12, 2007 at 10:41 am

My patch for adding RSS support to mailboxes in Horde IMP was committed. This is the largest patch I’ve submitted so far. Thanks to Chuck Hagenbuch and Michael Slusarz.

Date: Fri, 12 Jan 2007 00:14:22 -0800 (PST) From: “Michael M Slusarz” Subject: [cvs] commit: imp rss.php imp/docs CHANGES imp/templates/rss mailbox.rss imp/themes feed-rss.xsl To: cvs@lists.horde.org Message-ID: <20070112081422.423A23513C@coyote.horde.org> slusarz 2007-01-12 00:14:22 PST Modified files: docs CHANGES Added files: . rss.php templates/rss mailbox.rss themes feed-rss.xsl Log: Bug: 2733 Submitted by: Eric Garrido Add RSS/Atom feed for mailboxes. Revision Changes Path 1.1004 +7 -4 imp/docs/CHANGES 1.1 +102 -0 imp/rss.php (new) 1.1 +23 -0 imp/templates/rss/mailbox.rss (new) 1.1 +79 -0 imp/themes/feed-rss.xsl (new) Chora Links: http://cvs.horde.org/diff.php/imp/docs/CHANGES?r1=1.1003&r2=1.1004&ty=u http://cvs.horde.org/co.php/imp/rss.php?r=1.1 http://cvs.horde.org/co.php/imp/templates/rss/mailbox.rss?r=1.1 http://cvs.horde.org/co.php/imp/themes/feed-rss.xsl?r=1.1

[Stolen Concept] My Vacation Included

My Projects,Personal — January 5, 2007 at 9:41 pm

Hearing. No. Experiencing this guy live at Webster Hall:

338983759_05de844828.jpg

(Glassjaw..which was a bit ridiculous. Went with Jenn who evidently doesn’t mind getting crushed by very large, hairy, sweaty men.)

Continuing to hate (but really, love) this guy:

will-shortz.jpg

(Will Shortz, the editor of the New York Times crossword puzzle). I even watched “Wordplay,” a documentary on the crossword puzzle culture. Jon Stewart is hilarious.

Getting a new one of these for my car:

water-pump-wpulley.jpg

(A water pump. I’m not sure if I really needed it, but I like spending lots of money on a car I don’t drive).

Staring at this constantly:

picture-2.png

(The RSS feed view of Firefox. I’ve submitted a patch to add RSS feeds to Horde IMP (webmail program), along with some other minor ones).

Becoming more geeky:

9780123693792small.jpg1565922573_cat.gif

(Furthering my earmark in “SQL for Smarties” and “Mastering Regular Expressions”).

And making one or two calls to Arizona:

img_0502.jpg

Hooray! Two one-line patches!

Coding,My Projects — December 25, 2006 at 3:02 pm

Hooray! Two more one-line patches! That brings my total up to 12 or so one-liners.

From Horde:

Date: Mon, 25 Dec 2006 09:59:06 -0800 (PST) From: “Chuck Hagenbuch” Subject: [cvs] commit: hordeweb/bounties bounties.php To: cvs@lists.horde.org Message-ID: <20061225175906.3B6D4351DE@coyote.horde.org> chuck 2006-12-25 09:59:06 PST Modified files: bounties bounties.php Log: fix bug number Submitted by: Eric Garrido Revision Changes Path 1.175 +1 -1 hordeweb/bounties/bounties.php Chora Links: http://cvs.horde.org/diff.php/hordeweb/bounties/bounties.php?r1=1.174&r2=1.175&ty=u

and from ViewVC:

http://viewvc.tigris.org/issues/show_bug.cgi?id=189 FIXED: Sending INSTALL Sending viewvc.org/index.html Transmitting file data .. Committed revision 1226. Thanks, Eric.

I won a t-shirt!

My Projects,Personal — October 14, 2006 at 4:53 pm

Hooray! I was one of the first 400 participants in IBM’s Master the Mainframe competition to complete Part 1, giving me this cool, ridiculously geeky t-shirt:

T-shirt FrontTshirt back

Varun correctly pointed out that the font seems to come straight from Grand Theft Auto. I’m not quite sure what the allusion means.

I’m still debating as to whether I should complete Part 2. I have one more step to go and there are a few spots left to qualify for Part 3, but Part 3 itself is labeled “Approximate time to completion: Weeks to months.” That’s a bit intimidating and I think I have better things to do. That said, I learned more during the first two parts of the competition over the few days I was working on it than I have in any one class in a semester. We’ll see; continuing depends on my mood tonight.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. | Eric Garrido