blog.erik.rainey.name

Sating the digital medium with semi-intelligible filler.

Swallow: An Add-on to Gurgitate-Mail

Posted by Erik Rainey Sun, 06 Jan 2008 05:19:00 GMT

I just recently got Amber setup on my swallow and gurgitate-mail system today, which turned out to be more of a bear than I thought it would. The main issues had to do with installing 0.9.5 rubygems locally on her accounts, configuring DSPAM, and setting up the MySQL database. As promised eariler, here's a run down of the features of this system:

Advantages

  • "Quick-to" addresses. Don't want a million aliases? Auto-create them with quick-to's. These allow you to setup a run that says "any address with looks like xxxxxx-com, put in the Commercial folder". This means I don't have to have separate microcenter-com, amazon-com, etc, emailing aliases (which I used mainly to ferret out spammers). Now they are created automatically and always get stuffed into my Commercial folder.
  • Universal "Read" Count: Since this is an IMAP account, I never have to worry about which device/client has read which email.
  • Really good Spam engine, DSPAM.

Disadvantages

  • DSPAM needs it's own MySQL database.
  • DSPAM needs to have it's tables purged every once in a while
  • Gurgitate-Mail and Swallow need a generic rules script which is part of neither.
  • Swallow has to be configured for exactly what you want. This took the least amount of time out of all these.

Assumptions

This brief guide assumes:
  • You have your own domain.
  • ...on Dreamhost.com
  • ...you have webpanel access
  • ...you can create users.

Installing:

  1. Create private domain, or subdomain.
  2. Create the main user account, make sure they have email.
  3. Create a "catch-all" email forwarder, for that subdomain.
  4. If you just forward the catch-all to your main, you don't need to worry about a spamfilter account, but if you want to reduce the flow to your main (add subsequently reduce the email in your suspicious folder, you can create a secondary account in domain which will receive the catch-all's and forward to your main user as needed. However, this requires that the secondary's .procmailrc has to be configured manually to coincide with your main user's ruleset.yaml (to be described later).
  5. Install RubyGems locally (I used $HOME/usr as my prefix)
  6. Install Gurgitate-Mail Gem
  7. Install Swallow Gem
  8. Download .gurgitate-rules.rb (renamed to .gurgitate-rules.rb)
  9. Download example .swallow-config (rename to .swallow-config)
  10. Download example ruleset.yaml
  11. Create Whitelist.yaml (a YAML array of strings which are email addresses)
  12. Create Aliases.yaml (another YAML array of strings which are email address)
  13. Install DSPAM on Dreamhost
  14. Create a MySQL host and table for DSPAM
  15. Create Folder structure in your mail client to reflect those in your ruleset. You must have a:
    • Innocent - for emails which are wrongly marked as Junk (in the Junk folder)
    • Junk - emails which DSPAM thinks are spam
    • Suspicious - emails which weren't handled. They weren't in the whitelist, or junk, so they could be fine, but you'll have to handle them manually. Put them in Junk if they are.
  16. Write a .procmailrc for your account. Don't forget to create the .forward.postfix file.
  17. Optional: Train DSPAM
For robustness, your .procmailrc should have a fallback entry in case the MySQL server is down or some permissions are off. Here's what mine does:
MAILDIR=$HOME/Maildir
LOGFILE=$MAILDIR/procmail.log
SHELL=/bin/sh
RUBYLIB="$HOME/usr/local/lib/site_ruby/1.8"
GEM_HOME="$HOME/.gems"
GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"
PATH="$HOME/usr/bin:$GEM_HOME/bin:${PATH}"
LINEBUF=4096

# Use Gurgitate Mail to Sort my email.
:0
| $HOME/.gems/bin/gurgitate-mail

# We've not been able to decide what to do with it, lets just stick it in the
# Suspicious Folder.
:0
$HOME/Maildir/.Suspicious/

Posted in |

Poor Man's Tagging

Posted by Erik Rainey Thu, 30 Aug 2007 21:36:00 GMT

an adventure in triple nested hashes.

