Skip to content

Instantly share code, notes, and snippets.

View jackhong's full-sized avatar

Jack C Hong jackhong

  • NICTA
  • Sydney, Australia
View GitHub Profile
def test
puts 'Hello World'
second version
end
def blah
puts helfefe
sadfsdfdsfsdf
end
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace TestGS
{
class Program
@jackhong
jackhong / gist:2880287
Created June 6, 2012 06:39
Release notes ...

OMF 6 developer preview release email

OMF 6 developer preview is now available. Blah, blah.

To get start, please visit http://mytestbed.github.com/omf/

This developer preview release is to introduce the new system architectural design, protocol and API. At this stage, we are especially looking for the feedback on the new resource controller structure and the APIs for providing features and support for specific resources.

The code, protocol, and API will be continuously evolving and if you have any suggestion regarding the design or implementation, feel free to create a new issue on our official site, on our github project page, or simply drop an email on the mailing list.

@jackhong
jackhong / gist:3234708
Created August 2, 2012 07:08
Overwrite create
module OmfRc::ResourceProxy::Garage
include OmfRc::ResourceProxyDSL
register_proxy :garage
def create(type, opts = nil)
# I can check the type here
if type.to_sym == :engine
logger.info "I can do it"
else
@jackhong
jackhong / gist:3719731
Created September 14, 2012 04:09
Sample exp script
@node = @comm.get_topic(`hostname`.chomp)
@node.on_message lambda {|m| m.operation == :inform && m.read_content('inform_type') == 'FAILED' } do |message|
logger.error message
end
device_request = @comm.request_message([:devices])
device_request.on_inform_status do |message|
@devices = message.read_property('devices').items
@jackhong
jackhong / test01.rb
Created October 8, 2012 00:55
DSL in OMF 6
# Original test01.rb
defProperty('res1', "unconfigured-node-1", "ID of a node")
defProperty('res2', "unconfigured-node-2", "ID of a node")
defGroup('Actor', property.res1)
onEvent(:ALL_UP) do |event|
wait 3
info "TEST - allGroups"
@jackhong
jackhong / dsl_sexp.rb
Created October 10, 2012 03:09
Sexp of DSL
# Given the asynchronous nature of all operations,
# a simple property assignment is actually a chain of callbacks behind the scene.
# Take this not too simple example
g.applications[:name => 'app_foo'].target_ip = g[:name => 'node1'].interfaces[:name => 'wlan0'].ip
# If we think about xmpp communication, the work flow would be sth like this. (simplified pseudo code)
g[:name => 'node1'].request_interfaces[:name => 'wlan0'] do |i|
@jackhong
jackhong / magic_rc_ple.rb
Created November 9, 2012 01:24
RC integration with Planetlab, some notes
# Original ruby script
#
require "xmlrpc/client"
require "pp"
XMLRPC::Config.module_eval do
remove_const :ENABLE_NIL_PARSER
const_set :ENABLE_NIL_PARSER, true
end
@jackhong
jackhong / try_rete.rb
Created November 12, 2012 02:40
Try omf rete
require 'pp'
require 'omf_rete/store'
N = 100
s = OMF::Rete::Store.create 3
(1..N).each do |i|
s.addTuple(["node_#{i}", 'status', 'ok'])
end