- I've been using gevent in production for about 6 years, and I've only encountered a handful of issues:
- In gevent pre-1.0 there were issues with the DNS resolver
- I've had a couple of issues with gevent-openssl, which I've fixed by using a custom version: mjs/gevent_openssl#14 and mjs/gevent_openssl#12
- Celery hangs when gevent is monkeypatched. I haven't figured out why, and this might have been fixed in newer versions of celery (the one I'm using is fairly old).
- All of my experience using gevent is in fully monkeypatched mode. It's certainky possible to use outside of monkeypatch mode, but I don't know anything about that.
- See the
monkeypatches.py
andgevent_.py
files for my implementation of monkeypatching. - The
gevent_.py
file contains a couple things:
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 my_local(init): | |
key = object() | |
def getter(): | |
t = _app_ctx_stack.top | |
l = getattr(t, 'my_locals') | |
if l is None: | |
t.my_locals = l = {} | |
if key not in l: | |
l[key] = init() | |
return l[key] |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>KeepAlive</key> | |
<true/> | |
<key>Label</key> | |
<string>com.devpi.devpi-server</string> | |
<key>ProgramArguments</key> | |
<array> |
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
__author__ = 'archeg' | |
import httplib | |
import urllib | |
import urllib2 | |
import re | |
def URLRequest(url, params, headers, method="GET"): | |
if method == "POST": |
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
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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 sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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 python2 | |
# -*- coding: utf-8 -*- | |
""" | |
Usage: %prog [width [columns]] < table.csv | |
Pretty-print CSV file with fixed width columns. | |
Arguments: |
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 python2 | |
# -*- coding: utf-8 -*- | |
""" | |
Usage: %prog [width [columns]] < table.csv | |
Pretty-print CSV file with fixed width columns. | |
Arguments: |
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
from tornado import ioloop | |
from tornado import iostream | |
import socket | |
class Envelope(object): | |
def __init__(self, sender, rcpt, body, callback): | |
self.sender = sender | |
self.rcpt = rcpt[:] | |
self.body = body | |
self.callback = callback |
NewerOlder