Use Linux to build win32 installers for Python apps

A python-based project I'm working on has a win32 user that I need to support. Until yesterday I've been moving to a win32 laptop in order to run python setup.py bdist_wininst so I can produce a self-installing executable. Then I discovered how trivial it is to use ...

An Interesting pid File Race

ISC's dhcpd uses this code to check for an already-running daemon:

/* Read previous pid file. */
if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
    status = read (i, pbuf, (sizeof pbuf) - 1);
    close (i);
    if (status > 0) {
        pbuf [status] = 0;
        pid = atoi (pbuf);        /* If the previous server process is not still running,
           write ...

Hassle Free Way to Kill Sudo'd Jobs

Every now and then I have to run a foreground job under sudo that doesn't want to die when I hit ^C. Then it's a hassle to ^Z, get the pid of the sudo job, and sudo kill that pid.

So I wrote a little script (or a ...

Using Python's ctypes to Call Into C Libraries

The ctypes module makes loading and calling into a dynamic library incredibly easy:

>>> from ctypes import CDLL
>>> libc = CDLL('libc.so.6')
>>> print libc.strlen('abcde')
5

As with everything else in python, it gets even better when you scratch the surface. In the example above, CDLL returns an object ...

« Page 3 / 3