Posts tagged: FUN

DjangoKit

This week is so busy that I don’t have time for a longer post, but I wanted to mention DjangoKit (attentive readers may have already spotted it in the sidebar), an OS X application wrapper for Django projects. Tom Insam went and did something that I’ve had on my “someday” list for a long time. It’s very much a 0.0.1 project right now, but I think it has great potential as an application testbed and as a platform for hybrid apps.

Podcasting Antipatterns

I periodically go searching for new tech-related podcasts to make my commute-time more edifying, interesting, or amusing. I’ll admit right up front that I’m picky – the only one I find myself returning to consistently is LugRadio, which I know is not everyone’s cup of tea. But I’m not looking for “Bob’s Gadget News”. Anyway, content aside, there are some production and style problems that have turned me off to so many podcasts that I’ve come to view them as established antipatterns.

Library of 1000 scammy spams

One of my neglected side projects, purportal.com, features a “Scammy spam library” where I share the text of scam emails I’ve been collecting. Today it reached the 1000-specimen milestone, so I wrote a little script to count word frequencies. The raw list reads like some of the less coherent messages itself:

account email our please ebay me paypal information bank any address through contact security am money funds us million…

I posted a bit more on the purportal.com news page.

Neat Python hack: infix operators

I came across this neat Python hack on reddit today, a technique for defining arbitrary infix operators. Not overriding + or >> et al., but creating keyword-style pseudo-operators that… well, the code is probably as clear as any description I could come up with:

class infix(object):
    """
    Clever hack (slightly modified) for defining infix operators. 
    Via http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
    Intended for use as a decorator.
    
    >>> @infix
    ... def removing(str, chars):
    ...     for char in chars:
    ...         str = str.replace(char, '')
    ...     return str
    ...
    >>> print 'Hello, world!' |removing| 'eo'
    Hll, wrld!
    """
    def __init__(self, function):
        self.function = function
    def __ror__(self, other):
        return infix(lambda x: self.function(other, x))
    def __or__(self, other):
        return self.function(other)
    def __call__(self, value1, value2):
        return self.function(value1, value2)

Some people hate this kind of stuff. That’s why we call it a hack, to indicate that we don’t think it’s a great building block for your missile control software. Some of Those People still get their underoos in a bunch regardless. But you have to admit it’s damned clever.

iPhone, youPhone, weallPhone

Apple and Cisco have reached an agreement on the disputed “iPhone” trademark, and – surprise – Apple gets to keep using it. From the Cisco press release:

Under the agreement, both companies are free to use the “iPhone” trademark on their products throughout the world.

To further differentiate brands, the Apple iPhone will also be known as “the real iPhone”, with the Cisco model being referred to as “Oh, I thought you meant the other one.”

More unexpanded spam macros

I posted one simple example of this a while back, but this one’s much better. (I’ve removed some uninteresting stuff like the actual routing.)

From ...
Received: ...
Date: ...
Received: from 192.168.0.%RND_DIGIT (203-219-%DIGSTAT2-%STATDIG.%RND_FROM_DOMAIN
[203.219.%DIGSTAT2.%STATDIG]) by mail%SINGSTAT.%RND_FROM_DOMAIN (envelope-from
%FROM_EMAIL) (8.13.6/8.13.6) with SMTP id %STATWORD for <%TO_EMAIL>;
%CURRENT_DATE_TIME
Message-Id: <%RND_DIGIT[10].%STATWORD@mail%SINGSTAT.%RND_FROM_DOMAIN>
From: "%FROM_NAME" <@FROM_EMAIL>
To: undisclosed-recipients:;

%TO_CC_DEFAULT_HANDLER
Subject: %SUBJECT
Sender: "%FROM_NAME" <%FROM_EMAIL>
Mime-Version: 1.0
Content-Type: text/html
Date: %CURRENT_DATE_TIME

%MESSAGE_BODY

That Received: line looks like a nice template for a SpamAssassin rule, if you use SpamAssassin.