Skip to content

Instantly share code, notes, and snippets.

from threading import Thread
from twisted.internet import reactor
from twisted.internet.threads import blockingCallFromThread
from twisted.names import client
running = False
def query():
global running
from twisted.internet import reactor, defer
from twisted.internet.protocol import ClientCreator
from twisted.protocols import amp
from ampserver import Sum, Divide
def doMath():
try:
a = raw_input('What number for a ? \n >')
b = raw_input('What number for b? \n >')
>>> self._writeTimings
[0.03816699981689453,
0.0008051395416259766,
0.07694196701049805,
0.0007631778717041016,
0.0004780292510986328,
0.0005741119384765625,
0.0005929470062255859,
0.00044918060302734375,
0.0007309913635253906,
from twisted.internet import defer, reactor, task, threads
def someCrypto():
# Not safe to use Twisted APIs here
result = hard_rsa_method()
return result
@defer.inlineCallbacks
def ciao():
print "antani!"
@exarkun
exarkun / docker-rerun.sh
Last active November 20, 2016 15:47 — forked from miracle2k/.bashrc
Convert an existing docker container into a "docker run" command line
# Convert an existing docker container into a "docker run" command line.
#
# This is useful when trying to debug containers that have been created
# by orchestration tools.
#
# Install jq: stedolan.github.io/jq/
jq="docker run --rm -i imega/jq:1.0.0"
function format_run() {