Skip to content

Instantly share code, notes, and snippets.

View calston's full-sized avatar

Colin Alston calston

View GitHub Profile
@calston
calston / webserver.sh
Created May 5, 2026 10:34
A bash webserver
#!/bin/bash
# Simple bash web server that serves files from ./static
PORT=${1:-8080}
STATIC_DIR="./static"
PIPE="/tmp/bashserver_$$"
NC_PID=""
# Cleanup on exit
cleanup() {
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