This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; cwc.el --- whitespace-cleanup only for changed lines | |
;; | |
;; Author: Ralf Schmitt <[email protected]> | |
;; Version: 0.1 | |
;; Last Changed: 2010-04-13 17:03:32 by ralf | |
;;; Commentary: | |
;; | |
;; run whitespace-cleanup only on changed lines in a buffer. needs | |
;; highlight-changes mode to do it's work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Last-changed: 2010-07-29 00:39:14 by ralf | |
""" | |
this module installs a custom __import__ function, which switches | |
sys.modules on a per-thread basis. patch_all must be called from the | |
gevent thread. the threads will only import unpatched modules. | |
""" | |
import imp, sys, threading |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import sys, os, signal, getopt, time | |
base_cgroup = "/cgroup" | |
def get_pids(name): | |
pids = open(os.path.join(base_cgroup, name, "tasks")).read().split() | |
return pids |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# only works with patched gevent from http://github.com/schmir/gevent | |
from gevent import tlmonkey | |
tlmonkey.patch_all() | |
import gevent | |
from gevent import tpool | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gevent/greenlet.py b/gevent/greenlet.py | |
index 93076db..351aac6 100644 | |
--- a/gevent/greenlet.py | |
+++ b/gevent/greenlet.py | |
@@ -156,6 +156,20 @@ class Greenlet(greenlet): | |
self._notifier = None | |
self._start_event = None | |
+ current = getcurrent() | |
+ self._leader = getattr(current, "_leader", None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
from gevent import tlmonkey, spawn, sleep, tpool | |
tlmonkey.patch_all() | |
def loop(): | |
while 1: | |
print "hello" | |
sleep(5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import gevent.monkey; gevent.monkey.patch_all() | |
import gevent, fcntl, os | |
def doit(): | |
count = 0 | |
while 1: | |
count += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/apipkg.py b/apipkg.py | |
--- a/apipkg.py | |
+++ b/apipkg.py | |
@@ -30,7 +30,11 @@ | |
def importobj(modpath, attrname): | |
module = __import__(modpath, None, None, ['__doc__']) | |
- return getattr(module, attrname) | |
+ attrs = attrname.split(".") | |
+ tmp = module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
from gevent import monkey | |
# comment out the following line to make it work | |
monkey.patch_all() | |
import os, signal | |
from gevent import socket, core, event, Timeout, hub | |
pid2status = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def AliasModule(modname, modpath): | |
getmod = lambda: importobj(modpath, None) # do we need caching?? | |
class AliasModule(ModuleType): | |
def __repr__(self): | |
return '<AliasModule %r for %r>' % (modname, modpath) | |
def __getattribute__(self, name): | |
return getattr(getmod(), name) |
OlderNewer