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:5f3487a0376fd9c5b871
Created February 26, 2015 21:27
Basic neutron.profile for blogpost
export OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/
export OS_AUTH_STRATEGY=rackspace
export OS_REGION_NAME=DFW
export OS_USERNAME=<username>
export OS_TENANT_NAME=<tenant_id>
export OS_PROJECT_ID=<tenant_id>
export OS_PASSWORD=<api_key>
export OS_NO_CACHE=1
### Keybase proof
I hereby claim:
* I am roaet on github.
* I am roaet (https://keybase.io/roaet) on keybase.
* I have a public key whose fingerprint is 4539 036D 900E B816 3854 A93C B655 012E A200 2F6E
To claim this, I am signing this object:
@roaet
roaet / gist:4fbb1ac1fa2dee4f7349
Created May 8, 2014 20:21
Commands I used to make the network
git clone https://github.com/micha/resty
source resty/resty
resty http://preprod.ord.networks-internal.api.rackspacecloud.com:9696 -H 'Content-type: application/json'
POST /v2.0/networks -d '{"network": {"name": "jlh_test_shared", "tenant_id" : "5832759", "network_plugin": "UNMANAGED", "id": "33333333-3333-3333-3333-333333333333"}}'
POST /v2.0/subnets -d '{"subnet": {"network_id":"33333333-3333-3333-3333-333333333333", "cidr": "10.0.0.0/24","tenant_id": "5832759","ip_version": 4, "segment_id": "blah", "allocation_pools": [{"start": "10.0.0.4", "end": "10.0.0.254"}]}}'
POST /v2.0/subnets -d '{"subnet": {"network_id":"33333333-3333-3333-3333-333333333333", "cidr": "10.0.1.0/24","tenant_id": "5832759","ip_version": 4, "segment_id": "blah", "allocation_pools": [{"start": "10.0.1.4", "end": "10.0.1.254"}]}}'
POST /v2.0/subnets -d '{"subnet": {"network_id":"33333333-3333-3333-3333-333333333333", "cidr": "10.0.2.0/24","tenant_id": "5832759","ip_version": 4, "segment_id": "blah", "allocation_pools": [{"start": "10.0.
2014-04-04 23:14:19.416 21849 TRACE quark.ipam result = conn.execute(querycontext.statement, self._params) [0/1831]
2014-04-04 23:14:19.416 21849 TRACE quark.ipam File "/opt/rackstack/615.22/neutron/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 14
49, in execute
2014-04-04 23:14:19.416 21849 TRACE quark.ipam params)
2014-04-04 23:14:19.416 21849 TRACE quark.ipam File "/opt/rackstack/615.22/neutron/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 15
84, in _execute_clauseelement
2014-04-04 23:14:19.416 21849 TRACE quark.ipam compiled_sql, distilled_params
2014-04-04 23:14:19.416 21849 TRACE quark.ipam File "/opt/rackstack/615.22/neutron/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 16
98, in _execute_context
2014-04-04 23:14:19.416 21849 TRACE quark.ipam context)
@roaet
roaet / howto.md
Last active August 29, 2015 13:56
My Way of Setting up Devstack with Neutron

You need some machine (vm or instance) that has at least 4GB of RAM. 8GB is much better. I will assume you just booted a machine and have root, and nothing else.

##Installing Devstack

  • I prefer to make an account (my own) and run devstack as that account (some say to make a stack account, it's the same thing)
  • useradd herpderp && useradd herpderp sudo && apt-get update && apt-get install git && exit
  • Log back into the machine as your user; herpderp in this case
  • git clone https://github.com/openstack-dev/devstack.git
  • cd devstack
  • create a new file called localrc with the contents:
@roaet
roaet / Sound-ResourcesClass.md
Last active August 29, 2015 13:56
Resources for the sound class

#Sound Resources Class

##Quick Links (all free)

  • bfxr - an online or offline program to create random sounds
  • pixitracker - a simple program for computers, mobile, or tablet to create songs based on tracking
  • audacity - a tool to manipulate and edit sounds

##Tips

  • when using bfxr ensure that you set your system volume to 50%, or you will have a bad time
  • if you have an iPad then pixitracker is even better