PMT is a ruby script which can help you sort your data in a manner which has been heretofore unavailable in Windows NT/2k/XP. Lets say you have a lot of files of a limited set of types (source code, docs, TRM's, manuals, etc...) which are used in a limited set of projects that you work on, all which can be grouped together under some sort of name. Lets say for exmaple we have a few sets of these.

  • Your custom Rails App in source code for some project
  • This ruby script and it's docs
  • Your library of PDF's about programming
  • A few year's tax returns

PMT allows you to "tag" your data, in a exceptionally crude and gross scale, and then sorts it into a tagging heirarchy in your file system using "junctions" in Windows (or softlinks in other OS's) to point back to the original data.

First, arrange your data in the "raw" folder with the following naming template: name_type_project

  raw/
      MyCustomApp_src_Programming/
      pmt_src_Programming/
      pmt_doc_Programming/
      Books_pdf_Programming/
      taxes2006_doc_Finances/
      taxes2005_doc_Finances/

And then run the script to auto-generate this tree (all peers to "raw"):

  by project/
      Finances/
          doc/
              taxes2006/
             taxes2005/
      Programming/
          doc/
              pmt/
          src/
              MyCustomApp/
             pmt/
          pdf/
              Books/     
  by type/
      doc/
          Programming/
              pmt/
          Finances/
              taxes2006/
             taxes2005/
      src/
          Programming/
              MyCustomApp/
             pmt/
      pdf/
          Programming/
              Books/ 
  by name/
      taxes2005/
          doc/
              Finances/
      taxes2006/
          doc/
              Finances/
      pmt/
          doc/
              Programming/
          src/
              Programming/
      MyCustomApp/
          src/
              Programming/
      Books/
          pdf/
              Programming/

These are just examples. You can develop your own Project names, types, group names. You might find that only one type of organization appeals to you. I found that I tend to use multiple approaches to find information. Using this system, you can find it anyway you need to.

Dependencies

This project is dependent on the "junction.exe" program provided by http://www.sysinternals.com. It's a really neat little utility that takes all the headache out of making junctions in Windows (the ruby implementation would be quite nasty).


Usage

Simply call the scripts with -c for create, -d for delete, or -r to delete, then create the structure. It will assume that you'll want to have the folder structure defined from where you call it.

by name
by type
by project
raw
[emrainey@macbookpro ~/Data]$ pmt.rb -c

Incidently this should also work in *nixes too like Mac OSX, but it uses "ln -s" instead of junctions.


Posted in | 1 comment |

A preface to Gurgitate-Mail on Dreamhost

Posted by Erik Rainey Tue, 23 Oct 2007 16:23:00 GMT

When I got my iPhone, I decided to go back to using my Dreamhost account through IMAP so that I could have a single account with a persistent state. While this is nice, I didn't want to have to wade through a ton of spam on my iPhone. Since I wasn't neccesarily have Mail.app or Thunderbird open all the time at home running mail filters, and you can't do that on the iPhone, I was in a bind. How do I filter my mail easily and still use IMAP across multiple devices?


I came across Gurgitate-Mail, a great little filter which is launched by procmail or whatever you use to receive email. You can write some pretty concise email rules or make it even more complex. The point is that you can write rules in a proper programming language instead of cobbling together something in your favorite Mail program. In the coming days I will be posting more about what I've done.

Posted in , | no comments |

Music Rental Services

Posted by Erik Rainey Thu, 05 Jan 2006 21:02:00 GMT
I was thinking to myself that it's amazing that rental music services still exist on the internet, because I thought that it was basically a losing proposition. I decided to test my hypothesis though...

Auf Ruby Bitte!
>> AvgLifeSpan = {"male" => 74, "female" => 78}
=> {"female"=>78, "male"=>74}
>> serviceFee=5
=> 5
>> CurrentAge=28
=> 28
>> YearsRemaining = AvgLifeSpan["male"] - CurrentAge
=> 46
>> MonthsRemaining = YearsRemaining * 12
=> 552
>> EstimatedServiceCost = MonthsRemaining * serviceFee
=> 2760
>> CurrentSongCount=2872
=> 2872
>> CostPerSong=0.99
=> 0.99
>> TotalCurrentInvestment=CurrentSongCount * CostPerSong
=> 2843.28

So given a flat service fee for life (impossible given inflation), I'm just about to hit the tipping point. But then I remembered...
>> AbilityToPlayMyMusicAnywhereOrAnyhow="Priceless"
=> "Priceless"

Posted in | no comments |

2 New T-Shirts

Posted by Erik Rainey Sat, 29 Oct 2005 05:01:00 GMT
You'll find 2 new t-shirts in my pixel tee's store. Ruby Life and Workout Shirt (that one's for working out). These are in addition to the normal stock of fine nerd-related t-shirts, such as Katamari Damacii. Enjoy!

Posted in | no comments |