- Locate the file with your mail attachment in it; the file’s location may vary depending on the mail server software you are using.
- Take a copy of the mail file, for editing, and call it
- Open the copy in your favourite editor (which had better be Vim) and strip out the base64 attachment
- At the top of the file, add the headers for the decoder
begin-base64 permission filenameeg
begin-base64 0644 My Long file name.doc
- At the end of the file add the trailer, then save
- You file should look something like
begin-base64 0644 My Long file name.doc UmFyIRoHAM+QcwAADQAAAAAAAABKcXSggC4A2toXANraFwACeWsUbIJlpjYd MA4AIAAAAHBcRFNDMDE0MjMuSlBH/9j/4VI7RXhpZgAASUkqAAgAAAALAA4B AgAgAAAAkgAAAA8BAgAFAAAAsgAAABABAgAHAAAAuAAAABIBAwABAAAAAQAA ABoBBQABAAAAwAAAABsBBQABAAAAyAAAACgBAwABAAAAAgAAADIBAgAUAAAA 0AAAABMCAwABAAAAAgAAAGmHBAABAAAAAAEAAKXEBwAcAAAA5AAAAMgIAAAg [..snip..] SLS3LtIk04eQrKls4cPnv1AwD0qRnjuFdl3JLtZJSQp3Y4Ut7Y964ubEyZNa lOoyGNpHJjKh9tvl1dwB1xkgZ4x0P4UAhS6L+9iVeEM20yZI2jKkYJPNdeNr OxdOrQcD/9nz13TggCEAAAAAAAAAAAACAAAAAI9FbDgUMAEAEAAAAHDEPXsA QAcA ====
- Run the decoder
- A file called
My Long file name.docshould appear in the current directory with permissions 0644
- Move the file to your web server’s document root and hay presto it is visible to the world.
I love weirdy graphics that make your eyes go funny. This is a fine example; all you have to do is say which way the girl is spinning? If you stare at it for a while she will change directions while you are watching!
The reasons why the dancing lady changes direction is explained here by Beau Lotto in his TED talk: Optical illusions show how we see.
The directory lister under UNIX is called
ls. In the deep and distant past this was a very black and white affair. GNU has changed all that by introducing an environment variable called
LS_COLORS which allows you to set the colours of files based on extension, permissions and file type.
As usual the instructions on how to configure it are locked away so that only a privileged few know how to configure them. When I started looking for this holy grail, I came across some poor guy who had worked it out through trial and error. I thought that there must be some documentation, somewhere on the internet. But, no! I have pieced together all the information I could find from mail list postings, support forums and when I eventually found it, the source code.
I will attempt to describe what I have discovered on my journey so that others may start from here with a better understanding of how
The BSD implementation of
ls used in BSD, FreeBSD and MacOS is slightly different. It uses a set or unset
CLICOLOR environment variable or the
ls command line switch
-G to indicate whether to use the colours defined in the environment variable
LSCOLORS. Whereas GNU's
ls uses the command line switch
−−colour and the environment variable
LS_COLORS instead (Thanks Gilles).
If you do not specify a colour to use then the default will be used, which is why unsetting
LS_COLORS has no visible effect. The defaults can be obtained by running the
which gives you
The database in question is a globally readable file which can be overridden depending on your terminal type. The database file is initially set to
/etc/DIR_COLORS then overridden with one of the following. The first being the least precedent and the last being the most.
This configuration file has several options:
- tty (add colour to
lswhen output is on the command line)
- all (all colours to ls on the command line and when piping i.e.
ls > file.txtwill have colour coding information in it)
- none (switch off)
- tty (add colour to
OPTIONS- strictly not related to
LS_COLORS. This allows you to add extra options to the
TERM- one line per terminal type that supports colour.
EIGHTBIT- 1 (on) or 0 (off) to allow 8-bit output.
- and finally the colour definitions for file type and file extensions.
On most systems the
ls command has been aliased to use the coloured option by default:
alias "ls=ls --color=auto"
LS_COLORS environment variable is a colon separated list of key=colour pairs. There are 2 types of key: file types and file extensions.
Below is a list of all the keys (that I know of!). Thanks to Bartman for his starter page.
|no||NORMAL, NORM||Global default, although everything should be something|
|ln||SYMLINK, LINK, LNK||Symbolic link. If you set this to 'target' instead of a numerical value, the colour is as for the file pointed to.|
|pi||FIFO, PIPE||Named pipe|
|bd||BLOCK, BLK||Block device|
|cd||CHAR, CHR||Character device|
|or||ORPHAN||Symbolic link pointing to a non-existent file|
|su||SETUID||File that is setuid (u+s)|
|sg||SETGID||File that is setgid (g+s)|
|tw||STICKY_OTHER_WRITABLE||Directory that is sticky and other-writable (+t,o+w)|
|ow||OTHER_WRITABLE||Directory that is other-writable (o+w) and not sticky|
|st||STICKY||Directory with the sticky bit set (+t) and not other-writable|
|ex||EXEC||Executable file (i.e. has 'x' set in permissions)|
|mi||MISSING||Non-existent file pointed to by a symbolic link (visible when you type ls -l)|
|lc||LEFTCODE, LEFT||Opening terminal code|
|rc||RIGHTCODE, RIGHT||Closing terminal code|
|ec||ENDCODE, END||Non-filename text|
|*.extension||Every file using this extension e.g. *.jpg|
The keys (above) are assigned a colour pattern which is a semi-colon separated list of colour codes.
|100||Dark grey background|
|101||Light red background|
|102||Light green background|
|104||Light blue background|
|105||Light purple background|
Most of the defaults are all right and not really worth changing. By default, executable directories show up as white on a light green background and normal directories which are blue on a black background. Both of these settings make your eyes go funny! So here is how to change just them.
LS_COLORS="ow=01;90:di=01;90" export LS_COLORS
The above snippet changes both directories colours to grey.
Just as an aside, the easiest way to remap your colours is via the client control interface. I use PuTTY which allows you to redefine the terminal colour settings, but I think I'll save that for another block entry!
A while ago I wrote an article called Training SpamAssassin, Horde, IMAP, Plesk user configuration which describes how to integrate Spam Assassin user learning and Plesk's installation of Horde mail client.
Sam left a comment suggesting that I tell Horde about the good work I have done - so I did! Opened an enhancement bug request and after a bit of a chat they agreed to put my changes into IMP 4.2. Hurray!
I'll wait for 4.2 release then update my original article.