Skip to content

Instantly share code, notes, and snippets.

from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world.")
@rbrady
rbrady / gist:7911753
Last active December 31, 2015 01:09
Cannot allocate memory error while trying to use any openstack services requiring authentication
ERROR: An unexpected error prevented the server from fulfilling your request. [Errno 12] Cannot allocate memory (HTTP 500)
This problem can occur when running openstack in a memory constrained environment.
Mysql has a feature where it reserves a certain amount of ram based on the size of
the databases it contains.
The logs showed the following:
Dec 11 13:50:57 localhost.localdomain keystone-all[1777]: (keystone.common.wsgi): 2013-12-11 13:50:57,766 ERROR [Errno 12] Cannot allocate memory
Dec 11 13:50:57 localhost.localdomain keystone-all[1777]: Traceback (most recent call last):
Dec 11 13:50:57 localhost.localdomain keystone-all[1777]: File "/opt/stack/venvs/keystone/lib/python2.7/site-packages/keystone/common/wsgi.py", line 235, in __call__
@rbrady
rbrady / nova-log
Created December 16, 2013 19:58
a log file
[stack@localhost ~]$ cat nova.log
Dec 16 16:42:59 localhost nova-api[32737]: 2013-12-16 16:42:59,196.196 32748 DEBUG nova.api.openstack.wsgi [req-0ca85637-afa8-4dba-9515-00a68df13082 b7ba3cf575c148e09ec7c3a56f7de071 d356acee69364d6391c0f88c0f605a5c] No Content-Type provided in request get_body /opt/stack/venvs/nova/lib/python2.7/site-packages/nova/api/openstack/wsgi.py:849
Dec 16 16:42:59 localhost nova-api[32737]: 2013-12-16 16:42:59,197.197 32748 DEBUG nova.api.openstack.wsgi [req-0ca85637-afa8-4dba-9515-00a68df13082 b7ba3cf575c148e09ec7c3a56f7de071 d356acee69364d6391c0f88c0f605a5c] Calling method <bound method KeypairController.index of <nova.api.openstack.compute.contrib.keypairs.KeypairController object at 0x4336310>> _process_stack /opt/stack/venvs/nova/lib/python2.7/site-packages/nova/api/openstack/wsgi.py:976
Dec 16 16:42:59 localhost nova-api[32737]: 2013-12-16 16:42:59,207.207 32748 DEBUG nova.api.openstack.wsgi [req-4358e5e7-4ccc-48b4-8982-ddacd586aab6 b7ba3cf575c148e09ec7c3a56f7de071 d356acee6936
@rbrady
rbrady / gist:2de3dcae7cd66e31bdd9
Created June 11, 2015 22:55
sample program for josiah
http://ur1.ca/mst49
#!/usr/bin/env python
class Foo(object):
def __init__(self, name):
self.name = name
def get_name(self):
return self.name
# suggested changes & improvements
- ensure all python code is pep8 compliant (pyflakes, flake8)
- ensure all bash code meets common bash standards (bashate)
- refactor brewpi-script into a proper python package
- move all executable scripts into a /bin directory to be installed to /usr/bin (or /usr/local/bin)
- reorganize remaining python modules into appropriate namespaces
- provide user expierence of "pip install brewpi-script" (or maybe brewpi-utils name would be more accurate)
- this will provide easier path to getting python-brewpi-utils packages into the distro repos
- refactor repo to be more platform/distro agnostic
- remove dependency checks in the code e.g. (try: import foo except ImportError: print("apt-get install...")
// This #include statement was automatically added by the Particle IDE.
#include "MQTT/MQTT.h"
void callback(char* topic, byte* payload, unsigned int length);
/**
* if want to use IP address,
* byte server[] = { XXX,XXX,XXX,XXX };
* MQTT client(server, 1883, callback);
# Option #1, Separate classes w/ workflow class to orchestrate
PlanManager
create_plan(plan_name, templates)
get_plan(plan_name)
update_plan(plan_name, templates)
delete_plan(plan_name)
DeploymentOptionsManager
get_deployment_template_resource_types(plan_name)
// Josiah's sample cpp program with classes
// 3 files
// - main.cpp: this is the main program executed at the command line
// - hello_world.h: the header file for your class
// - hello_world.cpp: the implementation file for you class
// main.cpp
#include "hello_world.h"
int main ()
@rbrady
rbrady / dan.py
Last active November 4, 2015 15:48
import argparse
import csv
import os
import sys
def parse_opts(argv):
parser = argparse.ArgumentParser(
description='Transform a csv file to desired formatting for '
'dumb proprietary software that does not use a well'