Skip to content

Instantly share code, notes, and snippets.

View stuartf's full-sized avatar

D. Stuart Freeman stuartf

  • Georgia Institute of Technology
  • Atlanta, GA, USA
View GitHub Profile
{
"status":[
{
"timestamp":"1393343949428",
"courseId":"6612",
"assignmentId":"2",
"revision":"rev:t:eklHzQVMot",
"d2lFeedback":{
"Files":[],
"Score":null,
@stuartf
stuartf / skinport.js
Created February 11, 2015 21:19
Export/Import OAE Skin
var _ = require('underscore');
// get the existing skin from /api/ui/skin/variables and change the wrapping object to module.exports
// this could be done cleaner in code but isn't worth the time right now
var skin = require('./saved.skin.json').results;
var ported = {};
_.each(_.flatten(_.pluck(_.flatten(_.pluck(skin, 'subsections')), 'variables')), function(obj) {
if (obj.value !== undefined) {
ported['oae-ui/skin/variables/' + obj.name] = obj.value;
@stuartf
stuartf / gist:1154485
Created August 18, 2011 16:39
runtime widget config
def enableInPortal(path, server)
json = ""
c = Curl::Easy.new("#{server}/#{path}")
if c.http_get
json = JSON.parse(c.body_str)
json["personalportal"] = true
postJsonAsFile(path, json.to_s(), server)
end
end
@stuartf
stuartf / gist:1162447
Created August 22, 2011 14:03
Add a bean
cXML = ""
components = 'sakai2-demo/components/sakai-provider-pack/WEB-INF/components.xml'
File.open(components) do |f|
cXML = REXML::Document.new(f)
beans = REXML::XPath.first(cXML, '//beans')
bean = beans.add_element("bean", {
"id" => "org.sakaiproject.user.api.UserDirectoryProvider",
"class" => "org.sakaiproject.provider.user.NakamuraUserDirectoryProvider",
"init-method" => "init"
})
@stuartf
stuartf / prepare-commit-msg
Created July 18, 2012 20:10
Branch name in commit msg
BRANCHNAME=$(basename $(git rev-parse --symbolic-full-name HEAD))
if grep -qi '^SAKIII' << EOF
$BRANCHNAME
EOF
then
sed -i "1i\
$BRANCHNAME" $1
fi
@stuartf
stuartf / pommel.rb
Created August 23, 2012 20:37
Update versions in poms
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'getopt/long'
@opt = Getopt::Long.getopts(
["--file", "-f", Getopt::REQUIRED],
["--artifact", "-a", Getopt::OPTIONAL],
["--expected", "-e", Getopt::OPTIONAL],
@stuartf
stuartf / render.rb
Last active December 14, 2015 14:48
Render 3akai-ux nginx.conf using ruby
#!/usr/bin/env ruby
require 'erb'
require 'ostruct'
require 'json'
namespace = OpenStruct.new
namespace.nginxConf = OpenStruct.new(JSON.parse(IO.read('nginx.json')))
template = IO.read('nginx.conf')
puts ERB.new(template).result(namespace.instance_eval { binding })
@stuartf
stuartf / test.js
Last active December 15, 2015 11:58
Get started with kcl for node.js
var kc = require('./node/KalturaClient');
var ktypes = require('./node/KalturaTypes');
var partnerId = 1111111;
var adminSecret = 'secret';
var conf = new kc.KalturaConfiguration(partnerId);
var client = new kc.KalturaClient(conf);
client.session.start(function(session){
client.setKs(session);
@stuartf
stuartf / wipe-oae.sh
Last active December 15, 2015 17:09
Wipe all OAE data BE CAREFUL
#!/bin/sh
# Delete all cassandra data
cassandra-cli << EOF
drop keyspace oae;
EOF
# Delete all redis data
redis-cli << EOF
flushall
@stuartf
stuartf / prompt.sh
Last active December 20, 2015 03:29
Awesome bash prompt
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
hostnam=$(hostname)
usernam=$(whoami)
temp="$(tty)"