Search

weather: check weather conditions and forecasts on the command line

October 4th, 2007 edited by Tincho

Article submitted by Dann Frazier. We are running out of articles ! Please help DPOTD and submit good articles about software you like !

weather, provided by the weather-util package, is a simple command line tool that lets you check current conditions and forecasts. It uses METAR data that it fetches from the the National Oceanic and Atmospheric Administration and forecasts from the National Weather Service. The documentation says it’s limited to providing information for the United States, but in fact, METAR data is available for stations all around the world. The forecast won’t be available, though.

Many locations are already pre-configured in the package’s /etc/weatherrc. If your location is already defined, you only need to look up the alias to begin using it. For example, /etc/weatherrc provides the following entry for Albuquerque, New Mexico:

[ABQ]
City = Albuquerque
ID = KABQ
St = NM

The alias for Albuquerque is ‘ABQ’. Therefore, weather ABQ will show you the current conditions for Albuquerque:

$ weather ABQ
Current conditions at Albuquerque International Airport (KABQ)
Last updated Sep 26, 2007 - 04:56 PM EDT / 2007.09.26 2056 UTC
  Wind: from the ESE (120 degrees) at 3 MPH (3 KT)
  Sky conditions: mostly clear
  Temperature: 77.0 F (25.0 C)
  Relative Humidity: 15%

weather -f ABQ will include a local forecast:

$ weather -f ABQ
Current conditions at Albuquerque International Airport (KABQ)
Last updated Sep 26, 2007 - 04:56 PM EDT / 2007.09.26 2056 UTC
  Wind: from the ESE (120 degrees) at 3 MPH (3 KT)
  Sky conditions: mostly clear
  Temperature: 77.0 F (25.0 C)
  Relative Humidity: 15%
City Forecast for Albuquerque, NM
Issued Wednesday afternoon - Sep 26, 2007
  Wednesday night... Low 52, 0% chance of precipitation.
  Thursday... Sunny, high 81, 0% chance of precipitation.
  Thursday night... Low 54, 5% chance of precipitation.
  Friday... Partly cloudy, high 80.
  Friday night... Low 56.

You can add new locations to this file directly, or to per-user ~/.weatherrc files. You can also define a default location by adding a stanza with an alias named “default”. For example, here’s the contents of my ~/.weatherrc file:

[default]
City = denver
Forecast = True
ID = KFNL
St = CO

City and St (state) are used for obtaining forecasts, while ID is used for retrieving current conditions. I use this configuration to tell weather to retrieve forecasts from Denver, CO but to use a station that is closer to me for obtaining current conditions. Note that if you do not specify a location and have no alias named ‘default’, weather will fall back to a hard-coded default of Raleigh, NC.

Knowing what information weather uses to obtain the data you request is important when defining your own configurations. For example, say I want to know the current conditions for Lubbock, TX and I run the following command:

$ weather -o --city=Lubbock --st=TX
Current conditions at Fort Collins-Loveland Municipal Airport (KFNL)
Last updated Sep 26, 2007 - 05:55 PM EDT / 2007.09.26 2155 UTC
  Wind: from the ENE (070 degrees) at 5 MPH (4 KT)
  Sky conditions: clear
  Temperature: 71 F (22 C)
  Relative Humidity: 23%

(The -o tells weather to omit the forecast). Notice that weather gave me the current conditions for my ‘default’ alias, not for Lubbock. This is because weather looks up current conditions by station ID, not by city/state. If I pass the station ID instead, I’ll get the information I was looking for:

$ weather -o --id=KLBB
Current conditions at Lubbock International Airport (KLBB)
Last updated Sep 26, 2007 - 05:53 PM EDT / 2007.09.26 2153 UTC
  Wind: from the S (170 degrees) at 9 MPH (8 KT) gusting to 18 MPH (16 KT)
  Sky conditions: mostly cloudy
  Weather: Cumulonimbus clouds, towering cumulus clouds observed
  Temperature: 86.0 F (30.0 C)
  Relative Humidity: 38%

