(╯°□°)╯︵ ┻━┻

Don't take life too seriously. You'll never get out of it alive.

Polygon with holes in aggdraw

Drawing polygons with holes have haunted me for a while and recently I had to do it in Python with PIL. Googling the subject gives you a hint. This code: import os import Image import aggdraw draw = aggdraw.Draw('RGB', (100, 100), 'white') path = aggdraw.Path() path.moveto(10, 10) path.lineto(10,60,60,60) path.lineto(60,10) path.lineto(10,10) path.moveto(20,20) path.lineto(40,20) path.lineto(40,40) path.lineto(20,40) path.lineto(20,20) pen = aggdraw.Brush("black") draw.path((25, 25), path, pen, None) img = Image.fromstring('RGB', (100, 100), draw.tostring()) p = os.path.join(os.path.dirname(__file__), 'box.png') img.save(p) Gives the following image:

Compiling scipy in 32 bit in a 64 bit environment (el5)

During the last 2 days I’ve been trying to compile an old product in 32 bit mode on a 64 bit Redhat Enterprise Linux 5 environment which should not be that hard. Python itself is no problem: TCC=“gcc -m32” ./configure (got information from here) And this approach works for almost every 3rd party software, except for Scipy. Scipy contains a lot of FORTRAN code and it wasn’t obvious how to get setup.py to understand that it should both build and link with the -m32 flag.

Using your smartphone in the US on vacation (T-mobile rocks)

This is something that has been discussed on forums everywhere and there is no real answer. Just arrived in San Francisco with my swedish iPhone 4, went into a T-mobile store and bought a Monthly4G package for 50$, this gives me unlimited data, talk and text for one month. Added 10$ and I got free text and landline calls to Sweden. The only bad thing is that T-mobile 3G network uses a frequency that the iPhone (and many smartphones) cannot use so I’m limited to Edge data transfer.

Login on Microsoft IAS from IOS SDK (cookie/form based login)

Recently I had to authenticate from an iOS device against a Microsoft IAS. Had never done this before and it was not that easy to find out how so I’m posting my solution here. For the record, I am not sure which version of IAS I’m authenticating against and actually I’m not even sure it’s IAS but still this solution should work for form based authentications. I’m using ASIHTTPRequest in iOS. - (void)loginWith:(NSString*)userName andPassword:(NSString*)password { NSLog(@“Login with user: %@ and pass: %@”, userName, password); NSURL *url = [NSURL URLWithString: @“https://domain.com/CookieAuth.dll?Logon”]; ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; [request setPostValue:@“Z2F” forKey:@“curl”]; [request setPostValue:@“0” forKey:@“flags”]; [request setPostValue:@“0” forKey:@“forcedownlevel”]; [request setPostValue:@“20” forKey:@“formdir”]; [request setPostValue:@“4” forKey:@“trusted”]; [request setPostValue:userName forKey:@“username”]; [request setPostValue:password forKey:@“password”]; [request setPostValue:@“Log On” forKey:@“SubmitCreds”];

Cloud Computing Economies of Scale

Just watched a very interesting session on Cloud Computing by James Hamilton from MIX10. http://channel9.msdn.com/events/MIX/MIX10/EX01 Really interesting about why you should use cloud computing instead of buying servers. Personally I already run my personal stuff in EC2, S3 and GAE and I will not go back to running an SMTP-server in the closet. Also my ISP had a 10 day outage this summer and emails don’t like that ;)