Monday, November 5, 2012

Format json file using Python

Json files being what they are, are usually badly formatted. Here's a neat way to pretty print (and validate) any json file using the json.tool module of Python:
    python -m json.tool example.json
Find json.tool here.

Tuesday, October 23, 2012

Fossil Cheat Sheet

Fossil is a great distributed version control by D.R. Hipp, primary author of SQLite.

The documentation is decent, but not great. I've put together a little cheat sheet to help with some tasks using Fossil.

Change repository password:

     fossil user [yourusername] password [newpassword]

Change target remote repository:

      fossil remote-url http://username:password@host.example.com:xxxx
  where xxx is a port number

Tuesday, March 6, 2012

Monday, March 5, 2012

How to setup an FTP server on Windows using Python



  1. First download Python. (2.7 because I'm not sure 3.x works with pyftpdlib)
  2. Next download pyftpdlib
  3. Install Python 2.7 from first step. This will usually install to C:\Python27
  4. Install pyftpdlib from the command prompt using Python from C:\Python27\python.exe as follows:
    • Un-tar and uncompress the pyftpdlib-x.y.z.tar.gz using 7zip. (Don't have 7zip? Either download it and install it. Or use something else. :)
    • From the command line, cd into the pyftpdlib.
    • Run the setup script as follows:
      c:\Python27\python.exe setup.py
              
    • Note that you might have to give the full path because I'm not sure python.exe will be in the environment PATH. Just easier that way.
  5. Write the pyftp.py script. See the tutorial here (or leave a comment if you want me to post a simple one). Change the hostname to your host IP address. (Don't know it? Get it using the ipconfig command.)
  6. Run the pyftp.py script as follows from the command line:
    c:\Python27\python.exe pyftp.py
            
  7. This should print out the port that your FTP server is running on.
  8. Enjoy the FTP-goodness fun.

Wednesday, February 29, 2012

List of links on how to install Mac OS on a virtual machine

For my next trick, I will be trying to install Mac OS on a virtual machine.
First step is to research the information out there on this topic. Here's what I found:

  1. MacOS Xen: Snow Leopard as guest on a Xen domU
  2. XXX