Skip to content

Instantly share code, notes, and snippets.

@simong
simong / tree.py
Created February 28, 2012 22:40
U Suck at coding 2012-02-28
#!/usr/bin/python
class Node(object):
left = None
right = None
value = None
def __init__(self, val):
self.value = val

What I have: oae-authentication/lib/api.js: ... _$jscoverage['api.js'][138] = 0; _$jscoverage['api.js'][139] = 0; _$jscoverage['api.js'][140] = 0; ...

oae-permissions/lib/api.js:

@simong
simong / helenustest.js
Created September 22, 2012 12:34
Helenus test
var helenus = require('helenus'),
pool = new helenus.ConnectionPool({
hosts : ['localhost:9160'],
keyspace : 'oae',
user : '',
password : '',
timeout : 3000
});
pool.on('error', function(err){
@simong
simong / gist:3859486
Created October 9, 2012 15:22
Dataload/benchmark todo list

OAE Loader

A list of tasks that need to happen to ensure we get consistent results out of each dataload that can be easily compared to each other.

Clean the system

We should try to bring the system into the same state for each dataload/benchmark. The simplest way is to just wipe everything and start fresh.

@simong
simong / revisions.md
Created October 30, 2012 13:52
Revision history

The content module for Sakai OAE

Cassandra model

Column families

1. Content

Holds the actual metadata for a piece of content

2. LibraryByPrincipal

Three rows per principal that each holds IDs of the content items that are visible in this library.

@simong
simong / gist:4196111
Created December 3, 2012 16:30
Hilary scripts
#createTenant.sh
#!/bin/bash
if [ "$1" = "--usage" ] ; then
echo "All parameters are optional. The default options will "
echo "create a cambridge tenant as in the example."
echo "--------------------------------------------------------"
echo "./createTenant.sh <alias:cam> <tenant name:Cambridge> <hostname:cam.oae.com>"
echo "--------------------------------------------------------"
echo "Example:"
# Startup
All the storage backends register themselves.
ContentAPI.Backends.register('local', require('backends/local'))
ContentAPI.Backends.register('amazons3', require('backends/amazons3'))
...
# An upload request
1. User uploads to /api/content/create
2. Gets routed to ContentAPI.createFile
@simong
simong / gist:5256675
Last active December 15, 2015 11:59

Preview Processor Registration Pattern

In order to make the Preview Processing a bit more maintainable, future proof and allow for easy 3rd party integration we need some sort of pluggable system that allows us to register new processors.

Each processor should register itself with the PP api so that it can be picked up and handed content items. Whenever a content item needs preview processing, all registered processors will be checked if they can handle the file. They should each return a number of how well suited they are to deal with the piece of content. The processor that returns the highest number will be chosen to generate the preview images.

@simong
simong / gist:5583367
Last active December 17, 2015 08:58
Password reset in OAE

Reset password pointers

General workflow

  1. The user 'Alice' forgets the password of her local account
  2. She clicks the 'Forgot my password'-link which takes her to /resetpassword
  3. A page with a form is displayed where she can enter the username she uses to login with (we currently do not have the functionality to look up a user by email)
  4. She fills in her username and submits the form
  5. The backend sends an e-mail to the e-mail address that is stored with the 'Alice' account
"filter": {
"and": [
{
"and": [
{
"term": {
"_type": "resource"
}
},
{