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
(defn moving-trigger-fraction-trigger | |
[time-window trigger-predicate cancel-predicate & children] | |
(let [state-ok (atom true) | |
s (fn [event] | |
(reset! state-ok (= "ok" (:state event))) | |
(call-rescue event children))] | |
(moving-time-window time-window | |
(fn [events] | |
(prn events) | |
((split |
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
(where* trigger-predicate | |
(with :state "critical" s) | |
(else (where* (fn [events] (and (not @state-ok) #(cancel-predicate events))) | |
(with :state "critical" s) | |
(else (with :state "ok" s))))))) |
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 --git a/src/spotify/rules/cia.clj b/src/spotify/rules/cia.clj | |
index 896c1b2..529a5c1 100644 | |
--- a/src/spotify/rules/cia.clj | |
+++ b/src/spotify/rules/cia.clj | |
@@ -76,20 +76,14 @@ | |
((split | |
(trigger-predicate events) | |
(smap peek #(prn "crit: " %) (with :state "critical" s)) | |
(and (not @state-ok) (cancel-predicate events)) | |
(smap peek #(prn "trig: " %) (with :state "critical" s)) |
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
(defn ratio-calc | |
[events] | |
(let [ratio | |
(/ (count (filter #(= "critical" (:state %)) events)) | |
(count events))] | |
(assoc (last events) :metric ratio))) |
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
$archive = $fqdn ? { | |
$master => false, | |
default => true, | |
} |
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
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www.infosupport.com/Modules/Geneesmiddelen" xmlns:types="http://www.infosupport.com/Modules/Geneesmiddelen" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><types:GetMedicinesByCriteriumResponse><GetMedicinesByCriteriumResult href="#id1" /></types:GetMedicinesByCriteriumResponse><soapenc:Array id="id1" soapenc:arrayType="types:GeneesmiddelSlimItem[31]"><Item href="#id2" /><Item href="#id3" /><Item href="#id4" /><Item href="#id5" /><Item href="#id6" /><Item href="#id7" /><Item href="#id8" /><Item href="#id9" /><Item href="#id10" /><Item href="#id11" /><Item href="#id12" /><Item href="#id13" /><Item href="#id14" /><Item href="#id15" /><Item href="#id16" /><Item href="#id17" /><Item href="#id18" /><Item href= |
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
<?xml version="1.0" encoding="utf-8"?> | |
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding" xmlns:tns="http://www.infosupport.com/Modules/Geneesmiddelen" xmlns:types="http://www.infosupport.com/Modules/Geneesmiddelen" xmlns:rpc="http://www.w3.org/2003/05/soap-rpc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | |
<soap:Body> | |
<types:GetMedicinesByCriteriumResponse> | |
<rpc:result xmlns="">GetMedicinesByCriteriumResult</rpc:result> | |
<GetMedicinesByCriteriumResult soapenc:id="id1" soapenc:itemType="types:GeneesmiddelSlimItem" soapenc:arraySize="31"> | |
<Item soapenc:id="id2"> | |
<GeneesmiddelId xsi:type="xsd:int">658</GeneesmiddelId> | |
<WerkzameStof xsi:type="xsd:string">Acebutolol</WerkzameStof> | |
</Item> |
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
retrievedXML= retrievedXML.replaceAll("xsi:type=\"xsd:string\">", "xsi:type=\"xsd:string\"><![CDATA["); | |
retrievedXML= retrievedXML.replaceAll("xsi:type=\"xsd:string\">", "]]></WerkzameStof>"); | |
retrievedXML= retrievedXML.replaceAll("xsi:type=\"xsd:string\">", "]]></Herzieningsdatum>"); | |
retrievedXML= retrievedXML.replaceAll("xsi:type=\"xsd:string\">", "]]></Markt>"); | |
retrievedXML= retrievedXML.replaceAll("xsi:type=\"xsd:string\">", "]]></Intro>"); | |
retrievedXML= retrievedXML.replaceAll("xsi:type=\"xsd:string\">", "]]></Bijwerking>"); | |
retrievedXML= retrievedXML.replaceAll("xsi:type=\"xsd:string\">", "]]></Wisselwerking>"); | |
retrievedXML= retrievedXML.replaceAll("xsi:type=\"xsd:string\">", "]]></Verboden>"); | |
retrievedXML= retrievedXML.replaceAll("xsi:type=\"xsd:string\">", "]]></Zwangerschap>"); | |
retrievedXML= retrievedXML.replaceAll("xsi:type=\"xsd:string\">", "]]></Gebruik>"); |
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 'terminal-table/import' | |
class SubsetSumMatrix | |
class << self | |
def create_empty_for(array) | |
matrix = [] | |
header = [nil] + build_header_from(array) | |
matrix << header | |
array.each_with_index do |element,i| | |
row = header.collect{|value| 'F'} |
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 'Tire' | |
search = Tire.search('videos') | |
search.filter :term, "status" => "REMOVED" | |
# search.size 100 | |
p search.results.map.all? {|v| v.status == "REMOVED" } | |
search.results.map.each { |v| puts v.status } | |
puts search.to_curl |
OlderNewer