Merge branch 'master' of https://github.com/nathanielksmith/tildetown
commit
9d7a5ec6fb
|
@ -2,6 +2,8 @@
|
||||||
(import [os.path [getmtime]])
|
(import [os.path [getmtime]])
|
||||||
(import [datetime [datetime]])
|
(import [datetime [datetime]])
|
||||||
|
|
||||||
|
(import [sh [find]])
|
||||||
|
|
||||||
;; this script emits HTML on standard out that constitutes a user
|
;; this script emits HTML on standard out that constitutes a user
|
||||||
;; list. It denotes who has not updated their page from the
|
;; list. It denotes who has not updated their page from the
|
||||||
;; default. It also reports the time this script was run.
|
;; default. It also reports the time this script was run.
|
||||||
|
@ -25,15 +27,18 @@
|
||||||
""))))
|
""))))
|
||||||
|
|
||||||
(defn modify-time [username]
|
(defn modify-time [username]
|
||||||
(getmtime (.format "/home/{}/public_html" username)))
|
(->> (.format "/home/{}/public_html" username)
|
||||||
|
find
|
||||||
|
(map (fn [filename] (getmtime (.rstrip filename))))
|
||||||
|
list
|
||||||
|
max))
|
||||||
|
|
||||||
(defn sort-user-list [usernames]
|
(defn sort-user-list [usernames]
|
||||||
(apply sorted [usernames] {"key" modify-time}))
|
(apply sorted [usernames] {"key" modify-time}))
|
||||||
|
|
||||||
(defn user-generator [] (->> (listdir "/home")
|
(defn user-generator [] (->> (listdir "/home")
|
||||||
(filter (fn [f] (and (not (= f "ubuntu")) (not (= f "poetry")))))
|
(filter (fn [f] (and (not (= f "ubuntu")) (not (= f "poetry")))))))
|
||||||
list))
|
;list))
|
||||||
|
|
||||||
(def user-list (->> (user-generator)
|
(def user-list (->> (user-generator)
|
||||||
sort-user-list
|
sort-user-list
|
||||||
|
|
Reference in New Issue