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
VERTICIES = ["S","A", "B", "C", "D", "E"] | |
complete = false | |
MEMO = { | |
S: 0, | |
A: Float::INFINITY, | |
B: Float::INFINITY, | |
C: Float::INFINITY, | |
D: Float::INFINITY, | |
E: Float::INFINITY |
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 sieve(n, p = 2, prime_list = [2], list_of_n = nil) | |
list_of_n ||= (2..n).to_a | |
list_of_n -= list_of_n.select {|i| i % p == 0 } | |
min = list_of_n.min | |
if min && (min > p) && (list_of_n.count > 1) | |
p = min | |
list_of_n.shift | |
prime_list.push(p) |
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
{"masterDetails"=>{"indexSize"=>"242.2 MB", "indexPath"=>"/data/www/apps/platform-solr/solr/data/providers/index/, "isMaster"=>"true", "isSlave"=>"false", "indexVersion"=>1526657964636, "generation"=>108, "master"=>{"confFiles"=>"schema.xml,stopwords_en.txt,synonyms_en.txt,autocommit.xml,types.xml", "replicateAfter"=>["commit", "startup"], "replicationEnabled"=>"true", "replicableVersion"=>1526657964636, "replicableGeneration"=>108}}, "masterUrl"=>"", "pollInterval"=>"00:00:60", "nextExecutionAt"=>"Fri May 18 12:01:38 EDT 2018", "indexReplicatedAt"=>"Fri May 18 11:39:51 EDT 2018", "indexReplicatedAtList"=>["Fri May 18 11:39:51 EDT 2018", "Fri May 18 10:56:54 EDT 2018"], "timesIndexReplicated"=>"2", "lastCycleBytesDownloaded"=>"253961271", "previousCycleTimeInSeconds"=>"13", "currentDate"=>"Fri May 18 12:01:27 EDT 2018", "isPollingDisabled"=>"false", "isReplicating"=>"false"} |
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
HTTParty.get("https://<endpt>/solr/#/providers/replication?command=details").parsed_response | |
=> "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n<html>\n\n<!--\nLicensed to the Apache Software Foundation (ASF) under one or more\ncontributor license agreements. See the NOTICE file distributed with\nthis work for additional information regarding copyright ownership.\nThe ASF licenses this file to You under the Apache License, Version 2.0\n(the \"License\"); you may not use this file except in compliance with\nthe License. You may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n\n<head>\n \n <title>Solr Admin</ti |
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
#avg highest and lowest. take the highest and lowest out of array. | |
require 'pry-debugger' | |
require 'benchmark' | |
def special_avg(array) | |
array.sort! | |
array = remove_outliers(array) | |
val = array.reduce(:+) / (array.length) | |
return val | |
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
# jotted this quick | |
def consecutive(array) | |
index_collection = [] | |
array.each_with_index do |integer, index| | |
if consecutive_forwards(array, integer, index) || consecutive_backwards(array, integer, index) | |
index_collection.push(index) | |
end | |
end | |
index_collection |