Wednesday, November 25, 2009

Useful hotkeys (for mac)

Switching between windows in the same application: Command + Tilde

See all keyboard shortcuts in eclipse: Command + Shift + L

Word completion in eclipse: Ctrl + .

Template completion: (Ctrl + Space, then Ctrl + Space)

Go do declaration: fn + F3

Go to previous location: Apple + Alt + Left arrow

Go to last edit location: Ctrl + Q

Open type: Apple + Shift + T

Open resource: Apple + Shift + R

Sunday, October 25, 2009

Food and drink combinations

Newman's Own Honey Flax Flakes and Silk soy milk go really well together.

Orange juice + cranberry juice is really good too.

Wednesday, October 21, 2009

Recovering an email attachment in python

To decode an attachment from the text of an email (using python), like:
--------------060805040508050904080009
Content-Type: image/jpeg;
name="img_3282.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="img_3282.jpg"

/9j/4AAQSkZJRgABAQEASABIAAD/4R5TRXhpZgAASUkqAAgAAAAJAA8BAgAGAAAAegAAABAB
AgAYAAAAgAAAABIBAwABAAAAAQAAABoBBQABAAAAmAAAABsBBQABAAAAoAAAACgBAwABAAAA
... ... ...
gFFdbQfZ9xIfe25gnfGOx+X+VTlt1VxCyMUeItGAec+5/SluCRQmiYhjIuHB27lzjPHP6VZm
059iM/7yJh4gCjsAc445GaSb7h02Da1jkgPgy7EGDuU55Hv+dKrUq5QqP//Z

use the following python script:
#!/usr/bin/env python

import sys
import mimetools

def main():
infile = open(sys.argv[1], 'r')
outfile = open(sys.argv[2], 'wb')
mimetools.decode(infile, outfile, 'base64')
print 'Greg is a bunneh.'

if __name__ == "__main__":
main()

and you will recover your attachment (for me it was the following image (i didn't catch the disk even though the photo indicates i did) ).

Friday, October 9, 2009

Second blog post ever!