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
> GET /api/rtm.start?token=snip HTTP/1.1 | |
> User-Agent: curl/7.35.0 | |
> Host: slack.com | |
> Accept: */* | |
> | |
< HTTP/1.1 200 OK | |
< Content-Type: application/json; charset=utf-8 | |
< Transfer-Encoding: chunked | |
< Connection: keep-alive | |
< Access-Control-Allow-Origin: * |
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
commit c251b8fb2c30d767f3eac253c645e2325c941473 | |
Author: Twan Wolthof <xeago@spotify.com> | |
Date: Thu May 19 09:05:20 2016 +0000 | |
wip | |
diff --git a/build.gradle b/build.gradle | |
index d718c40..2285d50 100644 | |
--- a/build.gradle | |
+++ b/build.gradle |
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
(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
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
(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
(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
terms = [] | |
terms += { term: { category_id: params[:category_id] } } if params[:category_id].present? | |
# etc | |
filter :and, terms if not terms.empty? |
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 Integer | |
def phi | |
fractions = self.prime_division | |
primes = fractions.map { |b,e| b } | |
rationals = primes.map {|p| Rational(p-1,p) } | |
return (rationals.reduce { |a,b| a*b } * self).to_i | |
end | |
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
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d ' | |
{ | |
"mappings" : { | |
"test" : { | |
"properties" : { | |
"field" : { | |
"index" : "not_analyzed", | |
"type" : "string" | |
} | |
} |
NewerOlder