Skip to content

Instantly share code, notes, and snippets.

PING google.com (74.125.226.4) 56(84) bytes of data.
64 bytes from lga15s42-in-f4.1e100.net (74.125.226.4): icmp_req=1 ttl=49 time=1276 ms
64 bytes from lga15s42-in-f4.1e100.net (74.125.226.4): icmp_req=2 ttl=49 time=746 ms
64 bytes from lga15s42-in-f4.1e100.net (74.125.226.4): icmp_req=3 ttl=49 time=466 ms
64 bytes from lga15s42-in-f4.1e100.net (74.125.226.4): icmp_req=4 ttl=49 time=642 ms
64 bytes from lga15s42-in-f4.1e100.net (74.125.226.4): icmp_req=5 ttl=49 time=426 ms
64 bytes from lga15s42-in-f4.1e100.net (74.125.226.4): icmp_req=6 ttl=49 time=834 ms
64 bytes from lga15s42-in-f4.1e100.net (74.125.226.4): icmp_req=7 ttl=49 time=1404 ms
64 bytes from lga15s42-in-f4.1e100.net (74.125.226.4): icmp_req=8 ttl=49 time=745 ms
64 bytes from lga15s42-in-f4.1e100.net (74.125.226.4): icmp_req=9 ttl=49 time=1243 ms
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!"
media@graviton:~$ sudo zpool status
pool: black
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
black ONLINE 0 0 0
ata-WDC_WD10EFRX-68PJCN0_WD-WCC4J4226746-part1 ONLINE 0 0 0
@exarkun
exarkun / Dockerfile-backend
Last active August 29, 2015 14:06
Flocker configuration for a Twisted Web-based virtual hosting frontend server container
FROM ubuntu:14.04
MAINTAINER Jean-Paul Calderone, exarkun@twistedmatrix.com
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y python-twisted-web
RUN apt-get autoremove
RUN apt-get clean
RUN mkdir -p /opt/flocker-links /var/run/flocker-links
# coding: utf-8
from inspect import getsource
from datetime import datetime
from OpenSSL.crypto import FILETYPE_PEM, TYPE_RSA, X509, PKey, dump_privatekey, dump_certificate
key = PKey()
key.generate_key(TYPE_RSA, 2048)
ESC[34mINFOESC[0m[0037] Processing signal 'terminated'
ESC[37mDEBUESC[0m[0037] starting clean shutdown of all containers...
ESC[37mDEBUESC[0m[0037] Clean shutdown succeded
Waiting for /var/run/docker.sock
ESC[37mDEBUESC[0m[0000] Registering HEAD, /containers/{name:.*}/archive
ESC[37mDEBUESC[0m[0000] Registering GET, /images/json
ESC[37mDEBUESC[0m[0000] Registering GET, /images/{name:.*}/get
ESC[37mDEBUESC[0m[0000] Registering GET, /containers/json
ESC[37mDEBUESC[0m[0000] Registering GET, /containers/{name:.*}/archive
ESC[37mDEBUESC[0m[0000] Registering GET, /events
@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() {
(txaws) exarkun@baryon:~/Work/LeastAuthority/txaws$ trial txaws | tail -n 1
PASSED (skips=12, successes=555)
(txaws) exarkun@baryon:~/Work/LeastAuthority/txaws$ python -m twisted.trial txaws | tail -n 1
FAILED (skips=12, failures=2, errors=11, successes=542)
(txaws) exarkun@baryon:~/Work/LeastAuthority/txaws$
[16:02:37] <exarkun> If it could be perfect, you could argue just make it a perfect proxy and forget about it
[16:02:52] <exarkun> Since it can't be, should it be a really good proxy that just fails at unpredictable times?
[16:03:07] <exarkun> Or should it be a very limited proxy that's obviously incomplete and doesn't trick anyone into thinking it's better than it is?
[16:03:41] <exarkun> which comes back to - what's accomplished by proxying more than the endpoint implementations themselves need?
[16:03:59] <exarkun> (not a rhetorical question, if we know what the end-user value is maybe the trade-offs become easier to weigh)
[16:06:51] <exarkun> Also, endpoint.connect() fires with the actual protocol, not the wrapper - right?
[16:07:12] <exarkun> So there's actually no reason to proxy arbitrary application interfaces
[16:07:27] <exarkun> Only the interfaces between the transport and the protocol
[16:07:50] <exarkun> That's different from ProtocolWrapper - which ends up exposed to application code.
(txaws) exarkun@baryon:~/Work/LeastAuthority/txaws$ cat /tmp/frozenwhat.py
import attr
@attr.s(frozen=True)
class Base(object):
a = attr.ib()
@attr.s
class Derived(Base):
b = attr.ib()