July2012

Install Expat Shield in a Virtual Machine to avoid security issues

Expat Shield proxies your browsing through the UK. Install it in a Virtual Machine to create a hard barrier for tunneled traffic to avoid security issues with your login and passwords.

Redirect stdout to a string in python

I wanted to reuse a piece of code that’s complicated with recursive calls to itself and the whole thing prints to standard output. Instead of modifying the code to write to a file object, I just adjusted my own code with an internal class to redirect stdout to a string while the recursive code is running.

Mount a partition from a raw file dd backup of a whole disk

I backed up a disk on the fly to another host using dd output piped to netcat on the host I was backing up, and netcat output piped back to dd input on the receiving end. This worked great, except it turns out I don’t need the whole disk.

Get the filename of the currently executing python script

As you would expect, there are several ways to do this. Using stack from the inspect module will give you the full path and filename of how it was executed. If you run from a relative path such as ./src/file then the stack item will contain just that part.