This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require("crypto"), | |
assert = require("assert"); | |
var hexstr2bytearray = function(str) { | |
var bytestrs = []; | |
for(var i=0;i<str.length;i+=2) { | |
bytestrs.push(parseInt(str.substr(i,2), 16)); | |
} | |
return bytestrs; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def colour_shade(colour,shade,scale=10) | |
# default the scale to 100 if it is greater... | |
scale = 100 if scale > 100 | |
# if the shade is out of the range of scale then reset shade to scale... | |
if shade > 0 | |
shade = scale if shade > scale | |
else | |
shade = scale * -1 if shade < scale * -1 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "snmp" | |
mac = ARGV.shift.dup | |
unless mac.gsub! /^(..)[-: ]?(..)[-: ]?(..)[-: ]?(..)[-: ]?(..)[-: ]?(..)[-: ]?$/, '\1 \2 \3 \4 \5 \6' | |
puts "illegal mac" | |
exit | |
end | |
mac = mac.split(" ").collect { |x| x.hex }.join "." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Then /^I should be editing "([^\"]*)"$/ do |login| | |
URI.parse(current_url).path.should == edit_user_path(User.find_by_login(login)) | |
end | |
Then /^I should be viewing "([^\"]*)"$/ do |login| | |
URI.parse(current_url).path.should == user_path(User.find_by_login(login)) | |
end |