This file contains hidden or 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 sys | |
| import gevent | |
| from gevent.monkey import patch_all; patch_all() | |
| from gevent import server, event, socket | |
| from multiprocessing import Process, current_process, cpu_count | |
| """ | |
| Simple multiprocess StreamServer that proxies messages between clients. | |
| Avoids using a multiprocessing.Event since it blocks on a semaphore. |
This file contains hidden or 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 sys | |
| from gevent import server | |
| from multiprocessing import Process, current_process, cpu_count | |
| def note(format, *args): | |
| sys.stderr.write('[%s]\t%s\n' % (current_process().name, format%args)) | |
| def echo(socket, address): | |
| print 'New connection from %s:%s' % address |
This file contains hidden or 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
| <?php | |
| define("SAFE_PLACE", "FD622N18U8h7y4Xs76cO80QX5AfOWkvg"); | |
| require_once('./config/config.global.php'); | |
| // ---------------------------------------------------- | |
| // Launch MySQL Connection | |
| // ---------------------------------------------------- |
This file contains hidden or 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 os | |
| import signal | |
| import sys | |
| def when_ready(server): | |
| if server.worker_class.__name__ != 'GeventWorker': | |
| server.log.info('Skipping code reloading since worker is not gevent.') | |
| return | |
| def monitor(): |
This file contains hidden or 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
| In [1]: from django.contrib.auth.models import User | |
| In [2]: import datetime | |
| In [3]: qs = User.objects.filter(date_joined__lte=datetime.datetime.now) | |
| In [4]: print qs.query | |
| ------> print(qs.query) | |
| SELECT "auth_user"."id", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."password", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."is_superuser", "auth_user"."last_login", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."date_joined" <= 2010-09-21 13:58:50.361784 |
This file contains hidden or 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 os | |
| import signal | |
| import sys | |
| def when_ready(server): | |
| def monitor(): | |
| modify_times = {} | |
| while True: | |
| for module in sys.modules.values(): |
This file contains hidden or 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 flask import Flask, request | |
| from gevent.event import AsyncResult | |
| from gevent.wsgi import WSGIServer | |
| app = Flask(__name__) | |
| waiters = [] | |
| @app.route("/") | |
| def main(): |
This file contains hidden or 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
| komodo.assertMacroVersion(2); | |
| if (komodo.view) { komodo.view.setFocus(); } | |
| var cmdName = 'command_name_here'; | |
| var part = ko.toolbox2.getToolsByTypeAndName('command', cmdName); | |
| if (!part.length) { | |
| alert("Couldn't find a command called '" | |
| + cmdName | |
| + "'when executing macro."); | |
| return; | |
| } |
This file contains hidden or 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 sys | |
| from IPython.Debugger import Pdb | |
| from IPython.Shell import IPShell | |
| from IPython import ipapi | |
| import pprint | |
| shell = IPShell(argv=['']) | |
| class PdbWithWatch(Pdb): |
This file contains hidden or 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
| reposting as public: | |
| If you get this error: | |
| "Error: cannot import name gqn" | |
| Then: | |
| git clean -df |