1 (load "expand-string.lsp")
3 # Make a plot file with 0-24 vertically, days horizontally
9 TZTODAY (- (date-value (0 3 NOW)) (* TZ 60))
15 (letn ((n (div (- x TZTODAY) DAYSEC))
16 (d (if (< n) (- (int n) 1) (int n)))
17 (s (mul 24 (if (< n) (sub n d) (sub n d)))))
22 (and (regex "([0-9]+) ([0-9]+)" x 0)
23 (> (int $2 0 10) 1000)
24 (plotpoint (int $1 0 10))))
26 (define (usage-file dat)
29 (parse (read-file (format "activity/%s" dat)) "\n"))))
32 USAGE (sort (flat (map usage-file (directory "activity" "^[^.]")) 1) <)
37 (unless (assoc (u 0) MAP) (push (list (u 0)) MAP))
38 (push (u 1) (assoc (u 0) MAP) -1))
41 (let ((s (dup "." (* 24 4))))
42 (dolist (e x) (setf (s (int (mul e 4))) "X"))
45 (setf MAP (map (fn (x) (list (x 0) (mkmap (1 x)))) MAP))
47 (println "Status 200 OK\nContent-Type: text/html\n\n")
48 (println (expand-file "tmpl/history-page.html"))