These posts contain various programs & scripts that don’t really deserve their own project pages. Well, some of them do have project pages but most don’t.

Many of these will no longer work (software is an ever evolving ecosystem), but you’re free to salvage what you can.

Mumbles with gmail

Caveat lector: I wrote this post in high school; it’s likely outdated and poorly written.

I have been playing around with mumbles lately and have written a gmail plugin for anyone interested. Mumbles is a notification system that works very much like growl for the mac. The latest SVN version can even replace the gnome notification daemon (but not very well). While still in its infancy, this project shows a lot of promise. I based the plugin on the evolution tutorial on project’s homepage. I based the script on this script (with many modifications). When you click on the notification popup, evolution will launch (you can edit the source to change the program). The script requires python-feedparser.

Plugin, Source, and Script package: gmail-plugin_mumbles.tar.gz

Installing the precompiled plugin:

Do step 2 from the next section. Now copy the plugin to ~/.mumbles/plugins/.

Installing the plugin from source (adapted from dot_j’s tutorial (gone)):

1. Download the source

Download the package and extract. Then open a terminal window inside the plugin-source folder.

2. Create the directory structure and choose an icon

Run the following command:

mkdir -p ~/.mumbles/plugins/icons

Then either run this to use the default evolution icon…

cp /usr/share/icons/hicolor/22×22/apps/evolution.png ~/.mumbles/plugins/icons

Or just copy your desired icon into the plugins/icons folder and rename it to evolution.png. This is unnecessary if you already have the evolution plugin.

Build and install the plugin

cd ~/gmail_plugin
python setup.py bdist_egg

This will use our setup.py file to create our plugin. After it runs, you should see a file named GmailMumbles-0.1-py2.5.egg in the dist directory that was created by the build process. Here the -py2.5 part of the filename refers to what version of python you are using (it may vary, but if you are able to start mumbles, should not matter).

The .egg file is our plugin, so the only thing left to do is copy that to the mumbles plugin directory.

cp dist/GmailMumbles-0.1-py2.5.egg ~/.mumbles/plugins

Installing the script:

Find the script in the package and edit the username and password variables. Run this script with python /path/to/gmail.py (replace /path/to with the path to the script). By default, this script will check for new email every 2 minutes and alert the user of new mail.

BTW: This script does not safely store the username and password. I may, in the distant future, make this script work with gnome-keyring but this is not likely. I hope that mumbles will soon get better notification-daemon support so that I can go back to using mail-notification.

vCard viewer perl script

Caveat lector: I wrote this post in high school; it’s likely outdated and poorly written.

I needed a simple way to view vCards in mutt and found a few Perl scripts that could parse and display vCards but none of them worked very well. I searched the ubuntu repository, found libtext-vcard-perl, and wrote a simple Perl script using this library.

I know almost no Perl. This script will not corrupt nor will it delete any of your files but it may fail to correctly display vCards. It is very unlikely that I will ever update this script.

Past this in vcard-view.pl:

#!/usr/bin/perl
# Copyright (C) 2008, Steven Allen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see //www.gnu.org/licenses/>.

# This program parses vCards and displays their contents in a
# human readable form.

# Import libtext-vcard-perl library
use Text::vCard::Addressbook;
use Text::vCard::Node;
use Text::vCard;

# Get card name
my $card_file = $ARGV[0];

# Create Addressbook
my $address_book = Text::vCard::Addressbook->new({
 'source_file' => $card_file,
});

#Loop through Addressbook
foreach my $vcard ($address_book->vcards()) {
 print "=" . ( "=" x 59 ) . "\n";

 # Name/Email
 print "Name:\n " . $vcard->fullname();
 $count = 0;
 my $emails = $vcard->get({ 'node_type' => 'EMAIL' });
 foreach my $email (@{$emails}) {
  if ($count == 0) {
   $space = " ";
  } else {
   $space = "  " . ( " " x length ($vcard->fullname()) );
  }
  if($email->is_type('home')) {
   print $space . "" . $email->value() . "> (Home)\n";
  } elsif ($email->is_type('work')) {
   print $space . "" . $email->value() . "> (Work)\n";
  } else {
   print $space . "" . $email->value() . ">\n";
  }
  $count++;
 }

 # Address
 my $addresses = $vcard->get({ 'node_type' => 'addresses' });
 print "\nAddresses:\n";
 foreach my $address (@{$addresses}) {
  if($address->is_type('home')) {
   print " --------------------------------\n";
   print "\t" . $address->street() . "\n";
   print " Home:\t" . $address->city() . ", " . $address->region() . "\n";
   print "\t" . $address->post_code() . ", " . $address->country() . "\n";
   print " --------------------------------\n";
  } elsif ($address->is_type('work')) {
   print " --------------------------------\n";
   print "\t" . $address->street() . "\n";
   print " Work:\t" . $address->city() . ", " . $address->region() . "\n";
   print "\t" . $address->post_code() . ", " . $address->country() . "\n";
   print " --------------------------------\n";
  } else {
   print " --------------------------------\n";
   print "\t" . $address->street() . "\n";
   print " Other:\t" . $address->city() . ", " . $address->region() . "\n";
   print "\t" . $address->post_code() . ", " . $address->country() . "\n";
   print " --------------------------------\n";
  }
 }
 # Phones
 print "Phones:\n";
 my $tels = $vcard->get({ 'node_type' => 'tel' });
 foreach my $tel (@{$tels}) {
  if($tel->is_type('home')) {
   print " Home:\t" . $tel->value() . "\n";
  } elsif ($tel->is_type('cell')) {
   print " Cell:\t" . $tel->value() . "\n";
  } elsif ($tel->is_type('work')) {
   print " Work:\t" . $tel->value() . "\n";
  } else {
   print " Other:\t" . $tel->value() . "\n";
  }
 }
 # URL
 my $urls = $vcard->get({ 'node_type' => 'URL' });
 foreach my $url (@{$urls}) {
  print "Web:\t" . $url->value() . "\n";
 }
 print "=" . ( "=" x 59 ) . "\n";
}

PDF tools

Caveat lector: I wrote this post in high school; it’s likely outdated and poorly written.

A while back I wrote a script that can convert PDFs into several other formats. It can also print information about PDFs. I recommend you use this script in conjunction with nautilus-actions.

Usage

./PDFtools.sh [pdf document]

Screenshots

Main Window:

Info:

Font Info:

This script requires poppler-tools and zenity

Copy Script From: PDFTools.sh