Skip to content

Instantly share code, notes, and snippets.

View tonytan4ever's full-sized avatar

Tony Tan tonytan4ever

View GitHub Profile
https://codility.com/trial/
https://codility.com/
In base −2, integers are represented by sequences of bits in the following way. Bits are ordered from the least to the most significant. Sequence B of N bits represents the number:
sum{ B[i]*(−2) for i = 0..N−1 }. The empty sequence represents 0.
Write a function:
def solution(A)
[[local|localrc]]
LIBS_FROM_GIT+=python-neutronclient
GIT_BASE=${GIT_BASE:-https://git.openstack.org}
#USE_VENV=True
#OFFLINE=False
#RECLONE=Yes
#PIP_UPGRADE=True
KEYSTONE_TOKEN_FORMAT=UUID
MYSQL_PASSWORD=password
RABBIT_PASSWORD=password
File "neutron/scheduler/l3_agent_scheduler.py", line 366, in schedule
plugin, context, router_id, candidates=candidates)
File "neutron/scheduler/l3_agent_scheduler.py", line 228, in _schedule_router
plugin, context, sync_router)
File "neutron/scheduler/l3_agent_scheduler.py", line 183, in _get_candidates
active_l3_agents)
File "neutron/db/l3_agentschedulers_db.py", line 465, in get_l3_agent_candidates
agent_mode = agent_conf.get(constants.L3_AGENT_MODE,
AttributeError: 'module' object has no attribute 'L3_AGENT_MODE'
dockeradmin@docker-openstack-vm:/media/sf_Rackspace/devstack$ openstack token issue
+------------+----------------------------------+
| Field | Value |
+------------+----------------------------------+
| expires | 2016-07-13T17:46:35Z |
| id | ac5934a0bf064929905db4ced67894a9 |
| project_id | 099d0b098a3246edb09d2ccdb58baf18 |
| user_id | 98abd8976b8e44aa96cb8bffbbd9ddbc |
+------------+----------------------------------+
dockeradmin@docker-openstack-vm:~$ openstack token issuePassword:
+---------+----------------------------------+
| Field | Value |
+---------+----------------------------------+
| expires | 2016-07-13T17:42:39Z |
| id | a67dc096cf934c8b89b90322e877b7e0 |
| user_id | 98abd8976b8e44aa96cb8bffbbd9ddbc |
+---------+----------------------------------+
$ keystone token-get
Traceback (most recent call last):
File "/usr/bin/keystone", line 6, in <module>
from keystoneclient.shell import main
ImportError: No module named shell
{
"NeutronError": {
"message": "rule:delete_policy on {'rules': [{'max_kbps': 100, 'type': 'bandwidth_limit', 'id': 'c8ca6f7b-75bf-48a8-b136-6ded04f3f0f7', 'max_burst_kbps': 0, 'qos_policy_id': '4904b6e4-453d-41e1-bc00-2f53dc0bee3f'}], 'tenant_id': u'98abd8976b8e44aa96cb8bffbbd9ddbc', 'id': '4904b6e4-453d-41e1-bc00-2f53dc0bee3f', 'attributes_to_update': []} by {'domain': None, 'project_name': None, 'tenant_name': None, 'project_domain': None, 'timestamp': '2016-07-13 16:30:17.187248', 'auth_token': '69e40d01dc944de3aa63a072268a73d5', 'resource_uuid': None, 'is_admin': False, 'user': None, 'tenant': '98abd8976b8e44aa96cb8bffbbd9ddbc', 'read_only': False, 'project_id': '98abd8976b8e44aa96cb8bffbbd9ddbc', 'user_id': None, 'show_deleted': False, 'roles': [''], 'user_identity': u'- 98abd8976b8e44aa96cb8bffbbd9ddbc - - -', 'tenant_id': '98abd8976b8e44aa96cb8bffbbd9ddbc', 'request_id': 'req-4d8ce4b4-75d7-4373-a585-9e1145394ce8', 'user_domain': None, 'user_name': ''} disallowed by policy",
"type": "PolicyNo
new_model = 'neutron.db.agent.models.Agent'
LOG.warning(_LW("You are using the deprecated Agent model: "
"%(deprecated)s.Use the recommended model %(new)s instead."),
{'deprecated': '%s.Agent' % __name__,
'new': new_model})
Agent = moves.moved_class(agt.Agent, 'Agent', __name__)
InvalidRequestError: Table 'agents' is already defined for this MetaData instance. Specify 'extend_existing=True' to redefine options and columns on an existing Table object.