September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,16 @@
(defn delta [entry]
(case (second (re-find #"\ (.*)\ @" entry))
"IN " -1
"OUT" 1
(throw (Exception. (str "Invalid entry:" entry)))))
(defn t [entry]
(second (re-find #"@\ (.*)\ f" entry)))
(let [entries (clojure.string/split (slurp "mlijobs.txt") #"\n")
in-use (reductions + (map delta entries))
m (apply max in-use)
times (map #(nth (map t entries) %)
(keep-indexed #(when (= m %2) %1) in-use))]
(println "Maximum simultaneous license use is" m "at the following times:")
(map println times))

View file

@ -0,0 +1,9 @@
nOut,maxOut,maxTimes:=0,-1,List();
foreach job in (File("mlijobs.txt")){
_,status,_,date:=job.split();
nOut+=( if(status.toUpper()=="OUT") 1 else -1 );
if(nOut>maxOut){ maxOut=nOut; maxTimes.clear(); }
if(nOut==maxOut) maxTimes.append(date);
}
println(("Maximum simultaneous license use is %d at"
" the following times:\n %s").fmt(maxOut,maxTimes.concat("\n")));