Skip to content

Instantly share code, notes, and snippets.

View maxthoursie's full-sized avatar

Max Thoursie maxthoursie

View GitHub Profile
@maxthoursie
maxthoursie / exception.json
Created April 1, 2019 12:54
Exception when there's more than 10 params
{
"Msg": "IonLambdaException",
"Ex": {
"Cause": "Too many results",
"Via": [
{
"Type": "clojure.lang.ExceptionInfo",
"Message": "Too many results",
"Data": {
"CognitectAnomaliesCategory": "CognitectAnomaliesFault",
@maxthoursie
maxthoursie / save-events.js
Created March 20, 2018 10:37
Script wayv business to page through the calendar view and save all events displayed as csv
function format_value(value) {
if (value instanceof Date) {
// Convert to google sheets compatible date string
return value.toISOString().substring(0, 16).replace("T", " ").replace(":", ".")
}
return value;
}
function to_csv(columns, rows) {
const sep = ";";
{
"authors":[
{
"title":"Alf Bjarne Johnsen",
"contacts":[ ],
"id":"b63996c4-74c4-419e-850d-706599bb9d55"
},
{
"title":"Bjørn Haugan",
"contacts":[ ],
@maxthoursie
maxthoursie / gist:66530eaad63b05dd9f76
Created August 22, 2014 19:23
Ex10 with :start-stop event
(defn ex10 [animals]
(let [start-stop-button (by-id "ex10-button-start-stop")
prev-button (by-id "ex10-button-prev")
next-button (by-id "ex10-button-next")
start-stop (events->chan start-stop-button EventType.CLICK
(chan 1 (map (constantly :start-stop))))
prev (events->chan prev-button EventType.CLICK
(chan 1 (map (constantly :previous))))
next (events->chan next-button EventType.CLICK
(chan 1 (map (constantly :next))))
(defn trigger-above-cancel-below
"Set state to \"critical\" when metric is > above for trigger_window seconds.
Reset to \"ok\" when metric is < below for cancel-window seconds."
[above trigger-window below cancel-window & children]
(let [changed-stream (changed-state {:init "ok"}
#(call-rescue % children))
;; Forward critical or ok if they are stable
stable-stream (sdo
(stable trigger-window :state