Skip to content

Instantly share code, notes, and snippets.

View bradenmacdonald's full-sized avatar

Braden MacDonald bradenmacdonald

View GitHub Profile
@bradenmacdonald
bradenmacdonald / gist:1320318
Created October 27, 2011 18:05
Django-CMS Wymeditor cross-domain issue workaround
# Set up your site so that static files can be accessed from the static
# domain *or* from a subfolder of the main site (e.g. use a symlink)
# Then add a setting like the following to your site's settings.py,
# such that /static/ is the same as http://static.yourdomain.com
#############################################################################
WYM_CMS_STATIC_URL = '/static/cms/'
#############################################################################
# Replace the last line of cms/plugins/text/settings.py with the following:
@bradenmacdonald
bradenmacdonald / gist:1592916
Created January 11, 2012 03:50
astrodendro-viewer Macro for plot sorting tests
import numpy as np
plot_sort_name = "npix"
cube_view.z = 212
set_color_map("bone")
highlighters = [create_highlighter(c) for c in ["purple", "green", "orange", "brown"]]
@bradenmacdonald
bradenmacdonald / gist:1726769
Created February 3, 2012 00:39
Creating a bunch of plots in a PDF file using astrodendro
#!/usr/bin/env python
# coding: utf8
import numpy as np
import sys
import subprocess
import matplotlib as mpl
from matplotlib.backends.backend_pdf import PdfPages
from astrodendro import Dendrogram
from astrocube import DataCube
@bradenmacdonald
bradenmacdonald / gist:1726771
Created February 3, 2012 00:40
Create synthetic data cube for testing astrodendro
#!/usr/bin/env python
import numpy as np
import pyfits
import math
import random
random.seed(5678) # consistent random seed
ri = random.randint
def export_data(data, desc, filename):
@bradenmacdonald
bradenmacdonald / gist:2562364
Created April 30, 2012 20:19
Get infinite-scroll to send X-PJAX header.
$.infinitescroll.prototype.retrieve = function (pageNum) {
var instance = this,
opts = instance.options,
path = opts.path,
box, frag, desturl, method, condition,
pageNum = pageNum || null,
getPage = (!!pageNum) ? pageNum : opts.state.currPage;
beginAjax = function infscr_ajax(opts) {
// increment the URL bit. e.g. /page/3/
opts.state.currPage++;
@bradenmacdonald
bradenmacdonald / __init__.py
Created May 9, 2012 03:50
Make Marmalade work with C++11 :-)
import Emitter
Emitter.Emitter.add_gcc_ccflags_orig = Emitter.Emitter.add_gcc_ccflags
def my_add_gcc_ccflags(obj, flag):
obj.add_gcc_ccflags_orig(flag)
obj.add_gcc_ccflags = obj.add_gcc_ccflags_orig
obj.add_gcc_ccflags("--cppflag=-std=c++0x")
Emitter.Emitter.add_gcc_ccflags = my_add_gcc_ccflags
@bradenmacdonald
bradenmacdonald / temp_defines_debug.h
Created December 5, 2012 01:49
Marmalade Preprocessor definitions
#ifndef I3D_OS_S3E
# define I3D_OS_S3E 1
#endif
#ifndef I3D_PLATFORM_S3E
# define I3D_PLATFORM_S3E 1
#endif
#ifndef IW_APP_NAME
# define IW_APP_NAME "angelscript"
#endif
#ifndef IW_APP_VERSION
@bradenmacdonald
bradenmacdonald / gist:7796629
Last active December 30, 2015 07:29
Examples of extending CppSqlWrapper
#include "CppSqlWrapper.h"
#define INFO_TABLE "CoreInfo"
#ifndef SQL_BLOCK
#define SQL_BLOCK(a) #a
#endif
class Database : public SqlDatabase {
public:
Database();
virtual ~Database() {}

As of: 2015-08-19

This is how to set up a combined devstack/insights virtualbox.

Run these commands on your host computer, in a new "combined-devstack" folder:

mkdir combined-devstack
cd combined-devstack
curl -L https://raw.githubusercontent.com/edx/configuration/master/vagrant/release/analyticstack/Vagrantfile > Vagrantfile
from contextlib import contextmanager
from datetime import datetime
import time
def test_pass():
print('.')
time.sleep(0.5)
return True