<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux etc. &#187; Cool stuff</title>
	<atom:link href="http://promberger.info/linux/category/cool-stuff/feed/" rel="self" type="application/rss+xml" />
	<link>http://promberger.info/linux</link>
	<description>my outsourced memory for your perusal</description>
	<lastBuildDate>Thu, 08 Sep 2011 11:06:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Does the Pembury Tavern have Augustiner Helles?</title>
		<link>http://promberger.info/linux/2008/04/29/does-the-pembury-tavern-have-augustiner-helles/</link>
		<comments>http://promberger.info/linux/2008/04/29/does-the-pembury-tavern-have-augustiner-helles/#comments</comments>
		<pubDate>Tue, 29 Apr 2008 22:04:22 +0000</pubDate>
		<dc:creator>Marianne</dc:creator>
				<category><![CDATA[Bash shell]]></category>
		<category><![CDATA[Cool stuff]]></category>
		<category><![CDATA[procmail]]></category>

		<guid isPermaLink="false">http://promberger.info/linux/2008/04/29/does-the-pembury-tavern-have-augustiner-helles/</guid>
		<description><![CDATA[We are lucky to have the Pembury Tavern around the corner, a nice pub whose beer selection includes our favorite beer from Munich, Augustiner Helles. The only problem: The Pembury&#8217;s wholesale supplier sometimes has problems with stocking enough Augustiner, and that along with the fact that Augustiner, containing no additives, doesn&#8217;t keep longer than about [...]]]></description>
			<content:encoded><![CDATA[<p>We are lucky to have the <a href="http://www.individualpubs.co.uk/pembury">Pembury Tavern</a> around the corner, a nice pub whose  <a href="http://www.individualpubs.co.uk/pembury/drinks.html">beer selection</a> includes our favorite beer from Munich, <a href="http://www.augustiner-braeu.de/">Augustiner</a> Helles. The only problem: The Pembury&#8217;s wholesale supplier sometimes has problems with stocking enough Augustiner, and that along with the fact that Augustiner, containing no additives, doesn&#8217;t keep longer than about two months, makes for the all-too-frequent Augustiner shortage at the Pembury. </p>
<p>Nicola and I have been joking for some time that there should be a shell script to check whether the Pembury currently offers Augustiner. Well, it turns out this is easily possible, since the Pembury is in fact a Linux-powered pub whose website directly and accurately reflects what&#8217;s in the cellar. Enter lynx-dump and we&#8217;re all set: </p>
<pre>
#!/bin/bash
WEBSITE=http://www.individualpubs.co.uk/pembury/drinks.html
AUGUSTINER=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i augustiner)
JEVER=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i jever)
ANDECHS=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i andechs)
if [ -n  "$AUGUSTINER" ]; then
         echo "The PT currently serve:
$AUGUSTINER
$JEVER
$ANDECHS"
elif    [ -n "$JEVER" -o  -n "$ANDECHS" ]; then
         echo "The PT currently serve no Augustiner, but they serve:
$JEVER
$ANDECHS"
else
     echo "Sorry, the PT currently serve neither Augustiner, nor Jever, nor Andechser."
fi
</pre>
<p>As you&#8217;ll notice, this also checks for Andechser or Jever as alternative solutions to our cravings for German beer. :)</p>
<p>For even more geeky fun, I&#8217;ve put up a mail reply service. If you send an e-mail with the subject line &#8220;PT-augustiner-info&#8221; to my private e-mail address (my first name (at) my last name (dot) info), you should receive a reply containing the up-to-date information. </p>
<p>This service uses <code>procmail</code> and anohter shell script. </p>
<p>The shell script:</p>
<pre>
#!/bin/bash
SENDER=$(formail -x "From:")
WEBSITE=http://www.individualpubs.co.uk/pembury/drinks.html
AUGUSTINER=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i augustiner)
JEVER=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i jever)
ANDECHS=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i andechs)
if [ -n  "$AUGUSTINER" ]; then
      echo "The PT currently serve
$AUGUSTINER
$JEVER
$ANDECHS" | mail "$SENDER" -s "The PT serve Augustiner"
elif    [ -n "$JEVER" -o  -n "$ANDECHS" ]; then
      echo "The PT currently serve no Augustiner, but they serve:
$JEVER
$ANDECHS" | mail "$SENDER" -s "The PT currently serve no Augustiner, but ..."
else
      echo "Sorry, the PT serve neither Augustiner, nor Andechser, nor Jever
But you might check out $WEBSITE for other nice beers." | mail "$SENDER" -s "Sorry, no Augustiner, Jever, or Andechser beer at the PT"
fi
</pre>
<p>The recipe in <code>~/.procmailrc</code>:</p>
<pre>
:0
* ^Subject.*PT-augustiner-info$
| /home/mpromber/bin/augustiner
</pre>
<h3>Addendum</h3>
<p>The e-mail information service now also works if you send an e-mail to <tt>augustiner</tt> (at) mylastname (dot) info. If you&#8217;re unsure what my last name is, look at the URL of this blog :) The modified procmail recipe for this (since one can never have too many examples of procmail recipes):</p>
<pre>:0
* (^Subject.*PT-augustiner-info$)|(^To.*augustiner@promberger.info$)
| /home/mpromber/bin/augustiner</pre>
]]></content:encoded>
			<wfw:commentRss>http://promberger.info/linux/2008/04/29/does-the-pembury-tavern-have-augustiner-helles/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

