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
[root@cb050d8b672d /]# openssl x509 -in /etc/etcd/etcd.crt -text -noout | grep -C 2 X509v3 | |
cf:eb:6f | |
Exponent: 65537 (0x10001) | |
X509v3 extensions: | |
X509v3 Subject Alternative Name: | |
IP Address:172.22.0.3, DNS:172.22.0.3 |
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
ore = 15 | |
g1 = ore / 5. | |
g3 = 0 | |
g2 = 0 | |
for _ in range(100): | |
g3 += g1 / 2. | |
g2 = g1 / 5. | |
g1 = g2 / 2. | |
print 'g3', g3 |
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
class ClusterHTTPClient(HTTPClient): | |
def __init__(self, *args, **kwargs): | |
super(ClusterHTTPClient, self).__init__(*args, **kwargs) | |
if not profile.cluster: | |
raise ValueError('Cluster client invoked for an empty cluster!') | |
self._cluster = list(profile.cluster) | |
def do_request(self, *args, **kwargs): | |
for node in profile.cluster: | |
self._use_node(node) |
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
asdf=# create table foo(id int, version int); | |
CREATE TABLE | |
Time: 2.335 ms | |
asdf=# create function version_err() returns trigger as $$ | |
begin | |
raise exception 'wrong version'; | |
end; | |
$$ language plpgsql; | |
CREATE FUNCTION |
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 sys | |
from sqlalchemy import create_engine | |
from manager_rest.storage.sql_models import db | |
db.metadata.create_all(create_engine(sys.argv[1])) |
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 sys | |
from flask import Flask | |
from manager_rest.storage.sql_models import db | |
app = Flask(__name__) | |
app.config['SQLALCHEMY_DATABASE_URI'] = sys.argv[1] | |
db.init_app(app) | |
with app.app_context(): |
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 sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, Integer, ForeignKey, create_engine | |
from sqlalchemy.orm import relationship, Session, backref | |
Base = declarative_base() | |
eng = create_engine('postgresql+psycopg2:///asdf', echo=True) | |
class Parent(Base): |
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.protocols.basic import LineOnlyReceiver | |
from twisted.internet.defer import Deferred | |
from twisted.internet.endpoints import TCP4ClientEndpoint, connectProtocol | |
class MyLineReceiver(LineOnlyReceiver): | |
def __init__(self, to_send): | |
self._to_send = to_send | |
self.deferred = Deferred() | |
self._received = [] |
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 cloudify.decorators import workflow, operation | |
from cloudify.workflows import ctx as workflow_ctx | |
@operation | |
def sometask(ctx): | |
ctx.logger.info('ok {0}'.format(ctx)) # ctx is a CloudifyContext, not a WorkflowContext |
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
class ConnectionPool(txpostgres.ConnectionPool): | |
"""A txpostgres ConnectionPool that renders sqlalchemy queries | |
This is so you can pass a sqlalchemy Query object to .runQuery | |
and .runOperation. It will render it using the postgresql sqlalchemy | |
dialect. | |
""" | |
def __init__(self, **kwargs): | |
kwargs.setdefault('cursor_factory', NamedTupleCursor) | |
self._sqla_dialect = dialect() |
NewerOlder