This is now an actual repo:
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 twisted.enterprise import adbapi | |
from twisted.python import log | |
import MySQLdb | |
class ReconnectingConnectionPool(adbapi.ConnectionPool): | |
"""Reconnecting adbapi connection pool for MySQL. | |
This class improves on the solution posted at | |
http://www.gelens.org/2008/09/12/reinitializing-twisted-connectionpool/ | |
by checking exceptions by error code and only disconnecting the current |
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 | |
""" | |
Other Repositories of python-ping | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
* https://github.com/l4m3rx/python-ping supports Python2 and Python3 | |
* https://bitbucket.org/delroth/python-ping |
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
"""The reactor framework. | |
This module introduces the *reactor framework*, a collection of utilities to be | |
used in conjunction with the greelet library to solve the problem of inversion | |
of control in event-driven code. | |
Traditionally, writing event-driven code typically consists of "connecting" | |
signals to handlers (i.e. callbacks), which are to be invoked by the framework | |
in use when a certain "event" occurs. |
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
// all this `toJSON()` does is filter out any circular refs. all other values/refs, | |
// it passes through untouched, so it should be totally safe. see the test examples. | |
// only extend the prototype if `toJSON` isn't yet defined | |
if (!Object.prototype.toJSON) { | |
Object.prototype.toJSON = function() { | |
function findCircularRef(obj) { | |
for (var i=0; i<refs.length; i++) { | |
if (refs[i] === obj) return true; | |
} |
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
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
# This is free and unencumbered software released into the public domain. | |
# | |
# Anyone is free to copy, modify, publish, use, compile, sell, or | |
# distribute this software, either in source code form or as a compiled | |
# binary, for any purpose, commercial or non-commercial, and by any | |
# means. | |
# | |
# In jurisdictions that recognize copyright laws, the author or authors | |
# of this software dedicate any and all copyright interest in the | |
# software to the public domain. We make this dedication for the benefit |
This utility has now its own repo https://github.com/sroucheray/requestAnimationFrameRate
You can install it via npm
or bower
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
import logging | |
import zmq | |
class ZmqClient (object): | |
def __init__(self, socket, logger): | |
super(ZmqClient, self).__init__() | |
self._logger = logger | |
self._socket = socket |
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 python3 | |
#http://hg.python.org/cpython/file/default/Lib/test/test_asyncio | |
import sys | |
import mimetypes | |
from os import listdir, path as p | |
from argparse import ArgumentParser | |
from email.utils import formatdate |
OlderNewer