Being a command-line tool, weather lends itself to various automatic processes. For example, you might want to cancel your weekly bicycle pub crawl if the forecast shows a high chance of rain:

$ cat /etc/cron.weekly/pub-reminder
#!/bin/sh

set -e

if weather -f | egrep -q '(100)|([5-9][0-9])% chance of precipitation’; then
 mailx -s ‘Cancellation’ $PUBCRAWLEES < ~/pub-crawl-cancelled
else
 mailx -s 'Get on your bike' $PUBCRAWLEES < ~/pub-crawl-is-a-go
fi

Of course, I’d just recommend a rain jacket.

weather is provided by the weather-util package and is available in Debian ‘etch’, testing and unstable, and Ubuntu ‘edgy’, ‘feisty’ and ‘gutsy’.

Edited to add: for international weather station ids, users can look on this US government website. Thanks hideokuze for the info.

Posted in Debian, Ubuntu | 14 Comments »

Debaday needs your help (yeah, seriously)

September 27th, 2007 edited by lucas

Debaday didn’t publish anything last Sunday and Wednesday. It was simply because we have nothing to publish. :(

Due to the vacations of two editors (out of three), we were slower than usually to reply to submissions. But it’s not like we have received a lot of submissions recently.

We really need *your* help! Send us an quality article. See Contribute page for details. If you always wanted send us an article, but you did not know what to write about, here you have a small list of application people have requested or we think could be interesting to feature:

  • screenkast
  • approx
  • email-reminder
  • deborphan / debfoster
  • gaupol
  • psi
  • kid3
  • wget (yeah, surely there is people who does not know this!)
  • httptunnel
  • dctrl-tools
  • strigi
  • any game you like

If you are a user of any of this program and think it deserves be featured in debaday, send us an entry! :)

Also, we really need a fourth editor. The task includes replying to submissions, suggesting improvements, doing some minor editing and HTML formatting. You don’t need to be a native english speaker (the 3 editors are non-natives currently). And you get to read all entries before they are published, so you can show off with cool apps that nobody knows! If you can dedicate a little time on a regular basis to this (about 1 hour per week would be awesome), and think you won’t become crazy after working with ana, lucas and Tincho, just contact us!

Posted in Debian, Ubuntu | 18 Comments »

GPRename: GTK2-Perl Batch Renamer

September 19th, 2007 edited by lucas

Article submitted by Johan Spee. We are running out of articles ! Please help DPOTD and submit good articles about software you like !

GPRename is a complete batch renamer for files and directories coded in GTK2 and Perl.

GPRename has been around since 2001, is quite stable and still very much alive today. At the start of 2007, it was ported from the deprecated GTK-Perl to the new GTK2-Perl and in mid 2007 the new 2.4 release is now GPL-3. The package was recently added to the Debian repositories (currently available in ‘testing’ and ‘unstable’) and can be used in many languages.

The program is lightweight and easy to use, yet supports a very complete set of features. In this respect it is comparable to renamers of more fame such as Konqueror’s KRename (KDE) or Thunar’s Bulk Rename (XFCE). GNOME does not have an official renamer but GPRename can easily fill that void. With a simple ‘action’ it can be integrated into Nautilus, the GNOME’s file manager (the prefab action is available). With the action installed any directory in Nautilus can directly be opened in GPRename through the right-click context menu.

gpr-ops.jpg

Even relatively inexperienced Linux users will have little trouble with the graphical interface, which in many ways resembles that of Nautilus and other file managers. The left panel shows a directory-tree for the usual point-and-shoot navigation. In the panel next to it files or directories (separate tabs) that are to be renamed can be selected. A preview of the modified names is also shown here, either after clicking the ‘preview’ button or automatically. Other useful automated options include:

  • Convert double spaces to single spaces.
  • Trim leading and/or trailing spaces.
  • Add leading zeros to numbers.

The bottom panel has four tabs, one for every basic rename function. The screenshots are quite self-explanatory:

Case change (UPPER, First Letter, lower)

gpr-cas.jpg

Insert or delete text at a given position

gpr-ins.jpg

Replace text (options: ‘case sensitive’ and ‘regular expressions’)

