Add a fop based renderer

Add a fop based renderer

error: pathspec 'src/catalog/layout/fop.clj' did not match any file(s) known to git

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -0,0 +1,331 @@
+(ns catalog.layout.fop
+  (:require [catalog.layout.common :as layout]
+            [clojure.data.xml :as xml]
+            [clojure.java
+             [io :as io]
+             [shell :as shell]]
+            [clojure.string :as string]))
+
+(defn simple-page-master
+  [{:keys [master-name page-height page-width
+           margin-bottom margin-top
+           margin-left margin-right]
+    :or {page-height "297mm" page-width "210mm"
+         margin-bottom "50mm" margin-top "20mm"
+         margin-left "15mm" margin-right "35mm"}}]
+  [:fo:simple-page-master {:master-name master-name
+                           :page-height page-height
+                           :page-width page-width
+                           :margin-bottom margin-bottom
+                           :margin-top margin-top
+                           :margin-left margin-left
+                           :margin-right margin-right}
+   [:fo:region-body {:margin-top "15mm"}]
+   [:fo:region-before {:region-name (format "xsl-region-before-%s" master-name)}]])
+
+(defn heading [h hash opts]
+  [:fo:block
+   (merge {:font-weight "bold"
+           :keep-with-next "always"
+           :id hash
+           :space-before "11pt"
+           :space-after "11pt"} opts)
+   (layout/translations h)])
+
+(defn h1 [h]
+  (heading h (hash [nil h]) {:break-before "odd-page" :font-size "21pt" :role "H1"}))
+
+(defn h2 [fmt h]
+  (heading h (hash [fmt h]) {:font-size "17pt" :role "H2"}))
+
+(defn h3 [fmt genre h]
+  (heading h (hash [fmt genre h]) {:font-size "15pt" :role "H3"}))
+
+(defn h4 [fmt genre subgenre h]
+  (heading h (hash [fmt genre subgenre h]) {:font-size "13pt" :role "H3"}))
+
+(defn toc-entry [items fmt]
+  (when (fmt items)
+    [:fo:block {:text-align-last "justify"}
+     [:fo:basic-link {:internal-destination (hash [nil fmt])}
+      (str (layout/translations fmt) " ")
+      [:fo:leader {:leader-pattern "dots"}]
+      [:fo:page-number-citation {:ref-id (hash [nil fmt])}]]]))
+
+(defn toc [items formats]
+  [:fo:block
+   (h1 :inhalt)
+   (keep #(toc-entry items %) formats)])
+
+(defn sub-toc-entry [items fmt genre]
+  (when (genre items)
+    [:fo:block {:text-align-last "justify"}
+     [:fo:basic-link {:internal-destination (hash [fmt genre])}
+      (str (layout/translations genre) " ")
+      [:fo:leader {:leader-pattern "dots"}]
+      [:fo:page-number-citation {:ref-id (hash [fmt genre])}]]]))
+
+(defn sub-toc [items fmt]
+  [:fo:block
+   (keep #(sub-toc-entry items fmt %) layout/genres)])
+
+(def wrap (layout/wrapper ""))
+
+(defn- to-url
+  "Return an url given a `record-id`"
+  [record-id]
+  (let [api-key "c97386a2-914a-40c2-bd8d-df4c273175e6"]
+    (format "http://online.sbs.ch/iguana/www.main.cls?v=%s&sUrl=search%%23RecordId=%s"
+            api-key
+            (string/replace record-id "/" "."))))
+
+(defn- external-link [record-id title]
+  [:fo:basic-link {:external-destination (to-url record-id)
+                   :indicate-destination true}
+   title])
+
+(defn- block [& args]
+  (let [default {:text-align "justify" :hyphenate "true"}]
+    (if (map? (first args))
+      [:fo:block (merge default (first args)) (rest args)]
+      [:fo:block default args])))
+
+(defn- inline [& args]
+  (let [default {}]
+    (if (map? (first args))
+      [:fo:inline (merge default (first args)) (rest args)]
+      [:fo:inline default args])))
+
+(defn- list-item [& args]
+  [:fo:list-item {:space-after "1em"}
+   [:fo:list-item-label [:fo:block]]
+   [:fo:list-item-body
+    args]])
+
+(defn- bold [& args]
+  (inline {:font-weight "bold"} args))
+
+(defn- narrators-sexp [narrators]
+  (let [narrator (first narrators)]
+    (if (> (count narrators) 1)
+      (wrap narrator "gelesen von: " " u.a. " false)
+      (wrap narrator "gelesen von: "))))
+
+(defn- entry-heading-sexp
+  [creator record-id title subtitles name-of-part source-publisher source-date]
+  (block {:keep-with-next "always"}
+     (bold (wrap creator "" ": " false)
+           (external-link record-id (layout/periodify title)))
+     (layout/render-subtitles subtitles)
+     (layout/periodify name-of-part)
+     (when (or source-publisher source-date) " - ")
+     (wrap source-publisher "" (if source-date ", " "") false)
+     (wrap (layout/year source-date))))
+
+(defn- ausleihe [signature]
+  (when signature
+    (block {:keep-with-previous "always"} (bold "Ausleihe:") " " signature)))
+
+(defn- verkauf [product-number price]
+  (when product-number
+     (block {:keep-with-previous "always"} (bold "Verkauf:") " " price ", " (layout/braille-signatures product-number))))
+
+(defmulti entry-sexp (fn [{fmt :format}] fmt))
+
+(defmethod entry-sexp :hörbuch
+  [{:keys [creator record-id title subtitles name-of-part source-publisher
+           source-date genre-text description duration narrators producer-brief
+           produced-commercially? library-signature product-number price]}]
+  (list-item
+   (entry-heading-sexp creator record-id title subtitles name-of-part source-publisher source-date)
+   (block (wrap genre-text "Genre: "))
+   (block (wrap description))
+   (block (wrap duration "" " Min., " false) (narrators-sexp narrators))
+   (block producer-brief (if produced-commercially? ", Hörbuch aus dem Handel" "") ".")
+   (ausleihe library-signature)
+   (when product-number
+     (block {:keep-with-previous "always"} (bold "Verkauf:") " " product-number ", " price))))
+
+(defmethod entry-sexp :braille
+  [{:keys [creator record-id title subtitles name-of-part source-publisher source-date
+           genre-text description producer-brief rucksackbuch? rucksackbuch-number
+           library-signature product-number price]}]
+  (list-item
+   (entry-heading-sexp creator record-id title subtitles name-of-part source-publisher source-date)
+   (block (wrap genre-text "Genre: "))
+   (block (wrap description))
+   (block producer-brief (if rucksackbuch? (str ", Rucksackbuch Nr. " rucksackbuch-number) "") ".")
+   (when library-signature
+     (block {:keep-with-previous "always"} (bold "Ausleihe:") " " (layout/braille-signatures library-signature)))
+   (verkauf product-number price)))
+
+(defmethod entry-sexp :grossdruck
+  [{:keys [creator record-id title subtitles name-of-part source-publisher source-date
+           genre-text description library-signature volumes product-number price]}]
+  (list-item
+   (entry-heading-sexp creator record-id title subtitles name-of-part source-publisher source-date)
+   (block (wrap genre-text "Genre: "))
+   (block (wrap description))
+   (when library-signature
+     (block {:keep-with-previous "always"} (bold "Ausleihe:") " " library-signature (wrap volumes ", " " Bd. " false)))
+   (when product-number
+     (block {:keep-with-previous "always"} (bold "Verkauf:") " " price))))
+
+(defmethod entry-sexp :e-book
+  [{:keys [creator record-id title subtitles name-of-part source-publisher source-date
+           genre-text description library-signature]}]
+  (list-item
+   (entry-heading-sexp creator record-id title subtitles name-of-part source-publisher source-date)
+   (block (wrap genre-text "Genre: "))
+   (block (wrap description))
+   (ausleihe library-signature)))
+
+(defmethod entry-sexp :hörfilm
+  [{:keys [record-id title subtitles directed-by actors movie_country genre-text
+           description producer library-signature]}]
+  (list-item
+   (block {:keep-with-next "always"}
+     (bold (external-link record-id (layout/periodify title)))
+     (layout/render-subtitles subtitles))
+   (block (wrap directed-by "Regie: " "") (wrap actors " Schauspieler: " ""))
+   (block (wrap movie_country))
+   (block (wrap genre-text))
+   (block (wrap description))
+   (block (wrap producer))
+   (ausleihe library-signature)))
+
+(defmethod entry-sexp :ludo
+  [{:keys [record-id title subtitles creator source-publisher genre-text description
+           game-description accompanying-material library-signature]}]
+  (list-item
+   (block {:keep-with-next "always"}
+     (bold (external-link record-id (layout/periodify title)))
+     (layout/render-subtitles subtitles) " "
+     (layout/periodify creator))
+   (block (wrap source-publisher))
+   (block (wrap genre-text))
+   (block (wrap description))
+   (block (wrap game-description))
+   (ausleihe library-signature)))
+
+(defmethod entry-sexp :musiknoten
+  [{:keys [creator record-id title subtitles name-of-part source-publisher source-date
+           description producer-brief library-signature product-number price]}]
+  (list-item
+   (entry-heading-sexp creator record-id title subtitles name-of-part source-publisher source-date)
+   (block (wrap description))
+   (block (wrap producer-brief))
+   (ausleihe library-signature))
+   (verkauf product-number price))
+
+(defmethod entry-sexp :taktilesbuch
+  [{:keys [creator record-id title subtitles name-of-part source-publisher source-date
+           description producer-brief library-signature product-number price]}]
+  (list-item
+   (entry-heading-sexp creator record-id title subtitles name-of-part source-publisher source-date)
+   (block (wrap description))
+   (block (wrap producer-brief))
+   (block (bold "Ausleihe:") " " (layout/braille-signatures library-signature))
+   (verkauf product-number price)))
+
+(defn entries-sexp [items]
+  [:fo:list-block
+   (for [item items] (entry-sexp item))])
+
+(defn subgenre-sexp [items fmt genre subgenre]
+  (when-let [items (subgenre items)]
+    [(h3 fmt genre subgenre)
+     (entries-sexp items)]))
+
+(defn subgenres-sexp [items fmt genre]
+  (mapcat #(subgenre-sexp items fmt genre %) layout/subgenres))
+
+(defn genre-sexp [items fmt genre]
+  (when-let [items (genre items)]
+    [(h2 fmt genre)
+     (cond
+       (#{:kinder-und-jugendbücher} genre) (subgenres-sexp items fmt genre)
+       (#{:hörbuch} fmt) (subgenres-sexp items fmt genre)
+       :else (entries-sexp items))]))
+
+(defn format-sexp [items fmt]
+  (when-let [items (fmt items)]
+    [(h1 fmt)
+     (sub-toc items fmt)
+     (case fmt
+       (:hörfilm :ludo) (entries-sexp items)
+       (mapcat #(genre-sexp items fmt %) layout/genres))]))
+
+(defn- retrieve-marker []
+  [:fo:inline
+   [:fo:retrieve-marker {:retrieve-class-name "head"
+                         :retrieve-position "last-ending-within-page"
+                         :retrieve-boundary "page-sequence"}]])
+
+(defn- page-number []
+  [:fo:inline
+   [:fo:page-number]])
+
+(defn- header [side]
+  (let [recto? (= side :recto)]
+    [:fo:static-content {:flow-name (if recto? "xsl-region-before-recto" "xsl-region-before-verso")
+                         :role "artifact"}
+     [:fo:block {:text-align-last "justify" :font-weight "bold" :border-bottom "thin solid"}
+      (if recto? (retrieve-marker) (page-number))
+      [:fo:leader]
+      (if recto? (page-number) (retrieve-marker))]]))
+
+(defn document-sexp
+  [items {:keys [title creator description date]
+    :or {title "Neu im Sortiment"
+         creator "SBS Schweizerische Bibliothek für Blinde, Seh- und Lesebehinderte"
+         description "Katalog der neu erschienenen Bücher"}}]
+  [:fo:root {:xmlns:fo "http://www.w3.org/1999/XSL/Format"
+             :font-family "Verdana"
+             :font-size "11pt"
+             :line-height "130%"
+             :xml:lang "de"}
+   [:fo:layout-master-set
+    (simple-page-master {:master-name "recto"})
+    (simple-page-master {:master-name "verso"})
+    [:fo:page-sequence-master {:master-name "main"}
+     [:fo:repeatable-page-master-alternatives
+      [:fo:conditional-page-master-reference {:master-reference "verso" :odd-or-even "even"}]
+      [:fo:conditional-page-master-reference {:master-reference "recto" :odd-or-even "odd"}]]]]
+   [:fo:declarations
+    [:x:xmpmeta {:xmlns:x "adobe:ns:meta/"}
+     [:rdf:RDF {:xmlns:rdf"http://www.w3.org/1999/02/22-rdf-syntax-ns#"}
+      [:rdf:Description {:rdf:about ""
+                         :xmlns:dc "http://purl.org/dc/elements/1.1/"}
+       ;; Dublin Core properties
+       [:dc:title title]
+       [:dc:creator creator]
+       [:dc:description description]]
+      [:rdf:Description {:rdf:about ""
+                         :xmlns:xmp "http://ns.adobe.com/xap/1.0/"}
+       ;; XMP properties
+       [:xmp:CreatorTool "Apache FOP"]]]]]
+   [:fo:page-sequence {:master-reference "main"
+                       :language "de"}
+    [:fo:flow {:flow-name "xsl-region-body"}
+     [:fo:block {:font-size "26pt"} title]
+     [:fo:block {:space-before "20mm"} date]
+     [:fo:block {:space-before "170mm"} creator]]]
+   [:fo:page-sequence {:master-reference "main"
+                       :initial-page-number "1"
+                       :language "de"}
+    (header :recto)
+    (header :verso)
+
+    [:fo:flow {:flow-name "xsl-region-body"}
+     (toc items layout/formats)
+     (mapcat #(format-sexp items %) layout/formats)]]])
+
+(defn document [items]
+  (with-open [out (io/writer "catalog.xml")]
+    (-> (document-sexp items {})
+        xml/sexp-as-element
+        (xml/indent out))))
+
+(defn generate-pdf []
+  (shell/sh "fop" "-a" "catalog.xml" "catalog.pdf"))


file benchmarks

file benchmarks

error: pathspec 'benchmarks/matross/tasks/file_benchmark.clj' did not match any file(s) known to git

--- benchmarks/matross/tasks/file_benchmark.clj
+++ benchmarks/matross/tasks/file_benchmark.clj
@@ -0,0 +1,21 @@
+(ns matross.tasks.file-benchmark
+  (:require [perforate.core :refer :all]
+            [matross.tasks.file :refer :all]
+            [matross.tasks.command :refer :all]
+            [matross.tasks.script]
+            [matross.tasks.stream-to-file]
+            [matross.connections.core :refer [connect disconnect]]
+            [matross.test.helper :refer [test-connection]]))
+
+(defgoal file-benchmarks
+  "let's see how well the file task performs"
+  :setup (fn [] (let [conn (test-connection)]
+                  (connect conn)
+                  [conn {:type :file :state :abset :path "/herp"}]))
+
+  :cleanup (fn [conn _] #_(disconnect conn)))
+
+
+(defcase file-benchmarks :file
+  [conn task]
+  (file conn task))


alt -cached-rf impl for Atom (less safe?)

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/michaelsbradleyjr/transwarp.git/'


rev approach to conditional assoc

rev approach to conditional assoc


Add API link to footer

Add API link to footer

This fixes #824.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/tobias/clojars-web.git/'


rendering in a thread

rendering in a thread

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/hialin/hialin.git/'


added first folder & my soln

added first folder & my soln

error: pathspec '04_23_17_Jolly_Jumper/Annie_Clojure.clj' did not match any file(s) known to git

--- 04_23_17_Jolly_Jumper/Annie_Clojure.clj
+++ 04_23_17_Jolly_Jumper/Annie_Clojure.clj
@@ -0,0 +1,41 @@
+; demo it at: https://repl.it/HWQl/57
+
+abs [x] (max x (- x)))
+
+(defn solveIt
+  ([available todo]
+   (if (empty? available)
+       " JOLLY"
+       (do
+       (def dif (abs (- (first todo) (first (rest todo))))) ; what is the abs difference?
+       (if (= dif (some #{dif} available)) ; do we already have this difference?
+         (recur (remove #{dif} available) (rest todo))
+         " NOT JOLLY"))))
+  ([test]
+    ; makes a list [1...(n-1)], "rest" drops a leading 0
+   (solveIt (rest (take (count test) (range))) test))
+)
+
+(defn solveAndPrint
+  ([inputs]
+    (def solns (map (fn [x] (solveIt (rest x))) inputs))
+    (map (fn [x y] (apply print x) (println y)) inputs solns )
+  ))
+
+; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+;        TESTIN TIME
+; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+(def test0 [1, 4, 2, 3])
+(def test1 [[4 1 4 2 3] [8 1 6 -1 8 9 5 2 7]])
+(def test2 [[4 1 4 2 3] [5 1 4 2 -1 6] [4 19 22 24 21] [4 19 22 24 25] [4 2 -1 0 2]])
+
+(println "TEST 0!")
+(apply print test0) (println (solveIt test0))
+
+(println "\nTEST 1!")
+(solveAndPrint test1)
+
+(println "\nTEST 2!")
+(solveAndPrint test2)
+


[#40] Add experimental support for new data types

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -196,13 +196,33 @@

 (defn- db-val->clj-val "Returns the Clojure value of given AttributeValue object."
   [^AttributeValue x]
-  (or (.getS x)
-      (some->> (.getN  x) ddb-num-str->num)
-      (some->> (.getSS x) (into #{}))
-      (some->> (.getNS x) (mapv ddb-num-str->num) (into #{}))
-      (some->> (.getBS x) (mapv nt-thaw)          (into #{}))
-      (some->> (.getB  x) nt-thaw) ; Last, may be falsey
-      ))
+  (let [[x type]
+        (or
+          (some-> (.getS    x) (vector :s))
+          (some-> (.getN    x) (vector :n))
+          (some-> (.getNULL x) (vector :null))
+          (some-> (.getBOOL x) (vector :bool))
+          (some-> (.getSS   x) (vector :ss))
+          (some-> (.getNS   x) (vector :ns))
+          (some-> (.getBS   x) (vector :bs))
+          (some-> (.getB    x) (vector :b))
+          (some-> (.getM    x) (vector :m))
+          (some-> (.getL    x) (vector :l)))]
+
+    (case type
+      :s    x
+      :n    (ddb-num-str->num x)
+      :null nil
+      :bool (boolean  x)
+      :ss   (into #{} x)
+      :ns   (into #{} (mapv ddb-num-str->num x))
+      :bs   (into #{} (mapv nt-thaw          x))
+      :b    (nt-thaw  x)
+
+      ;;; TODO Completely untested
+      :l (mapv db-val->clj-val x)
+      :m (zipmap (mapv keyword         (.keySet ^java.util.HashMap x))
+                 (mapv db-val->clj-val (.values ^java.util.HashMap x))))))

 (defn- clj-val->db-val "Returns an AttributeValue object for given Clojure value."
   ^AttributeValue [x]
@@ -213,9 +233,17 @@
        (throw (Exception. "Invalid DynamoDB value: \"\""))
        (doto (AttributeValue.) (.setS s))))

-   (ddb-num? x) (doto (AttributeValue.) (.setN (str x)))
-   (freeze?  x) (doto (AttributeValue.) (.setB (nt-freeze x)))
-
+   (nil? x)              (doto (AttributeValue.) (.setNULL true))
+   (instance? Boolean x) (doto (AttributeValue.) (.setBOOL x))
+   (ddb-num? x)          (doto (AttributeValue.) (.setN (str x)))
+   (freeze?  x)          (doto (AttributeValue.) (.setB (nt-freeze x)))
+
+   ;;; TODO Completely untested
+   (vector?  x) (doto (AttributeValue.) (.setL (mapv clj-val->db-val x)))
+   (map?     x) (doto (AttributeValue.) (.setM (encore/map-kvs
+                                                 (fn [k _] (name k))
+                                                 (fn [_ v] (clj-val->db-val v))
+                                                 x)))
    (set? x)
    (if (empty? x)
      (throw (Exception. "Invalid DynamoDB value: empty set"))


Add tests for metrics

Add tests for metrics

error: pathspec 'test/desdemona/metrics_test.clj' did not match any file(s) known to git

--- test/desdemona/metrics_test.clj
+++ test/desdemona/metrics_test.clj
@@ -0,0 +1,16 @@
+(ns desdemona.metrics-test
+  (:require
+   [desdemona.lifecycles.metrics :as m]
+   [clojure.test :as t]))
+
+(deftest add-metrics-tests
+  (let [job {:lifecycles []}
+        task {}
+        lifecycle {:lifecycle/task task
+                   :lifecycle/calls :onyx-lifecycle.metrics.metrics/calls}
+        opts {:pedantic true}
+        lifecycle-with-opts (merge lifecycle opts)]
+    (is (= {:lifecycles [lifecycle]}
+           (m/add-metrics job task {})))
+    (is (= {:lifecycles [lifecycle-with-opts]}
+           (m/add-metrics job task opts)))))


Updated README.

Updated README.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Yoshiyuka/cthulhu.git/'


Add query param

Add query param

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/physion/ovation-webapi.git/'


sketch of extensions test

sketch of extensions test

error: pathspec 'stash/test/stash/core_extensions_test.clj' did not match any file(s) known to git

--- stash/test/stash/core_extensions_test.clj
+++ stash/test/stash/core_extensions_test.clj
@@ -0,0 +1,11 @@
+(in-ns 'stash.core-test)
+
+(defn the-extension
+  [model-map]
+  (update-in model-map [:callbacks :after-validation]
+    (nf [av-callbacks] (conj (or av-callbacks [:the-callback])))))
+
+(deftest "compiled-model: extensions"
+  (let [extended-model
+          (compiled-model (assoc +post-map+ :extensions [the-extension]))]
+    (assert= [:the-callback] (:after-validation (:callbacks extended-model)))))


add little util "test" to help debug JsInspector

error: pathspec 'src/repl/shadow/build/js_inspector_test.clj' did not match any file(s) known to git

--- src/repl/shadow/build/js_inspector_test.clj
+++ src/repl/shadow/build/js_inspector_test.clj
@@ -0,0 +1,32 @@
+(ns shadow.build.js-inspector-test
+  (:require
+    [clojure.test :as ct :refer (deftest is)]
+    [clojure.java.io :as io]
+    [shadow.build.data :as data]
+    [shadow.build.closure :as closure]
+    [shadow.build.classpath :as classpath])
+  (:import
+    [shadow.build.closure JsInspector]))
+
+
+(deftest dummy-inspect
+
+  (let [resource-name
+        "goog/events/events.js"
+
+        source
+        (slurp (io/resource resource-name))
+
+        {:keys [compiler] :as cp}
+        (classpath/start (io/file "tmp" "test-cache-root"))
+
+        info
+        (JsInspector/getFileInfoMap
+          compiler
+          (closure/closure-source-file resource-name source))]
+
+    (tap> info)
+
+    (classpath/stop cp)
+    ))
+


Added some tests for specced records.

Added some tests for specced records.

error: pathspec 'test/active/clojure/record_spec_test.cljc' did not match any file(s) known to git

--- test/active/clojure/record_spec_test.cljc
+++ test/active/clojure/record_spec_test.cljc
@@ -0,0 +1,50 @@
+(ns active.clojure.record-spec-test
+  (:require [active.clojure.record-spec :refer (define-record-type)]
+            [active.clojure.lens :as lens]
+            [clojure.spec.alpha :as s]
+            [clojure.spec.test.alpha :as stest]
+            [clojure.test :refer :all]))
+
+
+(s/def ::k int?)
+(s/def ::v string?)
+
+
+(define-record-type kv
+  (make-kv k v) kv?
+  [^{:spec ::k} k kv-k
+   (v kv-v kv-v-lens)])
+
+(define-record-type kv-store
+  (make-kv-store store) kv-store?
+  [(^{:doc "Set of all kvs stored."
+      :spec (s/coll-of ::kv :into #{})}
+    store kv-store-store kv-store-lens)])
+
+(defrecord FakeKV [k v])
+
+(deftest simple
+  (let [kv-1 (make-kv 1 "foo")
+        kv-2 (make-kv 2 "bar")
+        kv-store (make-kv-store #{kv-1 kv-2})
+        kv-fake (FakeKV. 1 "foo")]
+    (is (kv? kv-1))
+    (is (kv? kv-2))
+    (is (kv-store? kv-store))
+    (is (= 1 (kv-k kv-1)))
+    (is (= "foo" (kv-v kv-1)))
+    (is (= #{kv-1 kv-2} (kv-store-store kv-store)))
+    (is (not= kv-1 kv-fake))))
+
+(deftest with-instrumentation
+  (testing "without instrumentation, spec errors are not detected"
+    (let [kv (make-kv "foo" :bar)]
+      (is (= "foo" (kv-k kv)))
+      (is (= :bar (kv-v kv)))))
+  (testing "after instrumentation, this throws an error"
+    (stest/instrument)
+    (try (make-kv "foo" :bar)
+         (catch Exception e
+           (is (= "Call to #'active.clojure.record-spec-test/make-kv did not conform to spec:
+In: [0] val: \"foo\" fails spec: :active.clojure.record-spec-test/k at: [:args :k] predicate: int?\n"
+                  (.getMessage e)))))))


removing println

removing println

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B2W-BIT/restQL-server.git/'


transform component added to provide an easy way to transform values on streams

error: pathspec 'src/clj/hellhound/components/transform.clj' did not match any file(s) known to git

--- src/clj/hellhound/components/transform.clj
+++ src/clj/hellhound/components/transform.clj
@@ -0,0 +1,25 @@
+(ns hellhound.components.transform
+  "`transform` component is a really simple component to transofrm
+  the incoming data and send the result to the output stream."
+  ^{:author "Sameer Rahmani (@lxsameer)"}
+  (:require
+   [manifold.stream     :as s]
+   [hellhound.component :as hcomp]))
+
+
+(defn- transform-fn
+  [f]
+  (fn [{:keys [input output] :as component} context]
+    (s/connect-via input
+                   #(s/put! output (f context %))
+                   output)
+    component))
+
+
+(defn factory
+  "Creates a component with the given `component-name` which transforms
+  the input value by applying `f` to it and sending it to the output stream."
+  [component-name f
+   {::hcomp/name     component-name
+    ::hcomp/start-fn (transform-fn f)
+    ::hcomp/stop-fn  (fn [component] this)}])


Flow for termseq rnaseq runtype phase-2 processing

error: pathspec 'Jobs/termseq-phase-2-rnaseq-job-template.clj' did not match any file(s) known to git

--- Jobs/termseq-phase-2-rnaseq-job-template.clj
+++ Jobs/termseq-phase-2-rnaseq-job-template.clj
@@ -0,0 +1,10 @@
+
+{:nodes
+ {:ph2
+  {:name "rnaseq-phase2",
+   :type "tool",
+   :args []}
+  :prn1 {:type "func",
+         :name "prn"}},
+ :edges
+ {:ph2 [:prn1]}}


tiny change for best practice.

tiny change for best practice.

--- src/clj/backtype/storm/daemon/executor.clj
+++ src/clj/backtype/storm/daemon/executor.clj
@@ -273,7 +273,7 @@
                                           (IMetricsConsumer$DataPoint. (.name mh)
                                                                        (.getValueAndReset ^IMetric (.metric mh)))))
                                    (into []))]]
-      (if data-points
+      (if (seq data-points)
         (task/send-unanchored task-data Constants/METRICS_STREAM_ID [task-info data-points])))))

 (defn setup-ticks! [worker executor-data]


remove reflection from refactoring

remove reflection from refactoring

--- src/clj/backtype/storm/daemon/executor.clj
+++ src/clj/backtype/storm/daemon/executor.clj
@@ -320,8 +320,9 @@
                             ;; TODO: on failure, emit tuple to failure stream
                             ))]
     (log-message "Opening spout " component-id ":" (keys task-datas))
-    (doseq [[task-id task-data] task-datas]
-      (.open ^ISpout (:object task-data)
+    (doseq [[task-id task-data] task-datas
+            :let [^ISpout spout-obj (:object task-data)]]
+      (.open spout-obj
              storm-conf
              (:user-context task-data)
              (SpoutOutputCollector.
@@ -424,11 +425,14 @@
                           ;; TODO: need to version tuples somehow

                           (log-debug "Received tuple " tuple " at task " task-id)
-                          (.put tuple-start-times tuple (System/currentTimeMillis))
-                          (.execute ^IBolt (-> task-id task-datas :object) tuple))]
+                          ;; need to do it this way to avoid reflection
+                          (let [^IBolt bolt-obj (-> task-id task-datas :object)]
+                            (.put tuple-start-times tuple (System/currentTimeMillis))
+                            (.execute bolt-obj tuple)))]
     (log-message "Preparing bolt " component-id ":" (keys task-datas))
-    (doseq [[task-id task-data] task-datas]
-      (.prepare ^IBolt (:object task-data)
+    (doseq [[task-id task-data] task-datas
+            :let [^IBolt bolt-obj (:object task-data)]]
+      (.prepare bolt-obj
                 storm-conf
                 (:user-context task-data)
                 (OutputCollector.


fix service creation

fix service creation

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/starcity-properties/odin.git/'


Comment regarding hard coding of the reg form to NVRF

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/voter-registration-works.git/'


jstavel/edeposit#454 pripravil jsem vyrobu foxml

error: pathspec 'src/edeposit/amqp/kramerius/xml/foxml.clj' did not match any file(s) known to git

--- src/edeposit/amqp/kramerius/xml/foxml.clj
+++ src/edeposit/amqp/kramerius/xml/foxml.clj
@@ -0,0 +1,69 @@
+(ns edeposit.amqp.kramerius.xml.foxml
+  (:require [clojure.data.xml :as xml]
+            [clojure.data.zip.xml :as zx]
+            [clojure.zip :as zip]
+            [clojure.pprint :as pp]
+            )
+  )
+
+(defn to-sexp [el]
+  (if (associative? el)
+    (let [{tag :tag attrs :attrs content :content} el]
+      [(keyword (str "mods:" (name tag))) attrs (map to-sexp content)]
+      )
+    (if (seq? el) (map to-sexp el) el)
+    )
+  )
+
+
+(defn foxml
+  "transforms xml mods into oai_dc. Returns xml/root structure."
+  [mods dcs {:keys [uuid label created last-modified]}]
+  (let [mods-0 (first mods)
+        ]
+    )
+  (xml/sexp-as-element
+   [:foxml:digitalObject  {:PID uuid :VERSION "1.1"
+                           :xsi:schemaLocation "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd"
+                           :xmlns:foxml "info:fedora/fedora-system:def/foxml#"
+                           :xmlns:xsi "http://www.w3.org/2001/XMLSchema-instance"}
+    [:foxml:objectProperties
+     [:foxml:property {:VALUE label :NAME "info:fedora/fedora-system:def/model#label"}]
+     [:foxml:property {:VALUE "Active" :NAME "info:fedora/fedora-system:def/model#state"}]
+     [:foxml:property {:VALUE "fedoraAdmin" :NAME "info:fedora/fedora-system:def/model#ownerId"}]
+     [:foxml:property {:VALUE (.toString created) :NAME "info:fedora/fedora-system:def/model#createdDate"}]
+     [:foxml:property {:VALUE (.toString last-modified) :NAME "info:fedora/fedora-system:def/view#lastModifiedDate"}]
+     ]
+    (for [dc dcs]
+      [:foxml:datastream {:VERSIONABLE "true" :STATE "A" :CONTROL_GROUP "X" :ID "DC"}
+       [:foxml:datastreamVersion {:FORMAT_URI "http://www.openarchives.org/OAI/2.0/oai_dc/"
+                                  :MIMETYPE "text/xml"
+                                  :CREATED (.toString created)
+                                  :LABEL "Dublin Core Record for this object"
+                                  :ID "DC.1"}
+        [:foxml:xmlContent dc]]]
+      )
+    (for [mods-one mods]
+      [:foxml:datastream {:VERSIONABLE "true" :STATE "A" :CONTROL_GROUP "X" :ID "BIBLIO_MODS"}
+       [:foxml:xmlContent
+        [:mods:modsCollection {:xmlns:mods "http://www.loc.gov/mods/v3"}
+         [:mods:mods {:version "3.3"}
+          (map to-sexp (:content mods-one))]]]]
+      )
+    ]
+   )
+  )
+
+(defn mods->rdf
+  [root]
+  )
+
+
+
+
+
+
+
+
+
+


Testu txikiagoa

Testu txikiagoa

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/lnmnd/magnet.bez.git/'


Forget aggregate file

Forget aggregate file

error: pathspec 'src/aurora/aggregates.cljs' did not match any file(s) known to git

--- src/aurora/aggregates.cljs
+++ src/aurora/aggregates.cljs
@@ -0,0 +1,5 @@
+(ns aurora.aggregates
+  (:require-macros [aurora.macros :refer []]))
+
+(defn count [ix inputs]
+  (alength inputs))


cascade delete of user should include ViewLog entries.

--- src/metabase/models/user.clj
+++ src/metabase/models/user.clj
@@ -49,7 +49,8 @@
     (cascade-delete 'Session :user_id id)
     (cascade-delete 'Dashboard :creator_id id)
     (cascade-delete 'Card :creator_id id)
-    (cascade-delete 'Activity :user_id id)))
+    (cascade-delete 'Activity :user_id id)
+    (cascade-delete 'ViewLog :user_id id)))

 (def ^:const current-user-fields


K-medoids clustering tests

K-medoids clustering tests

error: pathspec 'test/rdf_path_examples/clustering_test.clj' did not match any file(s) known to git

--- test/rdf_path_examples/clustering_test.clj
+++ test/rdf_path_examples/clustering_test.clj
@@ -0,0 +1,30 @@
+(ns rdf-path-examples.clustering-test
+  (:require [rdf-path-examples.clustering :as cluster]
+            [clojure.set :refer [union]]
+            [clojure.test :refer :all]))
+
+(deftest select-k-medoids
+  (letfn [(distance [distances a b]
+            ; Mock distance function
+            (if (= a b) 0 (get distances (hash-set a b))))
+          (k-medoids [distances k]
+            ; Wrapper for k-medoids clustering
+            (cluster/select-k-medoids (apply union (keys distances)) (partial distance distances) k))]
+    (let [distances {#{1 2} 0.5
+                     #{1 3} 1
+                     #{1 4} 1
+                     #{2 3} 0.5
+                     #{2 4} 0.5
+                     #{3 4} 0}]
+      (= (k-medoids distances 2) #{1 3}))
+    (let [distances {#{1 2} 0.5
+                     #{1 3} 1
+                     #{1 4} 1
+                     #{1 5} 0.25
+                     #{2 3} 0.5
+                     #{2 4} 0.5
+                     #{2 5} 0.25
+                     #{3 4} 0
+                     #{3 5} 0.75
+                     #{4 5} 0.75}]
+      (= (k-medoids distances 2) #{1 3}))))


notes re: nested empty-plan

notes re: nested empty-plan

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/michaelsbradleyjr/transwarp.git/'


Forgot to commit logging file

Forgot to commit logging file

error: pathspec 'src/silly_image_store/logging.clj' did not match any file(s) known to git

--- src/silly_image_store/logging.clj
+++ src/silly_image_store/logging.clj
@@ -0,0 +1,7 @@
+(ns silly-image-store.logging
+  (:require [clojure.tools.logging :as log]))
+
+(defn wrap-request-logging [handler]
+  (fn [{requester :remote-addr uri :uri action :request-method :as request}]
+    (log/info (str action " " uri " from " requester))
+    (handler request)))


components => io

components => io

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/acessocard/microscope.git/'


deleted unneccesary sleep

deleted unneccesary sleep

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/colophon/clarango.git/'


add one more problem in function exercise

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/croeder/clojure-koans-work.git/'


add devbar file

add devbar file

error: pathspec 'src/leiningen/new/lein_quick_om/devbar.cljs' did not match any file(s) known to git

--- src/leiningen/new/lein_quick_om/devbar.cljs
+++ src/leiningen/new/lein_quick_om/devbar.cljs
@@ -0,0 +1 @@
+(ns {{name}}.devbar)


give results test slightly longer to finish !

--- test/metabase/api/result_test.clj
+++ test/metabase/api/result_test.clj
@@ -13,7 +13,7 @@
   []
   (let [{query-id :id} (create-query)
         query-execution ((user->client :rasta) :post 200 (format "query/%d" query-id))]
-    (Thread/sleep 50) ; Give it 50ms to finish
+    (Thread/sleep 100) ; Give it 100ms to finish
     query-execution))

 ;; ## GET /result/:id


Simplify logger loop.

Simplify logger loop.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/cstorey/nrod.git/'


return unmodified info map if both predicates fail

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-notification-works.git/'


don't always overwrite :boxed,:core via :core-plan


code style

code style

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/JetBrains/imperative-nodejs.git/'


Placeholder for rocksdb state backend.

Placeholder for rocksdb state backend.

error: pathspec 'src/onyx/state/rocksdb.clj' did not match any file(s) known to git

--- src/onyx/state/rocksdb.clj
+++ src/onyx/state/rocksdb.clj
@@ -0,0 +1,4 @@
+(ns onyx.state.rocksdb)
+
+;; Store data in:
+; (System/getProperty "java.io.tmpdir")


Add materials

Add materials

error: pathspec 'src/robinson/materials.clj' did not match any file(s) known to git

--- src/robinson/materials.clj
+++ src/robinson/materials.clj
@@ -0,0 +1,69 @@
+;; Functions for generating random items.
+(ns robinson.materials
+  (:require [taoensso.timbre :as log]
+            [taoensso.timbre :as log]
+            [datascript.core :as d]))
+
+(def material-schema {
+  ::isa        {:db/valueType :db.type/ref
+                :db/cardinality :db.cardinality/many}
+  ::properties {:db/cardinality :db.cardinality/many}})
+
+(def item-schema {
+  :item/id {:db/unique :db.unique/identity}
+  :item/materials {:db/cardinality :db.cardinality/many
+                   :db/type :db.type/ref}
+  :item/components {:db/cardinality :db.cardinality/many
+                    :db/type :db.type/ref}
+  :item/weapon-types {:db.cardinality :db.cardinality/many}})
+
+
+(def material-heirarchy [
+  {:db/ident :solid                               ::properties #{:wieldable}}
+  {:db/ident :liquid                              ::properties #{:containable}}
+  {:db/ident :container     ::isa #{:solid}}
+  {:db/ident :mineral       ::isa #{:solid}}
+  {:db/ident :plant-based   ::isa #{:solid}       ::properties #{:flammable}}
+  {:db/ident :animal-based  ::isa #{:solid}}
+  {:db/ident :wood          ::isa #{:plant-based}}
+  {:db/ident :water         ::isa #{:liquid}}
+  {:db/ident :lava          ::isa #{:liquid}      ::properties #{:hot}}
+  {:db/ident :rock          ::isa #{:solid}}
+  {:db/ident :obsidian      ::isa #{:solid}       ::properties #{:brittle}}
+  {:db/ident :flint         ::isa #{:mineral}}
+  {:db/ident :metal         ::isa #{:solid}}
+  {:db/ident :cloth         ::isa #{:plant-based} ::properties #{:flexible}}
+  {:db/ident :paper-based   ::isa #{:plant-based} ::properties #{:flexible}}
+  {:db/ident :glass         ::isa #{:solid}       ::properties #{:brittle :reflective}}
+  {:db/ident :metal                               ::properties #{:mallable}}
+  {:db/ident :fruit         ::isa #{:plant-based} ::properties #{:edible}}
+  {:db/ident :bone          ::isa #{:animal-based
+                                    :solid}}
+  {:db/ident :leather       ::isa #{:animal-based} ::properties #{:flexible}}
+])
+
+(def db (-> (d/empty-db (merge material-schema item-schema))
+            (d/db-with material-heirarchy)))
+
+(def all-properties
+  '[[(all-properties ?material ?properties)
+       [?material ::properties ?properties]]
+    [(all-properties ?material ?properties)
+       [?material ::isa ?parents]
+       (all-properties ?parents ?properties)]])
+
+(defn -main [& args]
+  (let [test-item {:item/id :obsidian-knife :item/materials #{:obsidian :wood}}
+        q '[:find ?properties #_?material-ident
+            :in $ %
+            :where
+            [_ :item/materials ?material]
+            [?material :db/ident ?material-ident]
+            [all-properties ?material ?properties]]]
+    ;; execute query: item
+    (log/info (->> (d/q q
+                       (d/db-with db [test-item])
+                       all-properties)
+                  (map first)
+                  set))))
+(-main)


Add beginnings of clojure.spec examples

Add beginnings of clojure.spec examples

error: pathspec 'test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_600_clojure_spec.clj' did not match any file(s) known to git

--- test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_600_clojure_spec.clj
+++ test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_600_clojure_spec.clj
@@ -0,0 +1,14 @@
+(ns com.nomistech.clojure-the-language.c-200-clojure-basics.s-600-clojure-spec
+  (:require [clojure.spec.alpha :as s]
+            [midje.sweet :refer :all]))
+
+;;;; ___________________________________________________________________________
+;;;; Stuff from https://clojure.org/guides/spec
+
+(fact
+  (s/conform even? 1000)
+  => 1000)
+
+(fact
+  (s/conform even? 999)
+  => :clojure.spec.alpha/invalid)


ensure unpaid payments don't have method `:other`

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/starcity-properties/odin.git/'


whoops, missing ns alias ref

whoops, missing ns alias ref

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-mail-works.git/'


Stub markdown spec.

Stub markdown spec.

error: pathspec 'spec/incise/parsers/markdown_spec.clj' did not match any file(s) known to git

--- spec/incise/parsers/markdown_spec.clj
+++ spec/incise/parsers/markdown_spec.clj
@@ -0,0 +1,10 @@
+(ns incise.parsers.markdown-spec
+  (:require [speclj.core :refer :all]
+            [incise.parsers.markdown :refer :all])
+  (:import [java.io File]))
+
+(describe "parsing"
+  (it "does something"
+    (should (parse (File. "hey")))))
+
+(run-specs)


Remove carriage returns when importing CSVs

There are some showing up lately, and we probably only want \n in our data (not
\r\n).

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-authority-works.git/'


added drafts and documentation for clojuresque collection methods assoc, dissoc and conj


Cleanup.

Cleanup.

--- src/clj/freefrog/governance.clj
+++ src/clj/freefrog/governance.clj
@@ -146,8 +146,8 @@
 ;; ## Generalization Functions ##

 (defn- update-role-raw
-  "Generalizes any role manipulation. The entity-path is the path to the entity
-   inside the role you want to manipulate. The function given is what
+  "Generalizes any role manipulation. The entities vector is the path to the
+   entity inside the role you want to manipulate. The function given is what
    gets applied to the final entity, and the params are the arguments passed to
    that function."
   [circle role-name entities fn args]
@@ -156,12 +156,12 @@

 (defn- update-role
   "Sames as update-role-raw, but a bit easier to use. Doesn't include an
-  entity."
+   entity path."
   [circle role-name fn & args]
   (update-role-raw circle role-name nil fn args))

 (defn- update-role-entity
-  "Same as update-role-raw, but a bit easier to use. Includes an entity."
+  "Same as update-role-raw, but a bit easier to use. Includes an entity path."
   [circle role-name entity-path fn & args]
   (update-role-raw circle role-name entity-path fn args))

@@ -235,9 +235,9 @@
     (update-role circle role-name assoc :purpose nil)
     (update-role circle role-name assoc :purpose new-purpose)))

-(def ^:private err-types {:domains          "Domain"
-                          :accountabilities "Accountability"
-                          :policies         "Policy"})
+(def ^:private sets-of-things {:domains          "Domain"
+                               :accountabilities "Accountability"
+                               :policies         "Policy"})

 (defn- validate-things
   "Abstract function to validate collections of things in a circle. Checks that
@@ -254,33 +254,34 @@
   [circle role-name type thing check-fn err-msg-fmt]
   (validate-role-updates circle role-name)
   (validate-not (check-fn (get-entity circle role-name type) thing)
-                (format err-msg-fmt (err-types type) thing role-name)))
+                (format err-msg-fmt (sets-of-things type) thing role-name)))

 (defn is-lead-link? [role-name]
   (= lead-link-name role-name))

 (defn- add-to
-  "Abstract function that adds anything to a set of things in a role in a
+  "Abstract function that adds anything to a set-of-things in a role in a
    circle. Performs all validation and so forth. Creates the set if it doesn't
-   exist."
-  [circle role-name type thing]
+   exist. The sets that can be manipulated are defined in sets-of-things."
+  [circle role-name set-of-things thing]
   (validate-not (is-lead-link? role-name)
-                (format "May not add %s to '%s'" (err-types type) role-name))
-  (validate-things circle role-name type thing contains?
+                (format "May not add %s to '%s'"
+                        (sets-of-things set-of-things) role-name))
+  (validate-things circle role-name set-of-things thing contains?
                    "%s '%s' already exists on role '%s'")
-  (let [things (get-entity circle role-name type)
+  (let [things (get-entity circle role-name set-of-things)
         circle (if things
                  circle
-                 (update-role circle role-name assoc type #{}))]
-    (update-role-entity circle role-name [type] conj thing)))
+                 (update-role circle role-name assoc set-of-things #{}))]
+    (update-role-entity circle role-name [set-of-things] conj thing)))

 (defn- remove-from
-  "Abstract function that removes a thing from a set of things in a role in a
+  "Abstract function that removes a thing from a set-of-things in a role in a
    circle. Performs all validation and so forth. Removes the set if it's empty."
-  [circle role-name type thing]
-  (validate-things circle role-name type thing (comp not contains?)
+  [circle role-name set-of-things thing]
+  (validate-things circle role-name set-of-things thing (comp not contains?)
                    "%s '%s' doesn't exist on role '%s'")
-  (remove-and-purge circle role-name type disj thing))
+  (remove-and-purge circle role-name set-of-things disj thing))

 ;; ## Role Collection Manipulation Functions ##
 ;; These functions are critical to maintaining namespace encapsulation. Simply
@@ -324,13 +325,13 @@
                           {:name policy-name :text policy-text})))
   ([circle role-name policy-name policy-text domain]
     (let [with-added-policy (add-role-policy circle role-name policy-name
-                                             policy-text)
-          _ (validate (or (and (is-lead-link? role-name)
-                               (= role-assignments-domain domain))
-                          (contains? (get-entity circle role-name :domains)
-                                     domain))
-                      (format "Role '%s' doesn't control domain '%s'" role-name
-                              domain))]
+                                             policy-text)]
+      (validate (or (and (is-lead-link? role-name)
+                         (= role-assignments-domain domain))
+                    (contains? (get-entity circle role-name :domains)
+                               domain))
+                (format "Role '%s' doesn't control domain '%s'" role-name
+                        domain))
       (update-role-entity with-added-policy role-name [:policies policy-name]
                           assoc :domain domain))))


solved problem 1 with clojure

solved problem 1 with clojure

error: pathspec 'prob0001.clj' did not match any file(s) known to git


Changing the order of npm install and test so test runs first

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/xcthulhu/clj-bitauth.git/'


minors

minors

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/fhirbase/fhirplace.git/'


add POST /api/meta/table/:id/sync endpoint.

--- src/metabase/api/meta/table.clj
+++ src/metabase/api/meta/table.clj
@@ -1,16 +1,17 @@
 (ns metabase.api.meta.table
   "/api/meta/table endpoints."
-  (:require [compojure.core :refer [GET PUT]]
+  (:require [compojure.core :refer [GET POST PUT]]
             [korma.core :refer :all]
             [medley.core :as m]
             [metabase.api.common :refer :all]
             [metabase.db :refer :all]
             (metabase.models [hydrate :refer :all]
-                             [database :refer [Database]]
-                             [field :refer [Field]]
-                             [foreign-key :refer [ForeignKey]]
-                             [table :refer [Table] :as table])
-            [metabase.util :as u]))
+              [database :refer [Database]]
+              [field :refer [Field]]
+              [foreign-key :refer [ForeignKey]]
+              [table :refer [Table] :as table])
+            [metabase.util :as u]
+            [metabase.driver :as driver]))

 (defannotation TableEntityType [symb value :nillable]
   (checkp-contains? table/entity-types symb (keyword value)))
@@ -50,10 +51,16 @@
         ;; TODO - it's a little silly to hydrate both of these table objects
         (hydrate [:origin :table] [:destination :table]))))

+(defendpoint POST "/:id/sync" [id]
+  (let-404 [table (sel :one Table :id id)]
+    (write-check table)
+    ;; run the task asynchronously
+    (future (driver/sync-table table)))
+  {:status :ok})
+

 ;; TODO - GET /:id/segments
 ;; TODO - POST /:id/segments
-;; TODO - GET /:id/sync
 ;; TODO - POST /:id/reorder

 (define-routes)


CMR-3968: Added the bulk update tables.

CMR-3968: Added the bulk update tables.

error: pathspec 'ingest-app/src/migrations/005_create_bulk_update_tables.clj' did not match any file(s) known to git

--- ingest-app/src/migrations/005_create_bulk_update_tables.clj
+++ ingest-app/src/migrations/005_create_bulk_update_tables.clj
@@ -0,0 +1,35 @@
+(ns migrations.005-create-bulk-update-tables
+  (:require [clojure.java.jdbc :as j]
+            [config.migrate-config :as config]))
+
+(defn up
+  "Migrates the database up to version 5."
+  []
+  (println "migrations.005-create-bulk-update-tables up...")
+  (j/db-do-commands (config/db) "CREATE TABLE CMR_INGEST.bulk_update_task_status (
+                              TASK_ID NUMBER NOT NULL,
+                              PROVIDER_ID  VARCHAR(10) NOT NULL,
+                              REQUEST_JSON_BODY  BLOB NOT NULL,
+                              STATUS VARCHAR(20),
+                              STATUS_MESSAGE   VARCHAR(255),
+                              CONSTRAINT BULK_UPDATE_TASK_STATUS_PK PRIMARY KEY (TASK_ID)
+                              )")
+  (j/db-do-commands (config/db) "CREATE TABLE CMR_INGEST.bulk_update_coll_status (
+                              TASK_ID NUMBER NOT NULL,
+                              CONCEPT_ID VARCHAR(255) NOT NULL,
+                              STATUS VARCHAR(20),
+                              STATUS_MESSAGE  VARCHAR(255),
+                              CONSTRAINT BULK_UPDATE_COLL_STATUS_PK PRIMARY KEY (TASK_ID,CONCEPT_ID),
+                              CONSTRAINT BULK_UPDATE_COLL_STATUA_FK FOREIGN KEY (TASK_ID)
+                              REFERENCES BULK_UPDATE_TASK_STATUS(TASK_ID)
+                              )")
+  (j/db-do-commands (config/db) "CREATE INDEX idx_blk_upd_tsk_pi ON CMR_INGEST.bulk_update_task_status(PROVIDER_ID)")
+  (j/db-do-commands (config/db) "CREATE SEQUENCE CMR_INGEST.task_id_seq"))
+
+(defn down
+  "Migrates the database down from version 5."
+  []
+  (println "migrations.005-create-bulk-update-tables down...")
+  (j/db-do-commands (config/db) "DROP TABLE CMR_INGEST.bulk_update_task_status")
+  (j/db-do-commands (config/db) "DROP TABLE CMR_INGEST.bulk_update_coll_status")
+  (j/db-do-commands (config/db) "DROP SEQUENCE CMR_INGEST.task_id_seq"))


remove log

remove log


I must be tired

I must be tired

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/aamedina/clojure.asm.clang.git/'


organize namespace, log source id instead of teller source


with-out-str . explain = explain-str

with-out-str . explain = explain-str


add unit test for new-user-email message formatting.

error: pathspec 'test/metabase/email/messages_test.clj' did not match any file(s) known to git

--- test/metabase/email/messages_test.clj
+++ test/metabase/email/messages_test.clj
@@ -0,0 +1,8 @@
+(ns metabase.email.messages-test
+  (:require [expectations :refer :all]
+            [metabase.email.messages :refer :all]))
+
+
+(expect
+  "
Welcome to Metabase test!

Your account is setup and ready to go, you just need to set a password so you can login.  Follow the link below to reset your account password.

http://localhost/some/url
"
+  (send-new-user-email "test" "test@test.com" "http://localhost/some/url"))


move caches into transwarp.types ns

move caches into transwarp.types ns

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/michaelsbradleyjr/transwarp.git/'


Fix getting background check response

Fix getting background check response


Timeout is now max time between rotations, not a timeout per message.

This avoids creating a huge number of timeout objects that don't get collected
until they time out.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/cstorey/nrod.git/'


tiny code style fix

tiny code style fix

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/yantonov/paging-task.git/'


added Security Involution task

added Security Involution task

error: pathspec 'src/hackerrank/security/security_involution.clj' did not match any file(s) known to git

--- src/hackerrank/security/security_involution.clj
+++ src/hackerrank/security/security_involution.clj
@@ -0,0 +1,19 @@
+;; Security Involution
+;; https://www.hackerrank.com/challenges/security-involution/forum
+
+(ns hackerrank.security.security-involution
+  (:require [clojure.java.io :as io])
+  (:use [clojure.string :only (split join trim)]))
+
+(def input "2\n2 1")
+
+(defn parseInt [string]
+  (Integer/parseInt string))
+
+(with-in-str input
+  (let [n (parseInt (read-line))
+        numbers (concat [0](map parseInt (split (read-line) #" ")))]
+
+      (doseq [i (range 1 (inc n))]
+;;         (println i (nth numbers i))
+        (println (nth numbers (nth numbers i))))))


add with-component functionality

add with-component functionality

error: pathspec 'src/main/clojure/trellis/component.clj' did not match any file(s) known to git

--- src/main/clojure/trellis/component.clj
+++ src/main/clojure/trellis/component.clj
@@ -0,0 +1,15 @@
+(ns trellis.component
+  (:require [clojure.tools.logging :as log])
+  (:require [com.stuartsierra.component :as component])
+  (:use [mikera.cljutils.error]))
+
+(defmacro with-component
+  [[sym comp :as v] & body]
+  (when-not (and (vector? v) (== 2 (count v))) (error "with-component requires a 2-element binding vector"))
+  (when-not (symbol? sym) (error "with-component requires a symbol to bind"))
+  `(let [~sym ~comp
+         ~sym (component/start ~sym)]
+     (try
+       ~@body
+       (finally (component/stop ~sym)))))
+


cleanup

cleanup

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/wilkerlucio/youtube-looper.git/'


(3302) Actually add the puppet apply test

error: pathspec 'test/puppetlabs/puppetdb/integration/apply/fact_storage.clj' did not match any file(s) known to git

--- test/puppetlabs/puppetdb/integration/apply/fact_storage.clj
+++ test/puppetlabs/puppetdb/integration/apply/fact_storage.clj
@@ -0,0 +1,21 @@
+(ns puppetlabs.puppetdb.apply.fact-storage
+  (:require [clojure.test :refer :all]
+            [puppetlabs.puppetdb.integration.fixtures :as int]
+            [puppetlabs.puppetdb.cheshire :as json]
+            [me.raynes.fs :as fs]))
+
+(deftest ^:integration fact-storage
+  (with-open [pg (int/setup-postgres)
+              pdb (int/run-puppetdb pg {})]
+    (testing "Run puppet apply to populate the db"
+      (let [{:keys [out]} (int/run-puppet-apply pdb "notice($foo)"
+                                                {:env {"FACTER_foo" "testfoo"}})]
+        (is (re-find #"testfoo" out))))
+
+    (testing "Run again to ensure we aren't using puppetdb for the answer"
+      (let [{:keys [out]} (int/run-puppet-apply pdb "notice($foo)"
+                                                {:env {"FACTER_foo" "second test"}})]
+        (is (re-find #"second test" out))))
+
+    (testing "Check that the fact was put in puppetdb"
+      (= [:value "second test"] (int/pql-query pdb "facts [value] { name='foo' }")))))


cleanup dead code

cleanup dead code

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/tobiasbayer/lambdacd.git/'


[TH] use onto-chan

[TH] use onto-chan

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-notification-works.git/'


Started GUI

Started GUI

First version of adding menus works.

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

error: pathspec 'conexp/gui.clj' did not match any file(s) known to git

--- conexp/gui.clj
+++ conexp/gui.clj
@@ -0,0 +1,57 @@
+(ns conexp.gui
+  (:import [javax.swing JFrame JMenuBar JMenu JMenuItem]
+	   [java.awt GridLayout]
+	   [java.awt.event KeyEvent ActionListener])
+  (:use clojure.contrib.repl-utils))
+
+;;; Menus
+
+(defn make-menu
+  "Converts a hash repsenting a menu into an actual JMenu for a given frame."
+  [frame hash-menu]
+  (let [menu (JMenu. (:name hash-menu))]
+    (doseq [entry (:content hash-menu)]
+      (cond
+	(empty? entry)
+	(.addSeparator menu)
+	:else
+	(let [menu-item (JMenuItem. (:name entry))]
+	  (.addActionListener menu-item
+             (proxy [ActionListener] []
+	       (actionPerformed [evt]
+		 ((:handler entry) frame evt))))
+	  (.add menu menu-item))))
+    menu))
+
+(defn add-to-menubar
+  "Adds menubar consiting of menus to frame."
+  ([frame menus]
+     (add-to-menubar frame (JMenuBar.) menus))
+  ([frame menu-bar menus]
+     (doseq [menu (map #(make-menu frame %) menus)]
+       (.add menu-bar menu))
+     menu-bar))
+
+(defn add-additional-menus [frame menus]
+  (add-to-menubar frame (.getJMenuBar frame) menus)
+  (.setJMenuBar frame (.getJMenuBar frame))) ;; hackish
+
+(def *main-menu* {:name "Main" :content [{:name "Add Menu" ; just for fun
+					  :handler (fn [frame _]
+						     (add-additional-menus frame
+									   [{:name "?" :content []}]))}
+					 {} ; Separator
+					 {:name "Quit"
+					  :handler (fn [frame _] (.dispose frame))}]})
+(def *help-menu* {:name "Help" :content []})
+
+
+;;; Actual Conexp GUI
+
+(let [main-frame (JFrame. "conexp-clj")]
+  (defn conexp-gui []
+    (doto main-frame
+      (.setDefaultCloseOperation JFrame/DISPOSE_ON_CLOSE)
+      (.setJMenuBar (add-to-menubar main-frame [*main-menu* *help-menu*]))
+      (.setSize 1000 800)
+      (.setVisible true))))


fix move-in date at approval time

fix move-in date at approval time

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/starcity-properties/odin.git/'


cljs tests

cljs tests

error: pathspec 'test/cljs/rksm/websocket_test/l2l_test.cljs' did not match any file(s) known to git

--- test/cljs/rksm/websocket_test/l2l_test.cljs
+++ test/cljs/rksm/websocket_test/l2l_test.cljs
@@ -0,0 +1,10 @@
+(ns rksm.websocket-test.l2l-test
+  (:require-macros [cemerick.cljs.test :refer (is deftest run-tests testing test-var)])
+  (:require [cemerick.cljs.test :as t]))
+
+(deftest simple-ws-connect
+  (is (= 1 2)))
+
+(enable-console-print!)
+
+(run-tests 'rksm.websocket-test.l2l-test)


Make list pretty

Make list pretty


Future, promises, and macros example

Future, promises, and macros example

error: pathspec 'src/clojure_for_the_brave_and_true/async.clj' did not match any file(s) known to git

--- src/clojure_for_the_brave_and_true/async.clj
+++ src/clojure_for_the_brave_and_true/async.clj
@@ -0,0 +1,41 @@
+(ns clojure-for-the-brave-and-true.async)
+
+(defmacro wait
+  "Sleep `timeout` seconds before evaluating body"
+  [timeout & body]
+  `(do (Thread/sleep ~timeout) ~@body))
+
+;; What the expansion of the enqueue macro will look like:
+(comment
+  (let [saying3 (promise)]
+    (future (deliver saying3 (wait 100 "Cheerio!")))
+    @(let [saying2 (promise)]
+       (future (deliver saying2 (wait 400 "Pip pip!")))
+       @(let [saying1 (promise)]
+          (future (deliver saying1 (wait 200 "'Ello, gov'na!")))
+          (println @saying1)
+          saying1)
+       (println @saying2)
+       saying2)
+    (println @saying3)
+    saying3))
+
+;; Ideally, the macro will work like:
+(comment
+  (-> (enqueue saying (wait 200 "'Ello, gov'na!") (println @saying))
+      (enqueue saying (wait 400 "Pip pip!") (println @saying))
+      (enqueue saying (wait 100 "Cheerio!") (println @saying))))
+
+(defmacro enqueue
+  ([q concurrent-promise-name concurrent serialized]
+   `(let [~concurrent-promise-name (promise)]
+      (future (deliver ~concurrent-promise-name ~concurrent))
+      (deref ~q)
+      ~serialized
+      ~concurrent-promise-name))
+  ([concurrent-promise-name concurrent serialized]
+   `(enqueue (future) ~concurrent-promise-name ~concurrent ~serialized)))
+
+  (time @(-> (enqueue saying (wait 200 "'Ello, gov'na!") (println @saying))
+                        (enqueue saying (wait 400 "Pip pip!") (println @saying))
+                        (enqueue saying (wait 100 "Cheerio!") (println @saying))))


remove state issue code

remove state issue code


Start testing new generic code

Start testing new generic code

error: pathspec 'test/comic_reader/sites_test.clj' did not match any file(s) known to git

--- test/comic_reader/sites_test.clj
+++ test/comic_reader/sites_test.clj
@@ -0,0 +1,62 @@
+(ns comic-reader.sites-test
+  (:require [clojure.test :refer :all]
+            [comic-reader.sites :refer :all]
+            [comic-reader.scrape :as scrape]
+            [net.cgrand.enlive-html :as html]))
+
+(defn extract-comics-list-test []
+  (binding [options (read-site-options "manga-fox")]
+    (is (not= (comic-list-selector)
+              nil))
+
+    (let [html (html/html [:div {}])
+          comics (extract-comics-list html)]
+      (is (= (seq comics)
+             nil)))
+
+    (let [html (html/html-resource "test/manga_fox/comic_list.html")
+          url-list (scrape/extract-list html
+                                        (comic-list-selector)
+                                        identity)
+          comics (extract-comics-list html)]
+      (is (= (count url-list)
+             15))
+
+      (is (= (first url-list)
+             '{:tag :a,
+               :attrs
+               {:href "http://mangafox.me/manga/6mm_no_taboo/",
+                :rel "4558",
+                :class "series_preview manga_open"},
+               :content ("-6mm no Taboo")}))
+
+      (is (= clojure.core/first (link-name-normalize)))
+
+      (is (= (link->map '{:tag :a,
+                          :attrs
+                          {:href "http://mangafox.me/manga/6mm_no_taboo/",
+                           :rel "4558",
+                           :class "series_preview manga_open"},
+                          :content ("-6mm no Taboo")})
+             '{:name "-6mm no Taboo"
+               :url  "http://mangafox.me/manga/6mm_no_taboo/"}))
+
+      (is (= (comic-link-normalize '{:tag :a,
+                                     :attrs
+                                     {:href "http://mangafox.me/manga/6mm_no_taboo/",
+                                      :rel "4558",
+                                      :class "series_preview manga_open"},
+                                     :content ("-6mm no Taboo")})
+             '{:name "-6mm no Taboo",
+               :url "http://mangafox.me/manga/6mm_no_taboo/",
+               :id "6mm_no_taboo"}))
+
+      (is (= (count comics)
+             15))
+      (is (= (first comics)
+             {:name "-6mm no Taboo",
+              :url "http://mangafox.me/manga/6mm_no_taboo/",
+              :id "6mm_no_taboo"})))))
+
+(deftest unit-tests
+  (extract-comics-list-test))


Add production config file.

Add production config file.

error: pathspec 'config.clj' did not match any file(s) known to git

--- config.clj
+++ config.clj
@@ -0,0 +1,20 @@
+{:layout
+ (layout/star
+   {:radius 3.688         ; 12.1'
+    :pixel-spacing 0.02   ; 2 cm
+    :strip-pixels 240
+    :strips 6})
+
+ :display
+ (pixel-pusher)
+
+ :handler
+ (-> state/update-mode
+     middleware/mode-selector
+     (middleware/autocycle-modes (comp #{:button/press :button/repeat} :type)))
+
+ :web-options
+ {:port 8080
+  :min-threads 3
+  :max-threads 10
+  :max-queued 25}}


[WM EN] import method-based fields from CSV

These keeps imports symmetrical with exports.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-authority-works.git/'


getting rid of out of date tests

getting rid of out of date tests

--- sidecar/test/figwheel_sidecar/core_test.clj
+++ sidecar/test/figwheel_sidecar/core_test.clj
@@ -1,72 +0,0 @@
-(ns figwheel-sidecar.core-test
-  (:use figwheel-sidecar.core)
-  (:use clojure.test)
-  (:require
-   [clojure.string :as string]
-   [clojure.java.io :as io]))
-
-(deftest test-utils
-  (is (.startsWith (project-unique-id) "figwheel-sidecar--")))
-
-;; truncating to the correct server relative namspace is important
-(defn remove-resource-path-tests [st]
-    (is (= (relativize-resource-paths st)
-           ["resources" "other-resources" "dev-resources"
-            "other-resources-help/dang"]))
-
-    (is (= (relativize-resource-paths (dissoc st :resource-paths))
-           []))
-    (is (= (ns-to-server-relative-path st 'example.crazy-name)
-           "/js/compiled/out/example/crazy_name.js"))
-    (is (= (ns-to-server-relative-path st 'example.crazy_name)
-           "/js/compiled/out/example/crazy_name.js"))
-    (is (= (ns-to-server-relative-path st "example.crazy_name")
-           "/js/compiled/out/example/crazy_name.js"))
-    (is (= (ns-to-server-relative-path st "example.crazy-name")
-           "/js/compiled/out/example/crazy_name.js")))
-
-(deftest test-remove-resource-path
-  (let [root (.getCanonicalPath (io/file "."))
-        st { :http-server-root "public"
-            :output-dir "other-resources/public/js/compiled/out"
-           :resource-paths [(str root "/resources")
-                            (str root "/other-resources")
-                            (str root "/dev-resources")
-                            (str root "/other-resources-help/dang")]}]
-    (remove-resource-path-tests st)
-    (remove-resource-path-tests
-     (assoc st
-       :output-dir       "resources/public/js/compiled/out"))
-    (remove-resource-path-tests
-     (assoc st
-       :output-dir       "other-resources-help/dang/public/js/compiled/out"))
-    (remove-resource-path-tests
-     (merge st {:http-server-root "public/house"
-                :output-dir       "other-resources/public/house/js/compiled/out"}))
-
-    ;; make sure it works if not given abasolute paths
-    (remove-resource-path-tests
-     (merge st {:resource-paths [(str "resources")
-                                 (str "other-resources")
-                                 (str "dev-resources")
-                                 (str "other-resources-help/dang")] }))
-    ))
-
-
-(defn windows-pather [s]
-  (string/replace s "/" "\\"))
-
-(deftest test-remove-resource-windows-path
-  (let [root (windows-pather (.getCanonicalPath (io/file ".")))
-        st { :http-server-root "public"
-             :resource-paths [(str root "\\resources")
-                              (str root "\\other-resources")
-                              (str root "\\dev-resources")
-                             (str root "\\other-resources-help/dang")]}]
-    (is (= (remove-resource-path st "resources\\public\\js\\example\\core.js")
-           "/js/example/core.js"))
-    (is (= (remove-resource-path st "resources\\public\\css\\style.css")
-           "/css/style.css"))
-    ))
-
-#_(run-tests)


Fix indentation in handlers ns

Fix indentation in handlers ns


rev metadata helpers

rev metadata helpers


label defs section

label defs section


import ChamberException

import ChamberException


Added a helloworld post

Added a helloworld post

error: pathspec 'template/posts/2013-5-26-Hello_world.html.clj' did not match any file(s) known to git

--- template/posts/2013-5-26-Hello_world.html.clj
+++ template/posts/2013-5-26-Hello_world.html.clj
@@ -0,0 +1,7 @@
+; @layout  post
+; @title   Hello, World!
+; @tag
+
+[:p "Hello, World!"]
+
+(repeat 5 [:br])


bump version

bump version

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/ChallenHB/samsara.git/'


Purge maven-metadata.xml{.sha1|.md5} from fastly's cache

This should allow the latest version to be readable just after
deployment, and will allow us to remove special caching rules from the
fastly config for them.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/tobias/clojars-web.git/'


Fix typo; Github -> GitHub

Fix typo; Github -> GitHub


Initial version for websocket-api

Initial version for websocket-api

error: pathspec 'src/ruuvi_server/websocket_api.clj' did not match any file(s) known to git

--- src/ruuvi_server/websocket_api.clj
+++ src/ruuvi_server/websocket_api.clj
@@ -0,0 +1,178 @@
+(ns ruuvi-server.websocket-api
+   (:use
+    [lamina.core :only (enqueue named-channel sample-every receive-all siphon close on-closed map*)]
+    [aleph.http :only (wrap-aleph-handler start-http-server wrap-ring-handler)]
+    [aleph.formats :only (encode-json->string decode-json)]
+
+    compojure.core
+    compojure.response
+    ring.middleware.reload
+    ring.middleware.file
+    ring.adapter.jetty
+    [ring.util.response :only (response content-type)]
+   )
+   (:require
+     [compojure.handler :as handler]
+   )
+)
+
+(def ^{:private true} clients (atom 0))
+(def ^{:private true} received-messages (atom 0))
+
+;; stuff sent to this, is send to every client
+(def ^{:private true} broadcast-channel (named-channel :broadcast nil))
+
+;; internal channel
+(def ^{:private true} world-channel (named-channel :world nil))
+
+(def ^{:private true} trackers (atom {}))
+
+(defn- enqueue-json
+  "Converts data to JSON and sends it to channel"
+  [ch data]
+  (enqueue ch (encode-json->string data)))
+
+(defn subscribe
+  "Subscribe channel to tracker. Channel will receive traffic events from the tracker."
+  [tracker-id ch]
+  (swap! trackers (fn [old]
+                    (update-in old [tracker-id]
+                               (fn [values]
+                                 (into #{} (conj values ch))
+                                 ))))
+  )
+
+(defn unsubscribe
+  "Unsubscribe channel from tracker. Channel will stop receiving events from the tracker."
+  [tracker-id ch]
+  (swap! trackers (fn [old]
+                    (update-in old [tracker-id]
+                               (fn [values]
+                                 (disj values ch)
+                                 ))))
+  )
+
+(defn unsubscribe-all
+  "Unsubscribe channel from all trackers. Channel will stop receiving events from all trackers."
+  [ch]
+  (swap! trackers
+         (fn [old]
+           (into {}
+                 (map (fn [[tracker-id channels]]
+                        {tracker-id (disj channels ch)}
+                        ) old))))
+  )
+
+(defn- start-messaging [ch]
+  (enqueue world-channel {:t 0 :clients 0})
+  (let [clock (sample-every 5000 world-channel)]
+    (receive-all clock
+                 (fn [m] (enqueue world-channel {:t (+ (:t m) 1)
+                                                 :clients @clients
+                                                 :msgs @received-messages}) )
+                 )
+    (siphon world-channel ch)
+    )
+  )
+
+
+(defn publish-event
+  "Publish event from tracker. All subscribed clients will receive the event."
+  [tracker-id event]
+  (let [channels (@trackers tracker-id)]
+    (dorun
+     (map (fn [ch]
+            (enqueue-json ch event)
+            ) channels)
+     )))
+
+
+(defn- process-ping
+  "Process ping message. Replies with pong message."
+  [ch data]
+  (let [value (:ping data)]
+    (enqueue-json ch {:pong value})
+    )
+  )
+
+(defn- process-subscribe
+  "Process subscribe message."
+  [ch data]
+  (dorun (map (fn [tracker-id]
+                (subscribe tracker-id ch)
+                ) (:ids data)))
+  )
+
+(defn- process-unsubscribe
+  "Process unsubscribe message"
+  [ch data]
+  (dorun (map (fn [tracker-id]
+                (unsubscribe tracker-id ch)
+                ) (:ids data)))
+  )
+
+(defn- process-new-event
+  "Process new-event message. Publishes event."
+  [ch data]
+  ;; TODO store event to db
+  ;; call publish-event
+  )
+
+(defn- process-unknown-command
+  "Process unknown command. Sends error message and closes channel."
+  [ch data]
+  (enqueue-json ch {:error "unknown command"})
+  (close ch) )
+
+(defn- handle-client-message [ch incoming-data]
+  (swap! received-messages inc)
+  (try
+    (let [data (decode-json incoming-data)]
+      (cond (:ping data) (process-ping ch data)
+            (:subscribe data) (process-subscribe ch data)
+            (:unsubscribe data) (process-unsubscribe ch data)
+            (:new-event data) (process-new-event ch data)
+            :else (process-unknown-command ch data)
+            )
+      )
+    (catch Exception e
+      ;; TODO this may fail, if channel closes at right time
+      (enqueue ch (encode-json->string {:error "Not JSON data. Closing connection.",
+                                        :exception (str e)}))
+      (close ch)
+      )
+    ))
+
+(defn- close-client [ch]
+  (unsubscribe-all ch)
+  (swap! clients dec))
+
+(defn- websocket-handler [ch request]
+  (on-closed ch (fn [] (close-client ch)))
+  (swap! clients inc)
+  ;; handle-client message handles all messages from client
+  (map* (fn [data] (handle-client-message ch data)) ch)
+  ;; send broadcast-channel data to client
+  (siphon (map* encode-json->string broadcast-channel) ch)
+)
+
+(defn websocket-api-handler
+  "Ring handled that can be directly plugged into Compojure routes"
+  []
+  (wrap-aleph-handler websocket-handler))
+
+(defn websocket-api-init
+  "Init function for websocket-api."
+  []
+  (start-messaging broadcast-channel))
+
+;; testcode
+(defroutes routez
+  (GET "/" [] "some data")
+  (GET "/ws" [] (websocket-api-handler))
+)
+
+(start-http-server (wrap-ring-handler (handler/site routez))
+                   {:port 8081 :websocket true})
+
+(websocket-api-init)


Fix couch tests

Fix couch tests

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/physion/ovation-webapi.git/'


refactor

refactor

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/JetBrains/imperative-nodejs.git/'


Ensure that AffineTransform is IEquiv/IHash-able.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/cstorey/nrod.git/'


add loading prop to service entry cards

add loading prop to service entry cards


Loading gif component

Loading gif component

error: pathspec 'src/cljs/mokkameister/loading.cljs' did not match any file(s) known to git

--- src/cljs/mokkameister/loading.cljs
+++ src/cljs/mokkameister/loading.cljs
@@ -0,0 +1,5 @@
+(ns mokkameister.loading)
+
+(defn loading-gif []
+  [:div.loading
+   [:img {:src "img/loading.gif"}]])


a utility module to stick date-related fns

error: pathspec 'src/lib/cljs/dates.cljs' did not match any file(s) known to git

--- src/lib/cljs/dates.cljs
+++ src/lib/cljs/dates.cljs
@@ -0,0 +1,19 @@
+(ns dates
+  (:require [goog.date          :as goog]
+            [goog.date.relative :as rel]))
+
+(defn now [] (goog/DateTime.))
+
+(defn date [t]
+  (goog/DateTime. (if (or (string? t) (number? t)) (js/Date. t) t)))
+
+(defn millis
+  ([] (.getTime (now)))
+  ([dt]
+     (.getTime dt)))
+
+(defn relative [d]
+  (if-let [diff (rel/format (cond (number? d) d
+                                  (string? d) (js/parseInt d 10)
+                                  :else (millis d)))]
+    (if (= diff "0 minutes ago") "just now" diff)))


Adding in a Makefile.boot filename for .boot detection

error: pathspec 'samples/Makefile/filenames/Makefile.boot' did not match any file(s) known to git

--- samples/Makefile/filenames/Makefile.boot
+++ samples/Makefile/filenames/Makefile.boot
@@ -0,0 +1,159 @@
+# $NetBSD$
+
+S=	${.CURDIR}/../../../../..
+
+NOMAN=
+PROG?= boot
+NEWVERSWHAT?= "BIOS Boot"
+VERSIONFILE?= ${.CURDIR}/../version
+
+AFLAGS.biosboot.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
+
+SOURCES?= biosboot.S boot2.c conf.c devopen.c exec.c
+SRCS= ${SOURCES}
+.if !make(depend)
+SRCS+= vers.c
+.endif
+
+PIE_CFLAGS=
+PIE_AFLAGS=
+PIE_LDFLAGS=
+
+.include <bsd.own.mk>
+
+STRIPFLAG=	# nothing
+
+LIBCRT0=	# nothing
+LIBCRTI=	# nothing
+LIBCRTBEGIN=	# nothing
+LIBCRTEND=	# nothing
+LIBC=		# nothing
+
+BINDIR=/usr/mdec
+BINMODE=444
+
+.PATH:	${.CURDIR}/.. ${.CURDIR}/../../lib
+
+LDFLAGS+= -nostdlib -Wl,-N -Wl,-e,boot_start
+CPPFLAGS+= -I ${.CURDIR}/..  -I ${.CURDIR}/../../lib -I ${S}/lib/libsa
+CPPFLAGS+= -I ${.OBJDIR}
+# Make sure we override any optimization options specified by the user
+COPTS=  -Os
+
+.if ${MACHINE_ARCH} == "x86_64"
+LDFLAGS+=  -Wl,-m,elf_i386
+AFLAGS+=   -m32
+CPUFLAGS=  -m32
+LIBKERN_ARCH=i386
+KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386"
+.else
+CPUFLAGS=  -march=i386 -mtune=i386
+.endif
+
+CFLAGS+=   -mno-sse -mno-sse2 -mno-sse3
+
+COPTS+=    -ffreestanding
+CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes
+CPPFLAGS+= -nostdinc -D_STANDALONE
+CPPFLAGS+= -I$S
+
+CPPFLAGS+= -DSUPPORT_PS2
+CPPFLAGS+= -DDIRECT_SERIAL
+CPPFLAGS+= -DSUPPORT_SERIAL=boot_params.bp_consdev
+
+CPPFLAGS+= -DCONSPEED=boot_params.bp_conspeed
+CPPFLAGS+= -DCONSADDR=boot_params.bp_consaddr
+CPPFLAGS+= -DCONSOLE_KEYMAP=boot_params.bp_keymap
+
+CPPFLAGS+= -DSUPPORT_CD9660
+CPPFLAGS+= -DSUPPORT_USTARFS
+CPPFLAGS+= -DSUPPORT_DOSFS
+CPPFLAGS+= -DSUPPORT_EXT2FS
+#CPPFLAGS+= -DSUPPORT_MINIXFS3
+CPPFLAGS+= -DPASS_BIOSGEOM
+CPPFLAGS+= -DPASS_MEMMAP
+#CPPFLAGS+= -DBOOTPASSWD
+CPPFLAGS+= -DEPIA_HACK
+#CPPFLAGS+= -DDEBUG_MEMSIZE
+#CPPFLAGS+= -DBOOT_MSG_COM0
+CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
+
+# The biosboot code is linked to 'virtual' address of zero and is
+# loaded at physical address 0x10000.
+# XXX The heap values should be determined from _end.
+SAMISCCPPFLAGS+= -DHEAP_START=0x40000 -DHEAP_LIMIT=0x70000
+SAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT
+SAMISCMAKEFLAGS+= SA_USE_CREAD=yes	# Read compressed kernels
+SAMISCMAKEFLAGS+= SA_INCLUDE_NET=no	# Netboot via TFTP, NFS
+
+CPPFLAGS+=	-Wno-pointer-sign
+
+# CPPFLAGS+= -DBOOTXX_RAID1_SUPPORT
+
+I386_STAND_DIR?= $S/arch/i386/stand
+
+### find out what to use for libi386
+I386DIR= ${I386_STAND_DIR}/lib
+.include "${I386DIR}/Makefile.inc"
+LIBI386= ${I386LIB}
+
+### find out what to use for libsa
+SA_AS= library
+SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
+SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
+.include "${S}/lib/libsa/Makefile.inc"
+LIBSA= ${SALIB}
+
+### find out what to use for libkern
+KERN_AS= library
+.include "${S}/lib/libkern/Makefile.inc"
+LIBKERN= ${KERNLIB}
+
+### find out what to use for libz
+Z_AS= library
+.include "${S}/lib/libz/Makefile.inc"
+LIBZ= ${ZLIB}
+
+LDSCRIPT ?= $S/arch/i386/conf/stand.ldscript
+
+cleandir distclean: .WAIT cleanlibdir
+
+cleanlibdir:
+	-rm -rf lib
+
+LIBLIST= ${LIBI386} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} ${LIBSA}
+# LIBLIST= ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA} ${LIBZ} ${LIBKERN}
+
+CLEANFILES+= ${PROG}.tmp ${PROG}.map ${PROG}.sym vers.c
+
+vers.c: ${VERSIONFILE} ${SOURCES} ${LIBLIST} ${.CURDIR}/../Makefile.boot
+	${HOST_SH} ${S}/conf/newvers_stand.sh ${VERSIONFILE} x86 ${NEWVERSWHAT}
+
+# Anything that calls 'real_to_prot' must have a %pc < 0x10000.
+# We link the program, find the callers (all in libi386), then
+# explicitly pull in the required objects before any other library code.
+${PROG}: ${OBJS} ${LIBLIST} ${.CURDIR}/../Makefile.boot
+	${_MKTARGET_LINK}
+	bb="$$( ${CC} -o ${PROG}.sym ${LDFLAGS} -Wl,-Ttext,0 -Wl,-cref \
+	    ${OBJS} ${LIBLIST} | ( \
+		while read symbol file; do \
+			[ -z "$$file" ] && continue; \
+			[ "$$symbol" = real_to_prot ] && break; \
+		done; \
+		while \
+			oifs="$$IFS"; \
+			IFS='()'; \
+			set -- $$file; \
+			IFS="$$oifs"; \
+			[ -n "$$2" ] && echo "${I386DST}/$$2"; \
+			read file rest && [ -z "$$rest" ]; \
+		do :; \
+		done; \
+	) )"; \
+	${CC} -o ${PROG}.sym ${LDFLAGS} -Wl,-Ttext,0 -T ${LDSCRIPT} \
+		-Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} $$bb ${LIBLIST}
+	${OBJCOPY} -O binary ${PROG}.sym ${PROG}
+
+.include <bsd.prog.mk>
+KLINK_MACHINE=	i386
+.include <bsd.klinks.mk>


refac(request): fix identation in 'request.clj'

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B2W-Digital/pdg-core.git/'


missing parens.

missing parens.

--- src/metabase/driver/redshift.clj
+++ src/metabase/driver/redshift.clj
@@ -84,7 +84,7 @@
           :unix-timestamp->timestamp unix-timestamp->timestamp}
          ;; HACK ! When we test against Redshift we use a session-unique schema so we can run simultaneous tests against a single remote host;
          ;; when running tests tell the sync process to ignore all the other schemas
-         (when config/is-test?
+         (when (config/is-test?)
            {:excluded-schemas (memoize
                                (fn [_]
                                  (require 'metabase.test.data.redshift)


rework generic sql native QP to handle expanded DB

--- src/metabase/driver/generic_sql/native.clj
+++ src/metabase/driver/generic_sql/native.clj
@@ -5,10 +5,8 @@
             [clojure.tools.logging :as log]
             (korma [core :as korma]
                    db)
-            [metabase.db :refer [sel]]
             [metabase.driver :as driver]
-            [metabase.driver.generic-sql.util :refer :all]
-            [metabase.models.database :refer [Database]]))
+            [metabase.driver.generic-sql.util :refer :all]))

 (defn- value->base-type
   "Attempt to match a value we get back from the DB with the corresponding base-type`."
@@ -22,30 +20,27 @@
 (defn process-and-run
   "Process and run a native (raw SQL) QUERY."
   {:arglists '([query])}
-  [{{sql :query} :native
-    database-id :database :as query}]
-  {:pre [(string? sql)
-         (integer? database-id)]}
+  [{{sql :query} :native, database :database, :as query}]
+  {:pre [(string? sql)]}
   (log/debug "QUERY: \n"
              (with-out-str (clojure.pprint/pprint query)))
-  (try (let [database (sel :one Database :id database-id)
-             db (-> database
+  (try (let [db (-> database
                     db->korma-db
                     korma.db/get-connection)
              [columns & [first-row :as rows]] (jdbc/with-db-transaction [conn db :read-only? true]
                                                 ;; If timezone is specified in the Query and the driver supports setting the timezone then execute SQL to set it
                                                 (when-let [timezone (or (-> query :native :timezone)
                                                                         (driver/report-timezone))]
-                                                  (when-let [timezone->set-timezone-sql (:timezone->set-timezone-sql (driver/database-id->driver database-id))]
+                                                  (when-let [timezone->set-timezone-sql (:timezone->set-timezone-sql (driver/engine->driver (:engine database)))]
                                                     (log/debug "Setting timezone to:" timezone)
                                                     (jdbc/db-do-prepared conn (timezone->set-timezone-sql timezone))))
                                                 (jdbc/query conn sql :as-arrays? true))]
-         {:rows rows
+         {:rows    rows
           :columns columns
-          :cols (map (fn [column first-value]
-                       {:name column
-                        :base_type (value->base-type first-value)})
-                     columns first-row)})
+          :cols    (map (fn [column first-value]
+                          {:name      column
+                           :base_type (value->base-type first-value)})
+                        columns first-row)})
        (catch java.sql.SQLException e
          (let [^String message (or (->> (.getMessage e)     ; error message comes back like 'Column "ZID" not found; SQL statement: ... [error-code]' sometimes
                                         (re-find #"^(.*);") ; the user already knows the SQL, and error code is meaningless


scaffold pets step

scaffold pets step

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/starcity-properties/odin.git/'


Problem 0064.

Problem 0064.

error: pathspec 'src/project_euler/problem_0064.clj' did not match any file(s) known to git

--- src/project_euler/problem_0064.clj
+++ src/project_euler/problem_0064.clj
@@ -0,0 +1,108 @@
+(ns project-euler.problem_0064)
+
+
+;; All square roots are periodic when written as continued fractions and can be written in the form:
+
+;;            1
+;; √N = a0 +	----------
+;;                 1
+;;           a1 + ---------
+;;                      1
+;;  	 	           a2 +	---------
+;;                	 	 	a3 + ...
+;; For example, let us consider √23:
+
+;;                              1                   1
+;; √23 = 4 + √23 — 4 = 4 + -----------  = 4 +  ------------
+;;                              1                  √23 – 3
+;;                          ---------          1 + -------
+;;                            √23—4                   7
+;;
+;; If we continue we would get the following expansion:
+;;            1
+;; √23 = 4 + ----------
+;;                1
+;;           1 + ---------
+;;                    1
+;;               3 + ---------
+;;                        1
+;;                   1 + ---------
+;;                       8 + ......
+
+;; The process can be summarised as follows:
+
+;; It can be seen that the sequence is repeating.
+;; For conciseness, we use the notation √23 = [4;(1,3,1,8)],
+;; to indicate that the block (1,3,1,8) repeats indefinitely.
+
+;; The first ten continued fraction representations of (irrational) square roots are:
+
+;; √2=[1;(2)], period=1
+;; √3=[1;(1,2)], period=2
+;; √5=[2;(4)], period=1
+;; √6=[2;(2,4)], period=2
+;; √7=[2;(1,1,1,4)], period=4
+;; √8=[2;(1,4)], period=2
+;; √10=[3;(6)], period=1
+;; √11=[3;(3,6)], period=2
+;; √12= [3;(2,6)], period=2
+;; √13=[3;(1,1,1,1,6)], period=5
+
+;; Exactly four continued fractions, for N ≤ 13, have an odd period.
+
+;; How many continued fractions for N ≤ 10000 have an odd period?
+
+(defn square [x] (* x x))
+
+(defn int-sqrt [x]
+  (let [r  (loop [r 1]
+             (if (> (* r r) x)
+               r
+               (recur (* 2 r)) ))]
+    (loop [l (quot r 2), r r]
+      (if (> (- r l) 1)
+        (let [m (/ (+ r l) 2)]
+          (if (> (* m m) x)
+            (recur l m)
+            (recur m r)))
+        l
+        ))
+    ))
+
+(defn pgcd [a b]
+  (let [r (rem a b)]
+    (if (zero? r)
+      b
+      (recur b r))))
+
+(defn seq-cont-fract [x]
+  (let [sqrt-x (int-sqrt x)]
+    (if (== x (* sqrt-x sqrt-x))
+      [[sqrt-x nil nil]]
+      (iterate (fn [[c n d]]
+                 (let [d' (/ (- x (* d d)) n)
+                       c' (quot (+ sqrt-x d) d')
+                       n' (- (* d' c') d)]
+                   [c' d' n']))
+               [sqrt-x 1 sqrt-x]))
+    ))
+
+
+(defn search-cycle [x]
+  (loop [[[c n d] & rest-seq] (seq-cont-fract x)
+         seen-set #{}
+         cs []]
+    (if (seq rest-seq)
+      (if (get seen-set [n d])
+        (conj cs c)
+        (recur rest-seq (conj seen-set [n d]) (conj cs c)))
+      [c])))
+
+(defn solution []
+  (->> (range 10001)
+       (map search-cycle)
+       (filter #(and (> (count %) 1) (even? (count %))))
+       (count)
+       ))
+
+;;-> 1322


Lower max-threads to 50

Lower max-threads to 50

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/turbovote-http-api.git/'