This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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. |
This file contains hidden or 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 hidden or 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 "google/cloud/storage" | |
gcloud = Google::Cloud.new "Your Project", "Path To Your Key" | |
storage = gcloud.storage | |
bucket = storage.create_bucket "my_goat_pictures" | |
bucket.create_file "goat.jpg", "uploaded_goat.jpg" |
This file contains hidden or 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
Apache License | |
Version 2.0, January 2004 | |
http://www.apache.org/licenses/ | |
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | |
1. Definitions. | |
"License" shall mean the terms and conditions for use, reproduction, |
This file contains hidden or 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 "google/cloud/monitoring/v3/metric_service_client" | |
client = Google::Cloud::Monitoring::V3::MetricServiceClient.new | |
project = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path(PROJECT_ID) | |
metric = "appengine.googleapis.com/system/memory/usage" | |
end_time = Time.now.to_i | |
start_time = end_time - (60 * 10) # 10 minutes |
This file contains hidden or 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
interval = Google::Monitoring::V3::TimeInterval.new | |
interval.start_time = Google::Protobuf::Timestamp.new(seconds: start_time) | |
interval.end_time = Google::Protobuf::Timestamp.new(seconds: end_time) |
This file contains hidden or 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 "google/cloud/monitoring/v3/metric_service_client" | |
client = Google::Cloud::Monitoring::V3::MetricServiceClient.new | |
project = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path(PROJECT_ID) |
OlderNewer