gpr-rep.jpg

Rename using incremental numbers (pic-01.jpg, pic-02.jpg etc.)

gpr-num.jpg

Don’t hesitate to give it a try, since there’s always the very reassuring ‘undo’ button. You never know.

GPRename is available in Debian testing and unstable, and will also be available in Ubuntu Gutsy.

Posted in Debian, Ubuntu | 2 Comments »

newsbeuter: RSS feed reader for the text console

September 16th, 2007 edited by lucas

Article submitted by Andreas Krennmair. We are running out of articles ! Please help DPOTD and submit good articles about software you like !

RSS is a set of XML-based formats to describe articles (including title, link to the original article, description, etc.) which are usually transported via the HTTP protocol. These days, the majority of blogs and news websites provide RSS feeds. In order to read these feeds in a useful way, special programs, called RSS feed readers or RSS aggregators, can be used.

Newsbeuter is an RSS feedreader for the text console. It comes with a user interface in the style of such popular text tools such as mutt and slrn, and aims to be the text-mode RSS feedreader with the most features, providing the greatest flexibility for its users.

Starting with newsbeuter

After installing newsbeuter with a simple aptitude install newsbeuter (currently in Debian unstable, only), you can run newsbeuter for the first time, and is presented with the following message:

Error: no URLs configured. Please fill the file /home/ak/.newsbeuter/urls with RSS feed URLs or import an OPML file.

newsbeuter 0.6
usage: ./newsbeuter [-i <file>|-e] [-u <urlfile>] [-c <cachefile>] [-h]
        -r              refresh feeds on start
        -e              export OPML feed to stdout
        -i <file>       import OPML file
        -u <urlfile>    read RSS feed URLs from <urlfile>
        -c <cachefile>  use <cachefile> as cache file
        -C <configfile> read configuration from <configfile>
        -v              clean up cache thoroughly
        -h              this help

This means that newsbeuter needs to be configured with the RSS feed URLs that you want to read. This can either by achieved by manually filling
~/.newsbeuter/urls with RSS feed URLs (one by line), or by importing an OPML file by running newsbeuter -i blogroll.opml. OPML is a XML-based format for describing outlines, and is in wide use to import and export lists of RSS subscriptons between RSS feedreaders.

Newsbeuter can be configured via its configuration file ~/.newsbeuter/config. A wide range of properties and behaviour can be configured, so it’s wise to have a look into the provided documentation.

A reasonable configuration to start with is the following setup. The manpage lists all available configuration options, so there’s a lot to experiment with.

# This is an example configuration file for newsbeuter
# save this as ~/.newsbeuter/config

auto-reload yes       # automatically start a "reload all" thread at a defined interval
reload-time 30        # reload all feeds every 30 minutes
confirm-exit yes      # always ask the user whether he really wants to quit

Advanced Features

What makes newsbeuter so interesting are the advanced features it comes with. For previous users of SnowNews (another console-based RSS feedreader), newsbeuter supports snownews extensions, which are easy to develop and of which a huge collection is readily available.

Newsbeuter also comes with support for podcasts. Newsbeuter contains functionality to help collect podcast download URLs (either automatically or manually), which can then be downloaded with a separate tool called “podbeuter”.

Another very interesting feature is the internal filter language. It’s a generic expression language that makes it easy to define complex search criterias, which cannot only be used both for searching for feeds and articles, but also for defining rules for ignoring certain articles (think of killfiles for RSS feeds), or configuring “meta feeds”, feeds that contain only articles from other feeds which match a filter expression. The documentation comes with plenty of examples for these use cases.

Other features supported by newsbeuter are a flexible categorization functionality based on tags (every RSS feed can be tagged with keywords, and the displaying of RSS feeds can be filtered by tags), notifications about new articles via external programs or directly to a GNU screen session, free configurability of key bindings and colors, and an internal command line.

Screenshots

The typical feedlist of newsbeuter, giving the user an overview over configured feeds and the number of downloaded and unread articles per feed:
newsbeuter-feedlist.png

