Skip to content

Instantly share code, notes, and snippets.

View calston's full-sized avatar

Colin Alston calston

View GitHub Profile
import cv2
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
def processStream(fname):
cap = cv2.VideoCapture(fname)
; -*- mode: clojure; -*-
; vim: filetype=clojure
(require 'capacitor.core)
(require 'capacitor.async)
(require 'clojure.core.async)
(require 'clj-http.client)
(require 'cheshire.core)
(defn ghost [token]
(let [uri (str "http://localhost:8000/api/event/" token)]
(where (not (expired? event))
(by [:host :service]
(fixed-time-window 10
(smap
(fn [events]
(let [p (/ (count (filter #(= "critical" (:state %)) events)) (count events))]
{ :service (format "%s window" (:service (first events)))
:metric p
:host (:host (first events))
:state (condp < p