Skip to content

Instantly share code, notes, and snippets.

View stevie-chambers's full-sized avatar

Steve Chambers stevie-chambers

View GitHub Profile
@stevie-chambers
stevie-chambers / nx1k.rb
Created October 30, 2011 21:00
Basic Ruby interface to the Nexus 1000V
class NX1K
require 'net/ssh'
attr_writer :host, :user, :pwd
def send(xml)
session = Net::SSH.start(@host, @user, :password => @pwd, :timeout => 10, :verbose => :debug) do |session|
channel = session.open_channel do |channel|
channel.subsystem("xmlagent") do |xmlagent, success|
xmlagent.on_data do |xmlagent, data|
@stevie-chambers
stevie-chambers / SinatraAPI.rb
Created July 9, 2012 19:55
SinatraAPI all-in-one script for testy-learny REST APIs
#!/usr/bin/env ruby
# [email protected] July 2012
#
# I'm playing around with APIs, and sharing my learnings
# You can follow my trials and tribulations at http://viewyonder.com/apis
#
# This is a simple Ruby script to show how a simple API might work.
# The resource model is just a simple array of a single class - no back-end store (yet)
#
# The only goal for this version of the script is to all a human using a browser to GET resources
@stevie-chambers
stevie-chambers / SinatraAPI.rb
Created July 10, 2012 00:09
Real basic REST API server in one script
#!/usr/bin/env ruby
#
# [email protected] July 2012
#
# I'm playing around with APIs, and sharing my learnings
# You can follow my trials and tribulations at http://viewyonder.com/apis
#
# This is a simple Ruby script to show how a simple API might work.
# The resource model is just a simple array of a single class - no back-end store (yet)
#