Skip to content

Instantly share code, notes, and snippets.

View saliceti's full-sized avatar
🐌

Colin Saliceti saliceti

🐌
  • Department for Education
View GitHub Profile
require "net/http"
require "uri"
require "json"
def print_router_routes(name, ip)
uri = URI.parse("http://#{ip}:8080/routes")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
request.basic_auth("router_user", "router_password")
@saliceti
saliceti / val_from_yaml.rb
Last active October 1, 2015 15:50
Extract a value from a YAML file
#!/usr/bin/env ruby
require 'yaml'
filename = ARGV[0]
path = ARGV[1]
def get(hash, path_array)
unless path_array.empty?
get(hash[path_array[0]], path_array[1..-1])