Skip to content

Instantly share code, notes, and snippets.

.....
stdoutPipe = subprocess.PIPE # line 722 of Gardener.py
stderrPipe = subprocess.PIPE
if platform.platform().lower().startswith('windows'):
if printerrKey in commandDict and commandDict[printerrKey]:
stdoutPipe = None
else:
stderrPipe = None
@roaet
roaet / useful_pandas_snippets.py
Created January 10, 2017 20:31 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
# List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
# Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
# Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(valuelist)]
#!/usr/bin/env python
# coding: UTF-8
# code extracted from nigiri
import os
import datetime
import sys
import traceback
import re
Change: /etc/lxc/default.conf
lxc.network.type = veth
lxc.network.script.up = /etc/lxc/ovs_up
lxc.network.script.down = /etc/lxc/ovs_down
lxc.network.flags = up
lxc.network.hwaddr = 00:16:3e:xx:xx:xx
OVS_UP
#!/bin/bash
@roaet
roaet / gist:5827237
Created June 20, 2013 22:18
Issues with flask quickstart
│ from .views import API
│ File "/home/jhammond/dev/flask-api-test/.venv/local/lib/python2.7/site-packages/flask_restless/views.py", line 41, in
│ <module>
│ from .exceptions import json_abort
│ File "/home/jhammond/dev/flask-api-test/.venv/local/lib/python2.7/site-packages/flask_restless/exceptions.py", line 1
│4, in <module>
│ from flask.exceptions import JSONHTTPException
│ImportError: No module named exceptions
@roaet
roaet / gist:5390624
Created April 15, 2013 19:24
created by github.com/tr3buchet/gister
GLOB sdist-make: /home/jhammond/dev/nova/setup.py
py26 inst-nodeps: /home/jhammond/dev/nova/.tox/dist/nova-2013.2.a5085.g364f6ee.zip
py26 runtests: commands[0]
py26 runtests: commands[1]
running testr
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ ./nova/tests
======================================================================
FAIL: nova.tests.integrated.test_api_samples.ScheduledImagesFilterJsonTest.test_server_get
tags: worker-0
----------------------------------------------------------------------
@roaet
roaet / gist:5201959
Last active December 15, 2015 04:29
Problem with quantum-client and keystone auth. Passwords in file are temporary. None of the services are configured to run https, so why is quantum-client, through the keystoneclient.middleware using https?
Output from quantum:
2013-03-19 21:46:21 DEBUG [keystoneclient.middleware.auth_token] Authenticating user token
2013-03-19 21:46:21 DEBUG [keystoneclient.middleware.auth_token] Removing headers from request environment: X-Identity-Status,X-Tenant-Id,X-Tenant-Name,X-User-Id,X-User-Name,X-Roles,X-Service-Catalog,X-User,X-Tenant,X-Role
2013-03-19 21:46:21 ERROR [keystoneclient.middleware.auth_token] HTTP connection exception: [Errno 1] _ssl.c:490: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
2013-03-19 21:46:21 DEBUG [keystoneclient.middleware.auth_token] Token validation failure.
Traceback (most recent call last):
File "/home/compute/openstack/quantum/.venv/lib/python2.6/site-packages/keystoneclient/middleware/auth_token.py", line 552, in _validate_user_token
data = self.verify_uuid_token(user_token, retry)
File "/home/compute/openstack/quantum/.venv/lib/python2.6/site-packages/keystoneclient/middleware/auth_token.py", line 729, in verify_uuid_token
headers = {'X-A
1 [composite:quantum]
2 use = egg:Paste#urlmap
3 /: quantumversions
4 /v2.0: quantumapi_v2_0
5
6 [composite:quantumapi_v2_0]
7 use = call:quantum.auth:pipeline_factory
8 noauth = egg:repoze.tm2#tm extensions quantumapiapp_v2_0
9 keystone = authtoken keystonecontext egg:repoze.tm2#tm extensions quantumapiapp_v2_0
10
666 Downloading/unpacking oslo.config (from -r /home/compute/openstack/quantum/quark/tools/pip-requires (line 3))
667
668 Getting page http://c.pypi.python.org/oslo.config
669 Could not fetch URL http://c.pypi.python.org/oslo.config: HTTP Error 404: Not Found
670 Will skip URL http://c.pypi.python.org/oslo.config when looking for download links for oslo.config (from -r /home/compute/openstack/quantum/quark/tools/pip-requires (line 3))
671 URLs to search for versions for oslo.config (from -r /home/compute/openstack/quantum/quark/tools/pip-re
(quantum)localhost{~/openstack/.../quark}:\ (master)]tox -r
GLOB sdist-make: /home/compute/openstack/quantum/quark/setup.py
py26 create: /home/compute/openstack/quantum/quark/.tox/py26
py26 installdeps: -r/home/compute/openstack/quantum/quark/tools/pip-requires, -r/home/compute/openstack/quantum/quark/tools/test-requires
ERROR: invocation failed, logfile: /home/compute/openstack/quantum/quark/.tox/py26/log/py26-1.log
ERROR: actionid=py26