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 "net/http" | |
url = URI.parse("http://metadata.google.internal/computeMetadata/v1/project/attributes/") | |
req = Net::HTTP::Get.new(url.path) | |
req.add_field("Metadata-Flavor", "Google") | |
res = Net::HTTP.new(url.host, url.port).start do |http| | |
http.request(req) | |
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
diff -r old/lib/graph.rb new/lib/graph.rb | |
--- old/lib/graph.rb | |
+++ new/lib/graph.rb | |
@@ -371,6 +371,13 @@ | |
end | |
## | |
+ # Deletes a node from the graph | |
+ def delete_node node_name | |
+ nodes.delete(node_name) |
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
class Strafe < RTanque::Bot::Brain | |
NAME = 'Strafe Master' | |
include RTanque::Bot::BrainHelper | |
TICKS_BETWEEN_SWEEPS = 500 | |
RUN_AWAY_TICKS = 1200 | |
def initialize(arena) | |
super | |
@run_away_dest = nil |
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
class Strafe < RTanque::Bot::Brain | |
NAME = 'Strafe Master' | |
include RTanque::Bot::BrainHelper | |
TICKS_BETWEEN_SWEEPS = 500 | |
RUN_AWAY_TICKS = 1200 | |
def initialize(arena) | |
super | |
@run_away_dest = nil |
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
fib(0,1). | |
fib(1,1). | |
fib(N,F):- | |
N > 1, | |
X is N - 2, | |
Y is N - 1, | |
fib(X,A), | |
fib(Y,B), | |
F is A + B. |
NewerOlder