Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
import glob | |
import os | |
class Directory: | |
def __init__(self, path = '/'): | |
self.path = path | |
def __getitem__(self, key): | |
fn = os.path.join(self.path, key) | |
if os.path.exists(fn): |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.
Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!
import imaplib2, time | |
from threading import * | |
# This is the threading object that does all the waiting on | |
# the event | |
class Idler(object): | |
def __init__(self, conn): | |
self.thread = Thread(target=self.idle) | |
self.M = conn | |
self.event = Event() |