Newsbeuter renders the HTML that is contained in article descriptions, and lists all links that are contained in the article (these links can even be opened with a simple keypress in a freely configurable web browser):
newsbeuter-article.png

Colors can be freely configured, as demonstrated by this screenshot:
newsbeuter-colors.png

Internationalization (I18N) and localization (L10N) are important in the newsbeuter project. Newsbeuter can perfectly handle Unicode characters, and its user interface is currently available in English (default), German, Italian, French and Russian. The screenshot shows a Russian newsbeuter, displaying a Japanese RSS feed:
newsbeuter-i18n.png

Comparison with other RSS Feedreaders

A few other text-mode RSS feedreaders beside newsbeuter exist. The most prominent ones are Snownews and raggle. Both Snownews and raggle have in common that they are no longer under active development. Snownews itself is hard to maintain and extend, and raggle is relatively slow (even on new, fast computers), because it is purely implemented in the Ruby scripting language. Especially Snownews lacks a lot of features compared to newsbeuter, such as support for the Atom XML format and HTTPS support.

One goal of newsbeuter development was to build a feed reader that does not only fix the deficiencies of the existing tools and integrate all the useful features, but that is also easily extensible. This goal has been achieved, and now development is aiming at more advanced features: future releases will contain a flexible and extensible bookmarking support, improved support for notification frameworks such as Growl, and synchronization with web RSS feed readers such as Bloglines.

More Information

Since newsbeuter is relatively new (development started in November 2006, the first Debian package entered unstable in February 2007), it is only available in unstable and testing (in a completely outdated version). It will be available in Ubuntu Gutsy, but the version is outdated already as well.

Posted in Debian, Ubuntu | Comments Off

Listadmin: command line mailman moderator queue manipulation

September 12th, 2007 edited by lucas

Article submitted by Kaerast. We are running out of articles ! Please help DPOTD and submit good articles about software you like !

You’ve ended up moderating many Mailman lists across multiple servers, you’re losing track of what you’re moderating, the emails asking you to moderate posts are either filling up your inbox or getting ignored. Luckily there’s a command line tool which will make your life much easier.

Listadmin is a command line tool to manipulate the queues of messages held for moderator approval by mailman. It is designed to keep user interaction to a minimum, in theory you could run it from cron to prune the queue. It can use the score from a header added by SpamAssassin to filter, or it can match specific senders, subjects, or reasons.

It can handle multiple list servers, using multiple passwords, and in more recent versions can cope with SSL too. To get started you need to edit the .listadmin.ini file in your home directory. Mine looks something like this:

username kaerast@example.org
spamlevel 8
default skip

# example.org server
adminurl http://{domain}/cgi-bin/mailman/admindb/{list}
password "mypassword"
users@lists.example.org
process@lists.example.org
admin@lists.example.org

# example.com server
adminurl https://{domain}/mailman/admindb/{list}

password "myotherpassword"
supporters@lists.example.com

password "mythirdpassword"
staff@lists.example.com

This config files allows us to moderate queues on multiple lists using multiple passwords. With this configured, we can now run listadmin:

kaerast@bennet:~$ listadmin
fetching data for users@lists.example.org ... nothing in queue
fetching data for process@lists.example.org ... nothing in queue
fetching data for admin@lists.example.org ... nothing in queue
fetching data for supporters@lists.example.com ... nothing in queue
fetching data for staff@lists.example.com ...

[1/1] ============== staff@lists.example.com =======================
From:     kaerast@dodgit.com
Subject:  test
Reason:   Post by non-member to a members-only list            Spam? 0
Approve/Reject/Discard/Skip/view Body/Full/jump #/Undo/Help/Quit [S] ? r
Why do you reject? test messages aren’t allowed
Submit changes? [yes]

Newer versions, ie. those in Lenny and Sid can also add and remove members from a list:

kaerast@hiro:~$ listadmin --add-member kaerast@example.com
process@lists.example.com
Ok

Listadmin is available in Ubuntu Feisty (universe) and all Debian versions. Only Debian Lenny and Sid have the add/remove subscribers functionality added.

Posted in Debian, Ubuntu | Comments Off

« Previous Entries Next Entries »