Skip to content

Instantly share code, notes, and snippets.

View bradenmacdonald's full-sized avatar

Braden MacDonald bradenmacdonald

View GitHub Profile
@bradenmacdonald
bradenmacdonald / gist:148240764a1aede24ba50fae24119c7b
Created May 10, 2016 04:16
Backup instance_singlevmopenedxinstance
CREATE TABLE instance_singlevmopenedxinstance_backup (
id integer NOT NULL,
created timestamp with time zone NOT NULL,
modified timestamp with time zone NOT NULL,
sub_domain character varying(50) NOT NULL,
email character varying(254) NOT NULL,
name character varying(250) NOT NULL,
base_domain character varying(50) NOT NULL,
protocol character varying(5) NOT NULL,
branch_name character varying(50) NOT NULL,

Keybase proof

I hereby claim:

  • I am bradenmacdonald on github.
  • I am bradenm (https://keybase.io/bradenm) on keybase.
  • I have a public key whose fingerprint is 0832 4B93 0227 C5FA 85D3 86AD 2BDF 383C 42AB AB95

To claim this, I am signing this object:

@bradenmacdonald
bradenmacdonald / update_anonymous_user_ids.py
Last active February 9, 2017 19:11
Open edX Platform PR #14102: A management command to update the anonymous IDs in the database
# When changing the `SECRET_KEY` of an instance, all anonymous user ids change as well.
# Since #13717 the new anonymous ids are stored in the database in addition to the old
# ones, so both the old and the new anonymous ids can be inverted.
#
# This has the negative side effect that e.g. ORA submissions and grades for the same
# student are now stored under two different ids, so they don't show up correctly
# anymore in the web interface. For Open edX installations that are not too big, the
# problem can be solved by running the management command in this PR, which translates
# all IDs in the database to the new values.
#
#include <iostream>
#include <string>
using std::string;
string name = "Alice";
void foo() {
std::cout << "Hello " << name << std::endl;
}
@bradenmacdonald
bradenmacdonald / Vagrantfile
Last active June 13, 2018 18:03
Vagrantfile Optimized for Solutions devstack
Vagrant.require_version ">= 1.8.7"
unless Vagrant.has_plugin?("vagrant-vbguest")
raise "Please install the vagrant-vbguest plugin by running `vagrant plugin install vagrant-vbguest`"
end
VAGRANTFILE_API_VERSION = "2"
MEMORY = 4096
CPU_COUNT = 2
swagger: '2.0'
info:
title: BugReportAPI
version: v1
basePath: /api/v1
consumes:
- application/json
produces:
- application/json
paths:
OPENAPI_CODEGEN_VERSION=4.0.0-beta2
OPENAPI_JAR=../.openapi-generator-cli-${OPENAPI_CODEGEN_VERSION}.jar
OPENAPI_DOWNLOAD_BASE_URL="http://central.maven.org/maven2/org/openapitools/openapi-generator-cli"
if [ ! -f $OPENAPI_JAR ]; then
curl ${OPENAPI_DOWNLOAD_BASE_URL}/${OPENAPI_CODEGEN_VERSION}/openapi-generator-cli-${OPENAPI_CODEGEN_VERSION}.jar \
> $OPENAPI_JAR
fi
java -jar $OPENAPI_JAR generate \
<!--
This file is meant to be hosted on a completely separate domain name
from the LMS / frontend that is hosting the Open edX content (XBlocks).
Doing so allows us to enable features like cookies in the sandboxed
IFrame while keeping the XBlock content on a distinct origin, so that
the XBlock cannot access user data from the host application (like
cookies nor call APIs as the user).
This particular sandboxing code uses the secure message passing API
/**
* Code to wrap an XBlock so that we can embed it in an IFrame
*/
declare const LMS_BASE_URL: string;
import * as xblockCssPath from './xblock-styles.scss';
/**
* Given an XBlock's fragment data (HTML plus CSS and JS URLs), return the
* inner HTML that should go into an IFrame in order to display that XBlock
import { bind } from 'bind-decorator';
import * as React from 'react';
import { XBlocksApi } from 'global/api';
import styles from 'global/styles';
import uiMessages from 'ui/components/displayMessages';
import { WrappedMessage } from 'utils';
import messages from '../../displayMessages';
import { wrapBlockHtmlForIFrame } from './wrap';