Category: Notes-To-Self

  • Convert SVN to Mercurial (Script)

    Below is a simple Python script that will traverse your online SVN repo and run the necessary commands to convert it to Mercurial. This is probably useless to most, but it saved me a great deal of time converting a large set of repos so I figured posting it couldn’t hurt: {{{ lang=python #!/usr/bin/env python…

  • Determine Which Modules Are In A Package – Python

    Below is a method to enumerate Python modules located in a directory: {{{ lang=python import pkgutil def get_pkg_modules(pkg_path, recurse=False, add_prefix=”): ”’ Get modules of a package located at pkg_path @param str pkg_path Path of package to inspect @param bool recurse Recursive inspection? @param str add_prefix Add this prefix to results @return list List of modules…

  • Mercurial/Trac Changeset Hook

    Below is a Mecurial changegroup hook to modify tickets on a remote Trac instance using XML-RPC. To use it, place the following in your hgrc (make necessary changes in [trac-hook] section). * File: repo/.hg/hgrc {{{ lang=ini [extensions] trac_hg_hook = /path/to/trac_hg_hook.py [hooks] changegroup.sync = python:trac_hg_hook.hook [trac-hook] trac_root = /var/lib/trac api_url = https://trac_user:trac_pass@trac.example.com/xmlrpc repo_name = test python_eggs…

  • Performance Metrics – Apache vs Nginx

    We just deployed [[http://wiki.nginx.org/Main|Nginx]] as a forward proxy for our production server. Before deploying, we took some page load benchmarks so that we could get an idea of what we improved with this change. The benchmarking was a simple python script that opened 100 concurrent threads (3 times to spot outliers) to a list of…