Tag: Python

  • New Release – Odoo DarkroomJS Widget

    New Release – Odoo DarkroomJS Widget

    = Odoo Web – DarkroomJS Widget = LasLabs has released a new [[https://www.odoo.com|Odoo]] [[https://github.com/MattKetmo/darkroomjs|DarkroomJS]] widget that can be used on any Many2one image field, allowing for easy image manipulation in form views. The Odoo DarkroomJS widget can be found [[https://repo.laslabs.com/projects/ODOO/repos/web/browse/web_widget_darkroom|in the LasLabs repo]] or [[https://github.com/laslabs/odoo-web/tree/release/9.0/web_widget_darkroom|on our GitHub mirror]]. This widget will allow you to perform…

  • Python CloudFlare API Library

    I have just recently started experimenting with [[https://www.cloudflare.com/|CloudFlare’s]] services & API. In order to migrate my current framework, I required the ability to work with this API via Python. [[http://libcloud.apache.org/|Apache’s Libcloud]] does not have a CloudFlare driver, and the requirements for building a supported driver require quite a bit more time than rolling a library…

  • Creating A Python Plugin Framework With Metaclasses

    This tutorial will walk you through creating a generic plugin framework in Python using metaclassing. This framework can be easily be dropped into existing code to allow seamless integration of Python plugins. There are essentially 3 parts to this framework: # **The mount point** – This provides a central location between the plugins and the…

  • 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…

  • 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…

  • Finding The Geometric Mean In Python

    Geometric means are a quick and easy way to benchmark system/interpreter performance. The below function is an example of calculating geometric averages in Python: {{{ lang=python def geometric_mean(nums): ”’ Return the geometric average of nums @param list nums List of nums to avg @return float Geometric avg of nums ”’ return (reduce(lambda x, y: x*y,…

  • Compiling PyPy From Source

    [[http://pypy.org/|PyPy]] is significantly faster when compared against the default [[http://en.wikipedia.org/wiki/CPython|CPython]] interpreter. For the most part, this interpreter functions the same way that CPython does, and most libraries will run with no issues. In my testing, PyPy was 5-10 times faster than CPython and I was able to install/use every library other than [[http://www.riverbankcomputing.com/software/pyqt/download|PyQt4]] and [[http://trac.edgewall.org|Trac]].…

  • OpenVPN Server Configuration Script – Ubiquiti EdgeRouter Lite

    =The lazy way to configure OpenVPN Server on a Ubiquiti EdgeRouter Lite= I have a Ubiquiti EdgeRouter Lite that I use as a staging platform for systems in production. Because I have had to reconfigure the VPN so many times on this device, I created a simple Python tool to run through the entire process…

  • Dynamic DNS Using LibCloud – EdgeRouter

    This tutorial is aimed for users with a dynamic IP, and a DNS host that does not support DynDNS. Basically, we will push our new IP every time that it changes. The steps outlined in this tutorial will work with the providers listed in [[https://ci.apache.org/projects/libcloud/docs/dns/supported_providers.html#provider-matrix|Apache’s documentation]], but I have only actually tested with Rackspace. ===…

  • Install scipy for python 2.7 in Ubuntu

    Surprisingly the `scipy` package was not as straightforward of an installation as most Python modules; this tutorial will walk you through that process. # The first step is to download `easy_install`, and the libraries required for `scipy` {{{ lang=bash sudo apt-get install python-setuptools liblapack-dev libblas-dev }}} # Use `easy_install` to install `scipy` and other required…