Skip to main content

Posts

Showing posts from January, 2015

Notes on distributing cython code

One of the conveniences of Python is the package system which allows you to install your program and any dependencies smoothly. The package system works very well when the code is pure Python, but can run into trouble when code written in cython or c is part of the program. I will illustrate some mis-steps I made while writing a install script for an example program that is a mixture of Python and Cython. I've put the code up on github and each step is a commit tag. You can follow along by setting up a virtual environment using virtualenvwrapper : mkvirtualenv cy-test And then trying to install the appropriate tag, e.g: git clone git@github.com:kghose/cython-example.git cd cython-example git checkout ex2 ex1 The module installs without errors, but because of me not indicating the paths of the cython files properly (I omit the  kgcyex  directory in the path) the cython files do not compile. You will note this because there are no compilation messages during th...

Running bash functions in parallel

I was blown away when I learned this. From this thread on stackoverflow it turns out that by simply adding an ampersand to a line containing a function call you can send it to run in the background! #!/bin/bash function foo { echo $1 sleep $1 date } for i in `seq 1 10`; do foo $i & done I always thought that this was restricted to programs/scripts you can call from the command line!

Electricity choice in Massachusetts

I've lived in Massachusetts for some years now and I've noticed that my electric bill is split into two parts: Delivery services and Supply services. I always thought that that was some itemizing detail, like the forty items I used to have on my phone bill and I ignored it. This month's bill was higher than expected and I took a closer look. After a little inspection I noted that the Supply services rate was higher than before. It said "Basic Fixed Service". After some messing around on the National Grid Website, I came to this page . The important information there is this: National Grid separates your bill into two services: supply and delivery. Supply Services is the portion of your electric service for which you can shop for your electricity supply from a supplier other than National Grid. These suppliers, often referred to as competitive suppliers, can be companies that produce or generate electricity or are brokers that buy electricity in the wholesale m...