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 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 |
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.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 >') |
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
>>> self._writeTimings | |
[0.03816699981689453, | |
0.0008051395416259766, | |
0.07694196701049805, | |
0.0007631778717041016, | |
0.0004780292510986328, | |
0.0005741119384765625, | |
0.0005929470062255859, | |
0.00044918060302734375, | |
0.0007309913635253906, |
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.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!" |
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
# 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() { |