Use plus-addressing with your Gmail address for filtering 0

Posted by timgoh
on Thursday, March 20

A lot of people know this already, but I’ve seen a few blank faces when I mention it in real life1, so I thought it’s worth a mention.

The gist of it is, joeschmoe@gmail.com, joeschmoe+purchases@gmail.com, joeschmoe+XYZ@gmail.com will all be received by the address joeschmoe@gmail.com, where XYZ is anything alphanumeric. This is very useful because you can filter on the “To” address, which makes it very specific.

So you can use joeschmoe+paypal@gmail.com for your Paypal account, and have a 100% accurate filter for any e-mail from Paypal, no matter what its subject, contents, or From address is. Plus if they ever sell your address to spammers, you would know.

There are lots of possibilities, so try what works out for you. You can have a specific joeschmoe+amazon alias, or register for multiple online stores with a joeschmoe+purchases alias.

If you do this with a brand new e-mail address and never give out the base local-part, you can constantly maintain a zero message inbox, with every incoming mail perfectly filed.

One caveat: not all sites obey RFC2822 to the letter – some of them disallow plus signs in the local-part (I suspect that most times this is not intentional, just incompetence—since it is much easier to copy-paste the canonical e-mail regex than roll your own).

PS. If there really is someone out there using joeschmoe@gmail.com… Mr. Schmoe you have my profound apologies.


1 You know how it is: you’re in a crowded bar, and some beautiful girl comes up to you and goes, “Excuse me, would you happen to know a more efficient way of filtering my e-mail?” while licking her lips slowly.

Colorize your shell

Posted by timgoh
on Tuesday, January 22

We all love syntax highlighting, but often don’t bring that love with us to our shell. Here’s a couple tips to have a useful multi-colored shell session

Shell Prompt

Add

export PS1='\[\033[1;34m\]\h\[\033[0;33m\] \w\[\033[00m\]: '

to your bashrc.

This will give you your host in blue and working directory in brown. One excellent thing to do with this is to color-code each of the servers you log in to regularly differently. That way you have an instant, easy to understand indicator of which server you are currently accessing, so that you don’t ‘rm -rf’ from the wrong shell.

To customize, the Red Hat Knowledgebase lists more options for colors, and will come in handy for the rest of this post as well.

If you want to make sense of that command, Linux.com has a quick tutorial

Searches

Came across this tip from scie.nti.st

Add

export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;33'

to your bashrc, and have matches highlighted.

Or of course you could use tools like ack or rak which have colorization built-in and are more efficient than the venerable ‘grep’.

Man pages

Get the ‘most’ command1. On Debian and derivatives it would be a straightforward

sudo apt-get install most
.

You should already have a

export PAGER=less
or similar line in your bashrc file. Change that to
export PAGER=most
Now ‘man’ a command, and find out what you’ve been missing.

Background

One of the new things I’ll be doing with ProgProg this year is writing on various practices I have accumulated over the years. I wouldn’t go so far to call them “best practices”—they are just things that work for me.

My previous company had a great habit of not ever sitting on its laurels when it came to process. We were constantly tweaking, and occasionally making significant changes to our process in an attempt to improve. I have adopted this concept for myself, and once a week I examine my work habits and pick out something I can do in a better way. I’m not promising a weekly ‘process’ post, but will be presenting anything I find extremely useful.


1 “Most” is a misnomer though. Given that thanks to geek humor “less” is better than “more”, the command should really be called “least”.