forgot to add upnp back with network interface additions

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

--- src/plasma/network.clj
+++ src/plasma/network.clj
@@ -0,0 +1,60 @@
+(ns plasma.network
+  (:use [plasma util])
+  (import [org.bitlet.weupnp GatewayDiscover PortMappingEntry]
+          [java.net InetAddress NetworkInterface]))
+
+(defn gateway* []
+  (let [discoverer (GatewayDiscover.)]
+    (.discover discoverer)
+    (.getValidGateway discoverer)))
+
+; TODO: This is memoized so we don't wait for a nil gateway after already
+; trying once.  There is probably a better way to do this, but for now it works...
+(def gateway (memoize gateway*))
+
+(defrecord NetAddress [local public])
+
+(defn local-addr
+  []
+  (let [ifaces (enumeration-seq (NetworkInterface/getNetworkInterfaces))
+        addrs (flatten (map #(enumeration-seq (.getInetAddresses %)) ifaces))
+        hosts (map #(apply str (drop 1 (.toString %))) addrs)
+        ips (filter #(not (nil? (re-find #"[0-9]+\.[0-9]+\.[0-9]+\.[0-9]" %))) hosts)
+        me (first (filter #(not (= "127.0.0.1" %)) ips))]
+    me))
+
+(defn addr-info
+  ([] (addr-info (gateway)))
+  ([g]
+   (if g
+     (NetAddress.
+      (.getLocalAddress g)
+      (.getExternalIPAddress g))
+     (let [local (local-addr)]
+       (NetAddress. local local)))))
+
+(defn public-url
+  [port]
+  (plasma-url (:public (addr-info)) port))
+
+(defn set-port-forward
+  ([port service]
+   (set-port-forward port "TCP" service))
+  ([port proto service]
+   (let [entry (PortMappingEntry.)
+         g (gateway)
+         {:keys [local-addr public-addr]} (addr-info)
+         addr (.getHostAddress local-addr)]
+     (if-not (.getSpecificPortMappingEntry g port proto entry)
+       (.addPortMapping g port port addr proto service)))))
+
+(defn clear-port-forward
+  ([port]
+   (clear-port-forward port :tcp))
+  ([port proto]
+   (let [g (gateway)
+         proto (cond
+                 (string? proto) (.toUpperCase proto)
+                 (keyword? proto) (.toUpperCase (name proto)))]
+     (.deletePortMapping g port proto))))
+


corrections: or -> c/or ; getProperty -> getenv

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/shen.clj.git/'


Add createbooks .cls

Add createbooks .cls

error: pathspec 'src_cljs/bookmarks/createbookmarks.cljs' did not match any file(s) known to git

--- src_cljs/bookmarks/createbookmarks.cljs
+++ src_cljs/bookmarks/createbookmarks.cljs
@@ -0,0 +1,34 @@
+(ns bookmarks.createbookmarks)
+(defn row [label input]
+  [:div.row
+   [:div.col-md-2 [:label label]]
+   [:div.col-md-5 input]])
+(defn radio [label name value]
+  [:div.radio
+   [:label
+    [:input {:field :radio :name name :value value}]
+    label]])
+
+(defn input [label type id]
+  (row label [:input.form-control {:field type :id id}]))
+
+
+(defn bookmark-template []
+  [:div.form-group
+   [:div (input "Title" :text :title)]
+   [:div  (input "URL" :text :url)]
+   [:div (input "Tags" :text :tags)]
+   [:div  (input "Description":text :description)]
+   ])
+
+(defn page [body]
+  (fn []
+    [:div
+     [:div.padding]
+     [:div.page-header [:h1 "Book Marks"]]
+     [bookmark-template]
+     [:input {:type "button" :value "Save"
+              :class "btn btn-primary" }]
+     [:div.padding]
+     [:div.page-footer [:h6 "Copyright ©2015 A TechnoIdentity Creations — All Rights Reserved."]]
+     ]))


resolving conflict

resolving conflict

--- support/src/figwheel/core.clj
+++ support/src/figwheel/core.clj
@@ -1,8 +1,9 @@
 (ns figwheel.core
   (:require
+   [cljs.compiler]
    [compojure.route :as route]
-   [cljs.compiler]
    [compojure.core :refer [routes GET]]
+   [ring.util.response :refer [resource-response]]
    [org.httpkit.server :refer [run-server with-channel on-close on-receive send! open?]]
    [watchtower.core :as wt :refer [watcher compile-watcher watcher* ignore-dotfiles file-filter extensions]]
    [clojure.core.async :refer [go-loop <!! <! chan put! sliding-buffer timeout]]
@@ -263,7 +264,11 @@

 (defn start-static-server [{:keys [js-dirs http-server-root] :as opts}]
   (let [http-s-root (or http-server-root "public")]
-    (start-server (merge opts {:ring-handler (route/resources "/" {:root http-s-root})
+    (start-server (merge opts {:ring-handler
+                               (routes
+                                (GET "/" [] (resource-response "index.html" {:root http-s-root}))
+                                (route/resources "/" :root http-s-root)
+                                (route/not-found "
Page not found
"))
                                :http-server-root http-s-root}))))

 (defn stop-server [{:keys [http-server]}]


test dir

test dir

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

--- test/otp_api_proxy/core_test.clj
+++ test/otp_api_proxy/core_test.clj
@@ -0,0 +1,7 @@
+(ns otp-api-proxy.core-test
+  (:require [clojure.test :refer :all]
+            [otp-api-proxy.core :refer :all]))
+
+(deftest a-test
+  (testing "FIXME, I fail."
+    (is (= 1 1))))


Hack to rescue broken netchan messages

Hack to rescue broken netchan messages

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/terrancesnyder/engulf.git/'


add hardcoded move-out components to admin UI

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/'


[WM] update tests

[WM] update 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/democracyworks/election-notification-works.git/'


Added clojure script abou the presentation WTF is a Monad? by Uncle Bob

error: pathspec 'Clojure/wtf-is-a-monad.clj' did not match any file(s) known to git

--- Clojure/wtf-is-a-monad.clj
+++ Clojure/wtf-is-a-monad.clj
@@ -0,0 +1,159 @@
+(use 'clojure.algo.monads)
+
+;----------------------
+; Monads introduction
+;----------------------
+
+(defn f []
+  (let [a 1
+        b (+ a 1)
+        c (+ a b)]
+    (* a b c)))
+
+(println "f:" (f))
+
+(defn ff []
+  ((fn [a]
+     ((fn [b]
+        ((fn [c]
+           (* a b c))
+         (+ a b)))
+     (+ a 1)))
+   1))
+
+(println "ff:" (ff))
+
+(defn lt [v f] (f v))
+
+(defn fff []
+  (lt 1
+      (fn [a]
+        (lt (+ 1 a)
+            (fn [b]
+              (lt (+ a b)
+                  (fn [c]
+                    (* a b c))))))))
+
+(println "fff:" (fff))
+
+;----------------------
+; Identity monad
+;----------------------
+
+(defmonad let-m
+  [m-bind (fn [v f] (f v))
+   m-result identity])
+
+(defn mf []
+  (domonad let-m [a 1
+                  b (+ 1 a)
+                  c (+ a b)]
+           (* a b c)))
+
+(println "mf:" (mf))
+
+;----------------------
+; Maybe monad
+;----------------------
+
+(defn fragile [a b c]
+  (+ a b c))
+
+(println "fragile-------------")
+(println (fragile 1 2 3))
+;(println (fragile 1 nil 2)) ; blow up!
+
+(try
+  (println (fragile 1 nil 2))
+  (catch Exception e
+    (println "OUCH! " (-> e .getClass .getName))))
+
+(println "safe---------------")
+
+(defmonad no-nil-m
+  [m-result identity
+   m-bind (fn [mv f]
+            (if (nil? mv)
+              nil
+              (f mv)))])
+
+(defn safe-fragile [a b c]
+  (domonad no-nil-m
+           [safe-a a
+            safe-b b
+            safe-c c]
+           (fragile safe-a safe-b safe-c)))
+
+(println (safe-fragile 1 2 3))
+(println (safe-fragile 1 nil 3))
+
+(def lifted-safe-fragile
+  (with-monad
+    no-nil-m
+    (m-lift 3 fragile)))
+
+(println "lifted-safe---------------")
+
+(println (lifted-safe-fragile 1 2 3))
+(println (lifted-safe-fragile 1 nil 3))
+
+(println "done---------------")
+
+;----------------------
+; Dot monad
+;----------------------
+
+(defmonad dot-m
+  [m-bind
+     (fn [mv f]
+       (f (count mv)))
+   m-result
+     (fn [n]
+       (apply str (repeat n ".")))])
+
+(def add-dots
+  (with-monad dot-m (m-lift 2 +)))
+(def mul-dots
+  (with-monad dot-m (m-lift 2 *)))
+(def sub-dots
+  (with-monad dot-m (m-lift 2 -)))
+(def div-dots
+  (with-monad dot-m (m-lift 2 /)))
+
+(def dcd
+  (with-monad dot-m (m-lift 2 (fn [t u] (+ u (* t 10))))))
+
+(println "           5    10   15   20   25   30   35")
+(println "       ....:....:....:....:....:....:....:")
+(println "2+4=6 " (add-dots ".." "...."))
+(println "3*4=12" (mul-dots "..." "...."))
+(println "5-2=3 " (sub-dots "....." ".."))
+(println "35    " (dcd "..." "....."))
+
+;----------------------
+; List monad
+;----------------------
+
+(defmonad list-m
+  [m-bind (fn [mv f] (apply concat (map f mv)))
+   m-result (fn [v] (list v))])
+
+(println "monad:"
+         (domonad list-m
+                  [x [1 2 3]
+                   y [4 5 6]]
+                  (+ x y)))
+
+; list comprehensions are just the sequence monad
+(println "for:  "
+         (for
+           [x [1 2 3]
+            y [4 5 6]]
+           (+ x y)))
+
+(def mul-list
+  (with-monad list-m
+              (m-lift 2 *)))
+
+(println "lift: "
+         (mul-list [1 2 3] [4 5 6]))


let? helper macro

let? helper macro

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/'


put cache defs in their own section

put cache defs in their own section


Working on 0108...

Working on 0108...

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

--- src/project_euler/problem_0108.clj
+++ src/project_euler/problem_0108.clj
@@ -0,0 +1,164 @@
+(ns project-euler.problem_0108
+  (:require [clojure.math.combinatorics :as combo]))
+
+;; n the following equation x, y, and n are positive integers.
+
+;; 1   1   1
+;; - + - = -
+;; x   y   n
+
+;; For n = 4 there are exactly three distinct solutions:
+
+;; 1    1   1
+;; - + -- = -
+;; 5   20   4
+
+;; 1    1   1
+;; - + -- = -
+;; 6   12   4
+
+;; 1   1   1
+;; - + - = -
+;; 8   8   4
+
+;; What is the least value of n for which the number of distinct solutions exceeds one-thousand?
+
+;; NOTE: This problem is an easier version of Problem 110;
+;; it is strongly advised that you solve this one first
+
+(defn sol-optic-equation [m n k]
+  [(* k m (+ m n))
+   (* k n (+ m n))
+   (* k m n)])
+
+(defn fn-gen-coprimes [mns]
+  (mapcat (fn [[m n]]
+            [[(- (* 2 m) n) m]
+             [(+ (* 2 m) n) m]
+             [(+ m (* 2 n)) n]])
+          mns))
+
+(defn gen-coprimes [p-max]
+  (->>
+   (loop [mns [[2 1] [3 1]]
+          cps []]
+     (let [mns' (filter #(<= (apply * %) p-max) mns)]
+       (if (seq mns')
+         (recur (fn-gen-coprimes mns') (vec (concat cps mns')))
+         cps)))
+   (sort-by #(apply * %))))
+
+
+(defn coprimes-by-product [p-max]
+  (->> (gen-coprimes p-max)
+       (group-by #(apply * %))
+       ;;(sort-by #(Math/pow (first %) (/ (count (second %)))))
+       ))
+
+(def the-first-primes
+  [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97])
+
+(defn search-solution [p-max]
+  (let [cps (coprimes-by-product p-max)]
+    (->> the-first-primes
+         (take 2)
+         ((fn [ps] (mapcat (fn [n] (combo/combinations
+                                    (flatten (repeat n ps))
+                                    n ))
+                           (range 1 11))))
+         ;;(remove empty?)
+         (map #(apply * %))
+         (filter #(< % p-max))
+         (sort)
+         (mapcat cps)
+         (map (fn [[m n]] (sol-optic-equation m n 1)))
+         ;;(map count)
+         ;;(reduce +)
+
+         )))
+
+;; Il faudrait trouver le ppcm de 334 nombres (coprimes)
+
+(defn prime-factors [n p-max]
+  (->> the-first-primes
+       (take n)
+       (mapcat (fn [p]
+                 (loop [ps [] pp p]
+                   (if (> pp p-max)
+                     ps
+                     (recur (conj ps p) (* pp p))))))
+       ))
+
+(defn count-products [n p-max]
+  (let [pfs (prime-factors n p-max)
+        cnt (->> pfs
+                 (combo/subsets)
+                 (remove empty?)
+                 (count)
+                 )
+        lcm (reduce *' pfs)]
+    [cnt lcm pfs]))
+
+(defn count-products2 [pfs-map]
+  (let [pfs (->> pfs-map
+                 (mapcat (fn [[p n]] (repeat n p))))
+        p   (reduce * pfs)
+        cps (coprimes-by-product  p)
+        ]
+    pfs
+    [p
+     (->> pfs
+          (combo/subsets)
+          (remove empty?)
+          (map #(apply * %))
+          (mapcat cps)
+          ;;(set)
+          (count)
+          ;; (mapcat (fn [[m n]] [(sol-optic-equation m n (/ p m n))
+          ;;                      (sol-optic-equation n m (/ p m n))]))
+          ;; (set)
+          ;; (count)
+          )]
+    ))
+
+(defn best-lcm [pfs-map]
+  (let [pfs (->> pfs-map
+                 (mapcat (fn [[p n]] (repeat n p))))]
+    (->> pfs
+         (combo/count-subsets)
+         )
+    )
+  )
+
+(defn search-best-prime-factors []
+  (->> (range 3 7)
+       (map (fn [n]
+              (loop [l 5 h 5000]
+                ;;(println l h)
+                (if (<= (- h l) 1)
+                  [n h (count-products n h)]
+                  (let [m (quot (+ l h) 2)
+                        [cnt _ _] (count-products n m)]
+                    (if (> cnt 333)
+                      (recur l m)
+                      (recur m h)))))))
+       (sort-by (fn [[n p-max [cnt lcm]]] lcm))
+       ))
+
+
+(defn check-solution []
+  (let [[n p-max [cnt lcm pfs]] (first (search-best-prime-factors))
+        cps (coprimes-by-product 1000)]
+    (->> pfs
+         (combo/subsets)
+         (remove empty?)
+         (map #(apply * %))
+         (sort)
+         (take-while #(< % 1000))
+         (mapcat cps)
+         (count)
+         )
+    ))
+
+(defn solution []
+  (search-best-prime-factors))


when if ordez

when if ordez

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/'


move several funcs directly into *metawarp* map


add protocols examples

add protocols examples

source: http://davedellacosta.com/cljs-protocols

error: pathspec 'src/thinking/protocols.cljc' did not match any file(s) known to git

--- src/thinking/protocols.cljc
+++ src/thinking/protocols.cljc
@@ -0,0 +1,164 @@
+(ns thinking.protocols)
+
+(defprotocol IFoo
+  (foo [this])
+  (bar [this]))
+
+(deftype Foo1 []
+  IFoo
+  (foo [this] (println "Foo1"))
+  (bar [this] (println "Bar1")))
+
+(deftype Foo2 []
+  IFoo
+  (foo [this] (println "Foo2"))
+  (bar [this] (println "Bar2")))
+
+;; (foo (Foo1.))
+
+;; (foo (Foo2.))
+
+(deftype Foo [])
+(deftype IncompatibleBar [])
+
+(defprotocol ExpressYourself
+  (foos-and-bars-in-harmony [this]))
+
+(extend-type Foo
+  ExpressYourself
+  (foos-and-bars-in-harmony [this] "I am a foo!"))
+
+(extend-type IncompatibleBar
+  ExpressYourself
+  (foos-and-bars-in-harmony [this] "I am an incompatible bar!"))
+
+(defprotocol Sushi
+  (wash-my-hands [this])
+  (eat-sushi [this]))
+
+(defn deal-with-sushi [eater]
+  (wash-my-hands eater)
+  (eat-sushi eater))
+
+(deftype NeverEatenSushiBeforeAmerican []
+  Sushi
+  (wash-my-hands [this]
+    (println "I would if I was actually going to eat that raw fish."))
+  (eat-sushi [this]
+    (println "Well, I guess I'll try the salmon")))
+
+(deftype American []
+  Sushi
+  (wash-my-hands [this]
+    (println "Er, where's the sink?"))
+  (eat-sushi [this]
+    (println "Hey, I'm hip, I'll use chopsticks!")))
+
+(deftype Japanese []
+  Sushi
+  (wash-my-hands [this]
+    (println "Oshibori for the win."))
+  (eat-sushi [this]
+    (println "Actually dude we just use our fingers.")))
+
+;; (deal-with-sushi (NeverEatenSushiBeforeAmerican.))
+
+;; (deal-with-sushi (American.))
+
+;; (deal-with-sushi (Japanese.))
+
+(deftype Dog []
+  Sushi
+  (wash-my-hands [this]
+    (println "Not even sure why I implemented this function"))
+  (eat-sushi [this]
+    (println "Get food in mouth now")))
+
+;; (deal-with-sushi (Dog.))
+
+
+(defrecord Foo3 [field1 field2]
+  IFoo
+  (foo [this] (println "Foo3, field1: " field1))
+  (bar [this] (println "Bar3, field2: " field2)))
+
+(def foo3 (Foo3. 1 2))
+
+(def quick-foo
+  (reify
+    IFoo
+    (foo [this] (println "Quick, gimme a foo!"))))
+
+;; (foo quick-foo)
+
+;; Expression Problem
+
+(defprotocol IFoo
+  (foo [this]))
+
+(deftype FooItAgain []
+  IFoo
+  (foo [this] (println "same old foo.")))
+
+(defprotocol INewFoo
+  (a-new-fn [this]))
+
+(extend-type FooItAgain
+  INewFoo
+  (a-new-fn [this] (println "realized I needed this!")))
+
+;; (foo (FooItAgain.))
+
+;; (a-new-fn (FooItAgain.))
+
+(deftype YetAnotherFoo []
+  IFoo
+  (foo [this] (println "yep.")))
+
+(deftype FooMeToTheMoon []
+  IFoo
+  (foo [this] (println "...")))
+
+(extend-protocol INewFoo
+  YetAnotherFoo
+  (a-new-fn [this] (println "need it here too."))
+
+  FooMeToTheMoon
+  (a-new-fn [this] (println "...and here.")))
+
+;; (a-new-fn (YetAnotherFoo.))
+;; (a-new-fn (FooMeToTheMoon.))
+
+;; specify
+
+(defprotocol IForwardsLister
+  (list-forwards [this]))
+
+(defprotocol IBackwardsLister
+  (list-backwards [this]))
+
+(defrecord DefaultForwardsLister [coll]
+  IForwardsLister
+  (list-forwards [this] (println "forwards: " coll)))
+
+(defn make-string-lister [s]
+  #?(:cljs
+     (specify (DefaultForwardsLister. s)
+       IBackwardsLister
+       (list-backwards [this]
+         (println "backwards: " (clojure.string/join "" (-> this first val reverse)))))))
+
+(defn make-list-lister [l]
+  #?(:cljs
+     (specify (DefaultForwardsLister. l)
+       IBackwardsLister
+       (list-backwards [this]
+         (println "backwards: " (clojure.string/join "" (-> this first val reverse)))))))
+
+(def sl (make-string-lister "My string."))
+(def ll (make-list-lister '(1 2 3 4)))
+
+;; (list-forwards sl)
+;; (list-forwards ll)
+;; (list-backwards sl)
+;; (list-backwards ll)


Enjoy REPL driven development with `(start!)` and `(stop!)`

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/email-works.git/'


handler for food lookup

handler for food lookup

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/expez/jada.git/'


Update manual_coaching.clj

Update manual_coaching.clj

Accidental commit reverted.

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/couragelabs/coachbot.git/'


Switch to Ryan's comp functions

Switch to Ryan's comp functions

--- src/yalp/core.clj
+++ src/yalp/core.clj
@@ -22,17 +22,32 @@
                            "Zad1-cGu7kaKbxfUG8AO8bWJbAE"
                            "29MHABVcD9r6Y8SEfhsR_m00G_wpd8kG"
                            "H0_wVL_mo0T86jDwq90l2ywFqYo"))
+(defn large->small
+  [v1 pop1 v2 pop2]
+  (- v1 (long (Math/log (* (/ pop1 pop2)
+                           (Math/pow Math/E (* Math/E v2)))))))
+
+(defn small->large
+  [v1 pop1 v2 pop2]
+  (- v1 (long (/ (Math/log (* (/ pop1 pop2)
+                              (Math/pow (double v2) Math/E)))
+                 Math/E))))
+

 (defn city-comp
   [city1 pop1 city2 pop2]
-  (->> (reduce-kv (fn [a label value]
-                    (let [other-val (or (get city2 label) 0)]
-                      (conj a [label (- (/ (or value 0) pop1) (/ other-val pop2))])))
-                  [] city1)
-       (sort-by second)
-       reverse
-       (map first)
-       (take 5)))
+  (let [eq (if (> pop1 pop2)
+             large->small
+             small->large)]
+    (->> (reduce-kv (fn [a label value]
+                      (let [value (or value 0)
+                            other-val (or (get city2 label) 0)]
+                        (conj a [label (eq value pop1 other-val pop2)])))
+                    [] city1)
+         (sort-by second)
+         reverse
+         (map first)
+         (take 5))))

 (defn cats-for-city
   [city categories]


Add some wrappers ontop of the sesame registry of parsers.

This allows you to force content negotiation for certain formats and not
others by removing parsers from the global registry.

error: pathspec 'src/rdf-repository/grafter/rdf/repository/registry.clj' did not match any file(s) known to git

--- src/rdf-repository/grafter/rdf/repository/registry.clj
+++ src/rdf-repository/grafter/rdf/repository/registry.clj
@@ -0,0 +1,114 @@
+(ns grafter.rdf.repository.registry
+  "Namespace containing functions to manage the global registry of
+  Sesame parsers.
+
+  Normally you should not need to adjust the default global
+  registries, however if you need tighter control over what
+  serialisation format is negotiated on a SPARQL endpoint; for example
+  if the endpoint you are talking to has a serialisation bug then you
+  can force the use of different parser by removing the problematic
+  one.
+
+  Be warned though, these registries apply globally (process wide), so
+  altering them may have unintended consequences."
+  (:require [clojure.string :as str]
+            [clojure.tools.logging :as log])
+  (:import [drafter.rdf DrafterSPARQLRepository]
+           [java.nio.charset Charset]
+           [org.openrdf.rio RDFParserRegistry RDFFormat]
+           [org.openrdf.query.resultio TupleQueryResultFormat BooleanQueryResultFormat
+            TupleQueryResultParserRegistry
+            BooleanQueryResultParserRegistry]
+           [org.openrdf.query.resultio.text.csv SPARQLResultsCSVParserFactory]))
+
+
+(defn parser-registries
+  "Returns a map of the low level sesame parser registries associated
+  with their corresponding query-type. You should normally call
+  registered-parser-factories which will return you a representation
+  of this information."
+  []
+  {:select (TupleQueryResultParserRegistry/getInstance)
+   :construct (RDFParserRegistry/getInstance)
+   :ask (BooleanQueryResultParserRegistry/getInstance)})
+
+(defn registered-parser-factories
+  "Returns the sesame registered query parser factories associated
+  with their corresponding query-type.
+
+  These factories define the parsers used for content negotiation
+  inside sesame."
+  []
+  (let [setify-factories (fn [r] (set (map #(class (.get r %)) (.getKeys r))))]
+    (apply merge
+           (for [[q-type reg] (parser-registries)]
+             {q-type (setify-factories reg)}))))
+
+(defn register-parser-factory!
+  "Takes a query-type keyword and a parser factory class and registers
+  it with sesame."
+  [query-type factory-klass]
+  (let [registry (query-type (parser-registries))]
+    (.add registry (.newInstance factory-klass))))
+
+(defn clear-registry!
+  "Clears all registered query-parsers for the specified query-type."
+  [query-type]
+  (let [registry (query-type (parser-registries))]
+    (doseq [pf (seq (.getAll registry))]
+      (.remove registry pf))))
+
+(defn register-parser-factories!
+  "Takes a map from query-type (:select :construct or :ask) to the
+  sesame Parser Factory class and registers the parsers with the
+  appropriate sesame registries.
+
+  This works with the same data representation returned by
+  registered-parser-factories."
+  [reg-data]
+  (let [registries (parser-registries)]
+    (doseq [[query-type reg] registries]
+      (clear-registry! query-type))
+
+    (doseq [[query-type factories] reg-data
+            factory factories]
+      (register-parser-factory! query-type factory))))
+
+(comment
+  ;; usage examples
+
+  ;; Use registered-parser-factories to query the global registry and
+  ;; return the set of registered parsers for each query type
+
+  (registered-parser-factories) ;; =>
+
+  {:select #{org.openrdf.query.resultio.sparqlxml.SPARQLResultsXMLParserFactory
+             org.openrdf.query.resultio.text.csv.SPARQLResultsCSVParserFactory
+             org.openrdf.query.resultio.sparqljson.SPARQLResultsJSONParserFactory
+             org.openrdf.query.resultio.text.tsv.SPARQLResultsTSVParserFactory
+             org.openrdf.query.resultio.binary.BinaryQueryResultParserFactory},
+   :construct #{org.openrdf.rio.ntriples.NTriplesParserFactory
+                org.openrdf.rio.trix.TriXParserFactory
+                org.openrdf.rio.jsonld.JSONLDParserFactory
+                org.openrdf.rio.trig.TriGParserFactory
+                org.openrdf.rio.binary.BinaryRDFParserFactory
+                org.openrdf.rio.n3.N3ParserFactory
+                org.openrdf.rio.rdfjson.RDFJSONParserFactory
+                org.openrdf.rio.rdfxml.RDFXMLParserFactory
+                org.openrdf.rio.nquads.NQuadsParserFactory},
+   :ask #{org.openrdf.query.resultio.sparqljson.SPARQLBooleanJSONParserFactory
+          org.openrdf.query.resultio.text.BooleanTextParserFactory
+          org.openrdf.query.resultio.sparqlxml.SPARQLBooleanXMLParserFactory}}
+
+
+  ;; Once you have the datastructure above, you can adjust it as
+  ;; desired and reset the registries e.g.
+
+  (let [updated-registries (update (registered-parser-factories)
+                                   ;; Force removal of TurtleParser
+                                   :construct #(disj % org.openrdf.rio.turtle.TurtleParserFactory))]
+
+    ;; reset the registered parsers
+    (register-parser-factories! updated-registries))
+
+  )


insert-map-into-db

insert-map-into-db

fatal: unable to access 'https://github.com/mstang/pathdatabase.git/': The requested URL returned error: 403


Code faciliating reconnecting for #42

Code faciliating reconnecting for #42

--- Clojure/src/ambly/repl/jsc.clj
+++ Clojure/src/ambly/repl/jsc.clj
@@ -97,6 +97,18 @@
           (.removeServiceListener mdns-service reg-type service-listener)
           (.close mdns-service))))))

+(defn resolve-bonjour [bonjour-name timeout]
+  (let [reg-type "_http._tcp.local."
+        mdns-service (JmDNS/create)]
+    (try
+      (let [info (.getServiceInfo mdns-service reg-type bonjour-name timeout)]
+        (when info
+          {:address (.getAddress info)
+           :port    (.getPort info)}))
+      (finally
+        (future
+          (.close mdns-service))))))
+
 (defn socket [host port]
   (let [socket (Socket. host port)
         in     (io/reader socket)
@@ -230,10 +242,23 @@

 (defn- set-up-socket
   [repl-env opts address port]
+  (when-let [socket @(:socket repl-env)]
+    (close-socket socket))
   (reset! (:socket repl-env)
     (socket address port))
   ;; Start dedicated thread to read messages from socket
   (start-reading-messages repl-env opts))
+
+(defn reconnect [repl-env opts]
+  ((print-fn opts) "Reconnecting ...")
+  (let [bonjour-name @(:bonjour-name repl-env)
+        endpoint (resolve-bonjour bonjour-name 15000)]
+    (if endpoint
+      (let [endpoint-address (.getHostAddress (:address endpoint))
+            endpoint-port (:port endpoint)]
+        (mount-webdav repl-env bonjour-name endpoint-address endpoint-port)
+        (set-up-socket repl-env opts endpoint-address (dec endpoint-port)))
+      ((print-fn opts) "Failed to reconnect."))))

 (defn setup
   [repl-env opts]
@@ -242,10 +267,12 @@
           [bonjour-name endpoint] (discover-and-choose-device (:choose-first-discovered (:options repl-env)) opts)
           endpoint-address (.getHostAddress (:address endpoint))
           endpoint-port (:port endpoint)
+          _ (reset! (:bonjour-name repl-env) bonjour-name)
           webdav-mount-point (mount-webdav repl-env bonjour-name endpoint-address endpoint-port)
           output-dir (io/file webdav-mount-point)
           env (ana/empty-env)
-          core (io/resource "cljs/core.cljs")]
+          core (io/resource "cljs/core.cljs")
+          reconnect-fn (partial reconnect repl-env opts)]
       ((println-fn opts) "\nConnecting to" (bonjour-name->display-name bonjour-name) "...\n")
       (set-up-socket repl-env opts endpoint-address (dec endpoint-port))
       (when (= "true" (:value (jsc-eval repl-env "typeof cljs === 'undefined'")))
@@ -306,7 +333,7 @@
       (tear-down repl-env)
       (throw t))))

-(defrecord JscEnv [socket response-promise webdav-mount-point options]
+(defrecord JscEnv [response-promise bonjour-name webdav-mount-point socket options]
   repl/IReplEnvOptions
   (-repl-options [this]
     {:require-foreign true})
@@ -340,7 +367,7 @@
     (tear-down repl-env)))

 (defn repl-env* [options]
-  (JscEnv. (atom nil) (atom nil) (atom nil) options))
+  (JscEnv. (atom nil) (atom nil) (atom nil) (atom nil) options))

 (defn repl-env
   [& {:as options}]


Add cljs wrapper on vendor

Add cljs wrapper on vendor

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

--- src/parse_names/core.cljs
+++ src/parse_names/core.cljs
@@ -0,0 +1,12 @@
+(ns parse-names.core
+  (:require [parse-names.vendor :as v]))
+
+(defn parse-name [name]
+  (let [name-obj (v/parse name)]
+    (->> {:first-name (.-firstName name-obj)
+          :last-name (.-lastName name-obj)
+          :leading-initial (.-salutation name-obj)
+          :suffix (.-suffix name-obj)
+          :middle-name (.-initials name-obj)}
+         (filter (fn [[k v]] (not (empty? v))))
+         (into {}))))


Add web NS tests, mostly for routes

Add web NS tests, mostly for routes

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

--- test/doctopus/web_test.clj
+++ test/doctopus/web_test.clj
@@ -0,0 +1,51 @@
+(ns doctopus.web-test
+  (:require [clojure.edn :as edn]
+            [clojure.java.io :as io]
+            [clojure.test :refer :all]
+            [compojure.core :refer [context]]
+            [doctopus.configuration :refer [docs-uri-prefix]]
+            [doctopus.db :as db]
+            [doctopus.doctopus.head :as h]
+            [doctopus.doctopus :refer [->Doctopus load-routes bootstrap-heads]]
+            [doctopus.doctopus.tentacle :as t]
+            [doctopus.test-database :refer [schema-only-fixture]]
+            [doctopus.test-utilities :as utils]
+            [doctopus.web :as web]))
+
+(use-fixtures :once schema-only-fixture)
+
+(def test-map-props
+  (h/parse-tentacle-config-map
+   (edn/read-string (slurp (io/resource "test/heads/test/doctopus-test.edn")))))
+
+(def one-head (h/map->Head {:name "test"}))
+(def one-tentacle (t/map->Tentacle test-map-props))
+(def stunt-doctopus (->Doctopus {} {}))
+
+(deftest document-routes-test
+  (db/save-head! one-head)
+  (db/save-tentacle! one-tentacle)
+  (db/create-mapping! one-head one-tentacle)
+  (bootstrap-heads stunt-doctopus)
+  (testing "Doctopus document routes"
+    (let [ctx-str (str "/" docs-uri-prefix)
+          routes (context ctx-str [] (load-routes stunt-doctopus))
+          response (utils/fake-request routes :get "/docs/doctopus-test/index.html")]
+      (is (utils/truthy? (:body response)))
+      (is (= "text/html" ((:headers response) "Content-Type")))
+      (is (= 200 (:status response))))))
+
+(deftest routes-test
+  (testing "Tests against base, unwrapped doctopus-routes"
+    (let [routes (web/create-application web/doctopus-routes)
+          requester (partial utils/fake-request routes)]
+      (is (= 200 (:status (requester :get "/"))))
+      (is (= 200 (:status (requester :get "/index.html"))))
+      (is (= 200 (:status (requester :get "/heads"))))
+      (is (= 200 (:status (requester :get "/heads/doctopus-test"))))
+      (is (= 200 (:status (requester :get "/add-head"))))
+      (is (= 200 (:status (requester :get "/add-tentacle"))))
+      ;; These two 403. Huh. Not... perfectly sure what to do.
+      ;; (is (= 200 (:status (requester :post "/add-tentacle"))))
+      ;; (is (= 200 (:status (requester :post "/add-head"))))
+      )))


working solution

working solution

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

--- src/4clojure/intoCamelCase.clj
+++ src/4clojure/intoCamelCase.clj
@@ -0,0 +1,69 @@
+;; intoCamelCase
+;; http://www.4clojure.com/problem/102
+;; Difficulty:	Medium
+;; Topics:	strings
+
+;; When working with java, you often need to create an object with fieldsLikeThis, but you'd rather work with a hashmap that has :keys-like-this until it's time to convert. Write a function which takes lower-case hyphen-separated strings and converts them to camel-case strings.
+
+(defn __ [s]
+  (let [ss (clojure.string/split s #"-")
+      f (first ss)
+      r (rest ss)
+      rc (map clojure.string/capitalize r)]
+    (apply str (concat f rc))))
+
+(= (__ "something") "something")
+
+(= (__ "multi-word-key") "multiWordKey")
+
+(= (__ "leaveMeAlone") "leaveMeAlone")
+
+
+(split-with (partial = \-)  "multi-word-key")
+
+(let [ss (clojure.string/split "multi-word-key" #"-")
+      f (first ss)
+      r (rest ss)
+      rc (map clojure.string/capitalize r)]
+  (apply str (concat f rc)))
+
+
+;; copy paste solution
+(fn __ [s]
+  (let [ss (clojure.string/split s #"-")
+      f (first ss)
+      r (rest ss)
+      rc (map clojure.string/capitalize r)]
+    (apply str (concat f rc))))
+
+
+;; others
+;; _artem_uv's solution:
+#(apply str (into [(first (clojure.string/split % #"-"))] (map clojure.string/capitalize  (rest (clojure.string/split % #"-")))))
+
+;; _pcl's solution:
+(fn [s]
+  (letfn
+    [(ucfirst [w] (apply str (-> w first str .toUpperCase) (rest w)))]
+      (let
+        [words (re-seq #"[a-zA-Z]+" s)]
+          (apply str (first words) (map ucfirst (rest words))))))
+
+;; aceeca1's solution:
+#(clojure.string/replace % #"-[a-z]" (comp clojure.string/upper-case last))
+
+;; adereth's solution:
+(fn [dashed]
+  (let [tokens (.split dashed "-")
+        capped (map #(apply str (Character/toUpperCase (first %))
+                          (rest %)) (rest tokens))]
+  (apply str (first tokens) capped)))
+
+;; 0x89's solution:
+(fn [w] (let [s (.split w "-")]
+           (apply str (first s)
+                  (map
+                    #(apply str
+                            (char (- (int (first %)) 32))
+                            (rest %))
+                    (rest s)))))


fix annotation creation permission test

fix annotation creation permission test

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/'


finally, i get it

finally, i get it

fatal: unable to access 'https://github.com/carolove/clojure-ring-app.git/': The requested URL returned error: 403


should query payments in absence of autopay account

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/'


Update cljfmt version

Update cljfmt 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/jamesleonis/dotfiles.git/'


spec work

spec work

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/CraZySacX/glitter.git/'


Added code to extract domains and facets for IPIP.

error: pathspec 'scripts/extract-ipip-neo-pi-r.clj' did not match any file(s) known to git

--- scripts/extract-ipip-neo-pi-r.clj
+++ scripts/extract-ipip-neo-pi-r.clj
@@ -0,0 +1,120 @@
+#!/bin/bash lein-exec-p
+(ns scripts.extract-ipip-neo-pi-r
+  (:require [clojure.data.json :as json]
+            [clojure.string :as string]
+            [net.cgrand.enlive-html :as html]
+            [simulacrum.bigfive :as bigfive]
+            [simulacrum.util :as util]))
+
+
+(def url "http://ipip.ori.org/newNEOFacetsKey.htm")
+(def export-dir "target/json/")
+(def export-file (str export-dir "ipip-newo-pi-r.json"))
+(def minus (char 8211))
+
+(util/make-dirs export-dir)
+
+(defn get-tables-data [raw-data]
+  (html/select raw-data [:body :table]))
+
+(defn get-facet-names
+  [tables-data]
+  "Given the parsed HTML data for all the tables, return the facet for each
+  section."
+  (rest
+    (remove empty?
+            (map
+              #(:name (:attrs %))
+              (html/select tables-data [:tr :td :b :a])))))
+
+(defn has-facet? [node facet]
+  (not
+    (empty?
+      (html/select node [(html/attr= :name facet)]))))
+
+(defn get-table
+  [facet tables-data]
+  "Given a table name and parsed HTML data for all the tables, return parsed
+  HTML table data for just the table with the section having the given name."
+  (remove empty?
+          (map
+            #(cond
+              (has-facet? % facet) %)
+            tables-data)))
+
+(defn get-facet
+  [table-data]
+    "Given the table data for a specific section, return the facet of that
+  table/section."
+  (((last
+      (html/select
+        table-data [:b :a]))
+    :attrs)
+   :name))
+
+(defn get-facet-data
+  [table-data]
+  "Given the table data for a specific section, return the facet data for that
+  table/section.
+
+  Note that the Cronbach alpha represents the coefficient of internal
+  consistency in tests for that particular facet."
+  (let [raw-data (map html/text (html/select table-data [:b :font]))
+        facet-id (first (string/split (first raw-data) #":"))
+        domain-key (keyword (str (first facet-id)))
+        cleaned (string/replace (util/clean-string (second raw-data))
+                                #"Alpha = " "")]
+    {:facet-id facet-id
+     :facet-number (Integer. (str (last facet-id)))
+     :facet-name (get-facet table-data)
+     :cronbach-alpha (Float. (string/replace cleaned #"[()]" "0"))
+     :domain-key domain-key
+     :domain (bigfive/attributes domain-key)}))
+
+(defn get-facet-id
+  [table-data]
+  "Given the table data for a specific section, return the facet id of that
+  table/section."
+  ((get-facet-data table-data) :facet-id))
+
+(defn get-facet-questions [facet tables-data]
+  (let [table-data (get-table facet tables-data)
+        facet-data (get-facet-data table-data)
+        question-data (drop 1 (html/select
+                                (get-table facet table-data)
+                                [:td]))
+        text-data (remove
+                    empty?
+                    (map (comp util/clean-string html/text) question-data))
+        positives (drop 1
+                        (take-while
+                          (fn [x] (not (= (str (first x)) "–"))) text-data))
+        negatives (drop (+ (count positives) 2) text-data)]
+    (conj
+      (map
+        #(apply conj facet-data %)
+        (map-indexed
+          #(hash-map :id (inc %1)
+                     :question %2
+                     :reversed? false)
+          positives))
+      (map
+        #(apply conj facet-data %)
+        (map-indexed
+          #(hash-map :id (inc (+ (count positives) %1))
+                     :question %2
+                     :reversed? true)
+          negatives)))
+  ))
+
+(defn get-data [url]
+  (let [tables-data (get-tables-data (util/fetch-url url))
+        facet-names (get-facet-names tables-data)]
+    (flatten (map #(get-facet-questions % tables-data) facet-names))))
+
+(spit export-file
+      (json/write-str
+        (get-data url)))
+
+(println (str "Wrote data to '" export-file "'."))
+(util/exit)


Fix tests to be more robust and updated with the latest API changes.

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/couragelabs/freefrog.git/'


Reintroduce alembic.

Reintroduce alembic.

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/sw1nn/dotfiles.git/'


Refactored add-session-to-complaint to use thread-last macro

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/aneeshpu/pms.git/'


Add benchmark.

Add benchmark.

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

--- test/doc/stage.clj
+++ test/doc/stage.clj
@@ -0,0 +1,61 @@
+(ns doc.stage
+  (:require [clojure.core.async :refer [go]]
+            [midje.sweet :refer :all]
+            [konserve.filestore :refer [new-fs-store]]
+            [geschichte.stage :as s]
+            [geschichte.repo :as repo]
+            [geschichte.sync :refer [server-peer]]
+            [geschichte.platform :refer [<!? create-http-kit-handler! start stop]]
+            [geschichte.p2p.block-detector :refer [block-detector]]
+            [geschichte.p2p.hash :refer [ensure-hash]]
+            [geschichte.p2p.fetch :refer [fetch]]
+            [taoensso.timbre :as timber]))
+
+(timber/refer-timbre)
+
+(defn init-repo [config]
+  (let [{:keys [user repo branches store remote peer]} config
+        store (<!? (new-fs-store store))
+        peer-server (server-peer (create-http-kit-handler! peer) ;; TODO client-peer?
+                                 store
+                                 (comp (partial block-detector :peer-core)
+                                       (partial fetch store)
+                                       ensure-hash
+                                       (partial block-detector :p2p-surface)))
+        stage (<!? (s/create-stage! user peer-server eval))
+        res {:store store
+             :peer peer-server
+             :stage stage
+             :id repo}]
+
+    (when-not (= peer :client)
+      (start peer-server))
+
+    (when remote
+      (<!? (s/connect! stage remote)))
+
+    (<!? (s/create-repo! stage "Profiling experiments." :id repo))
+
+    (when repo
+      (<!? (s/subscribe-repos! stage {user {repo branches}})))
+    res))
+
+
+(comment
+  (def state (init-repo {:store "repo/store"
+                         :peer "ws://127.0.0.1:41744"
+                         :user "profiler@topiq.es"
+                         :repo #uuid "cda8bb59-6a0a-4fbd-85d9-4a7f56eb5487"
+                         :branches #{"master"}}))
+
+  (def stage (:stage state))
+  (stop (:peer state))
+  (timber/set-level! :warn)
+
+  (doseq [n (range 3e5)]
+    (println "Iteration:" n)
+    (<!? (s/transact stage ["profiler@topiq.es" (:id state) "master"] 'conj
+                     {:id n
+                      :val (range 1024)}))
+    (time (<!? (s/commit! stage {"profiler@topiq.es" {(:id state) #{"master"}}}))))
+  )


renaming :batch to :sdf

renaming :batch to :sdf

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/narkisr/cloujsearch.git/'


WIP on notification verification / reporting tool

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/'


Added brepl functionality

Added brepl functionality

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

--- src/cljs/modern_cljs/connect.cljs
+++ src/cljs/modern_cljs/connect.cljs
@@ -0,0 +1,4 @@
+(ns modern-cljs.connect
+  (:require [clojure.browser.repl :as repl]))
+
+(repl/connect "http://localhost:9000/repl")


Added IDidMount answer field focus.

Added IDidMount answer field focus.

fatal: unable to access 'https://github.com/inchingforward/eon.git/': The requested URL returned error: 403


Add in-memory cloudfiles connection to the dev system

--- dev/user.clj
+++ dev/user.clj
@@ -1,5 +1,6 @@
 (ns user
   (:require [clojars
+             [cloudfiles :as cf]
              [config :as config]
              [errors :as errors]
              [system :as system]]
@@ -18,7 +19,8 @@
   (refresh)
   (config/configure [])
   (assoc (system/new-system (meta-merge config/config dev-env))
-         :error-reporter (errors/->StdOutReporter)))
+    :error-reporter (errors/->StdOutReporter)
+    :cloudfiles (cf/connect "" "" "dev" "transient")))

 (ns-unmap *ns* 'test)


Programming competition example

Programming competition example

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

--- examples/resolution.clj
+++ examples/resolution.clj
@@ -0,0 +1,46 @@
+#!/usr/bin/env inlein
+
+;; Solution to the New Year's Resolution problem in the Facebook Hacker Cup
+;; 2015 Qualification:
+;; https://www.facebook.com/hackercup/problem/1036037553088752/
+;;
+;; Usage: ./resolution.clj < input.txt > output.txt
+
+'{:dependencies [[org.clojure/clojure "1.8.0"]
+                 [org.clojure/math.combinatorics "0.1.1"]]}
+;; Although we could set jvm-opts here, optimisations will be necessary to get
+;; this to reasonable performance, as it's brute forcing the result.
+
+(require '[clojure.string :as s]
+         '[clojure.math.combinatorics :as combo])
+
+(defn sum-foods [foods]
+  (reduce #(mapv + %1 %2) [0 0 0] foods))
+
+(defn solve [{:keys [goal foods]}]
+  (let [subset-counts (map sum-foods (combo/subsets foods))]
+    (boolean (some #(= goal %) subset-counts))))
+
+(def read-food (juxt read read read))
+
+(defn read-input []
+  (let [goal (read-food)
+        food-count (read)
+        foods (vec (repeatedly food-count read-food))]
+    {:goal goal
+     :foods foods}))
+
+(defn pprint-result [t result]
+  (format "Case #%d: %s" (inc t) (if result "yes" "no")))
+
+(defn main []
+  (let [T (read)
+        inputs (doall (repeatedly T read-input))
+        results (pmap solve inputs)]
+    (->> (map-indexed pprint-result results)
+         (s/join "\n")
+         (println))
+    (flush)
+    (System/exit 0)))
+
+(main)


clj-time dependentziak kendu

clj-time dependentziak kendu

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.zer.git/'


Send string UUID [Delivers #146981601]

Send string UUID [Delivers #146981601]


poll: Specify response encoding.

poll: Specify response encoding.

Fixes redmine:2536

--- src/pepa/web/poll.clj
+++ src/pepa/web/poll.clj
@@ -6,10 +6,14 @@

             [clojure.data.json :as json]
             [cognitect.transit :as transit]
-
+
+            [ring.util.response :as response]
             [immutant.web.async :as async-web]
-            [clojure.core.async :as async :refer [go go-loop <!]])
+            [clojure.core.async :as async :refer [go go-loop <!]]
+            [clojure.string :as s])
   (:import java.io.ByteArrayOutputStream))
+
+(def +encoding+ "utf-8")

 (defn ^:private data->response-fn [content-type]
   (case content-type
@@ -22,7 +26,7 @@
       (fn [data]
         (.reset out)
         (transit/write writer data)
-        (.toString out "UTF-8")))))
+        (.toString out (s/upper-case +encoding+))))))

 (defn ^:private send-fn [content-type]
   (let [data->response (data->response-fn content-type)]
@@ -74,7 +78,7 @@
                            [#"^application/transit\+json"
                             #"^application/json"])
         seqs (:body req)
-
+
         poll-config (get-in req [:pepa/config :web :poll])
         db (:pepa/db req)
         bus (:pepa/bus req)
@@ -100,7 +104,8 @@
             :on-error (fn [ch throwable]
                         (log/error web "Caught exception:" throwable)
                         (async-web/close ch))})
-          (assoc-in [:headers "content-type"] content-type)))))
+          (response/content-type content-type)
+          (response/charset +encoding+)))))

 (def poll-handler #'poll-handler*)


Add cmd command

Add cmd command

Fix yetibot/yetibot#703

error: pathspec 'src/yetibot/core/commands/cmd.clj' did not match any file(s) known to git

--- src/yetibot/core/commands/cmd.clj
+++ src/yetibot/core/commands/cmd.clj
@@ -0,0 +1,23 @@
+(ns yetibot.core.commands.cmd
+  (:require
+    [yetibot.core.hooks :refer [cmd-hook]]
+    [yetibot.core.handler :refer [extract-command config-prefix handle-unparsed-expr]]))
+
+(def command-pattern (re-pattern (str "^" config-prefix)))
+
+(defn strip-prefix
+  "Strips command prefix from the beginning of a string, if present"
+  [s]
+  (if (re-find command-pattern s)
+    (last (extract-command s))
+    s))
+
+(defn cmd
+  "cmd # evaluate a literal command. Strips configured cmd prefix (default !) from the beginning if present"
+  {:yb/cat #{:util}}
+  [{match :match}]
+  (handle-unparsed-expr
+    (strip-prefix match)))
+
+(cmd-hook #"cmd"
+  _ cmd)


init sleeping-barber.clj

init sleeping-barber.clj

error: pathspec 'clojure/sleeping-barber.clj' did not match any file(s) known to git

--- clojure/sleeping-barber.clj
+++ clojure/sleeping-barber.clj
@@ -0,0 +1,57 @@
+;; Clojure 用了 STM（软件事务内存）来做并发
+;; ref 的状态只能在事务内进行修改
+
+;; TODO： 目前这个实现有问题
+;; 输出是： 本次营业共计理发 0 位顾客
+
+(def 座位 3)
+(def 顾客 (ref 0))
+(def 顾客计数 (ref 0))
+(def 营业时长 (* 10 1000))
+(def 理发师在休息 (ref true))
+
+(defn 新顾客
+  []
+  (dosync
+   (if (< @顾客 座位)
+     (alter @顾客 (inc @顾客)))
+   (when @理发师在休息
+     (起来理发))))
+
+(defn 打烊
+  "停止营业"
+  []
+  (dosync
+   (println (str "打烊了"))
+   (println (str "本次营业共计理发 " @顾客计数 " 位顾客"))
+   (System/exit 0) ; 终止程序
+  ))
+
+(defn 休息
+  []
+  (dosync
+   (alter @理发师在休息 true)))
+
+(defn 起来理发
+  "理发这需要 20ms"
+  []
+  (dosync
+   (alter @理发师在休息 nil)
+   (when (> @顾客 0)
+     (alter @顾客 (- @顾客 1))
+     (Thread/sleep 20))
+   (if (> @顾客 0)
+     (起来理发)
+     (休息))
+   ))
+
+(do
+  (future
+    ;; 每 10 - 30 秒有一个顾客到达理发店
+    (Thread/sleep (+ 10 (rand-int 0 21)))
+    (新顾客))
+  (future
+    (起来理发))
+  (future
+    (Thread/sleep 营业时长)
+    (打烊)))


Removed incorrect :^const for Java byte array

--- 2-collectors/clojure-collector/src/com/snowplowanalytics/clojure_collector/responses.clj
+++ 2-collectors/clojure-collector/src/com/snowplowanalytics/clojure_collector/responses.clj
@@ -18,7 +18,7 @@
   (:import (org.apache.commons.codec.binary Base64)))

 (def ^:const imageData (str "R0lGODlhAQABAPAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="))
-(def ^:const imageBuffer (Base64/decodeBase64 imageData))
+(def imageBuffer (Base64/decodeBase64 imageData)) ;; Can't define ^:const here as per http://stackoverflow.com/questions/13109958/why-cant-i-use-clojures-const-with-a-java-byte-array
 (def ^:const imageLength (alength imageBuffer))

 ;; Respond with a 404.
@@ -37,9 +37,9 @@
 (defn sendCookieAndPixel [cookieId cookieDuration cookieContents]
   {:status  200
    :headers {"Set-Cookie" (str "sp=" cookieId "; expires=" "[1]" ";" cookieContents)
-             "P3P" "policyref=\"/w3c/p3p.xml\", CP=\"NOI DSP COR NID PSA OUR IND COM NAV STA\"",
-             "Content-Type"  "image/gif",
+             "P3P" "policyref=\"/w3c/p3p.xml\", CP=\"NOI DSP COR NID PSA OUR IND COM NAV STA\""
+             "Content-Type"  "image/gif"
              "Content-Length" imageLength}
-   :body    (str "OK")})
+   :body    imageBuffer})

 ;; TODO: [1] new Date(new Date().getTime()+cookieDuration).toUTCString()


add conexp.sigmajs.base

add conexp.sigmajs.base

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

--- src/main/clojure/conexp/sigmajs/base.clj
+++ src/main/clojure/conexp/sigmajs/base.clj
@@ -0,0 +1,18 @@
+(ns conexp.sigmajs.base
+  (:require [ubergraph.core :as uber]
+            [loom.graph :as lg]
+            [conexp.fca.lattices :as lat]
+            [conexp.util.graph :exclude [transitive-closure] :refer :all])
+  (:use conexp.base)
+  (:use loom.io))
+
+
+;;;
+
+(defn graph->json
+  )
+
+
+;;;
+
+nil


Add a little test for a nested node ns.

Add a little test for a nested node ns.

error: pathspec 'src/dev/node/com/potetm/node_client/nested_ns.cljs' did not match any file(s) known to git

--- src/dev/node/com/potetm/node_client/nested_ns.cljs
+++ src/dev/node/com/potetm/node_client/nested_ns.cljs
@@ -0,0 +1,5 @@
+(ns com.potetm.node-client.nested-ns)
+
+(def my-js-obj #js {})
+
+(def my-map {:a 1})


(format)

(format)

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/'


s/type/keys/

s/type/keys/

fatal: unable to access 'https://github.com/ekoontz/babel.git/': The requested URL returned error: 403


slightly faster API format middleware

slightly faster API format middleware

--- src/metabase/middleware/format.clj
+++ src/metabase/middleware/format.clj
@@ -21,8 +21,8 @@
 (defn- remove-fns-and-delays
   "Remove values that are fns or delays from map M."
   [m]
-  (filter-vals #(and (not (fn? %))
-                     (not (delay? %)))
+  (filter-vals #(not (or (delay? %)
+                         (fn? %)))
                m))

 (defn- clob? [obj]
@@ -31,7 +31,7 @@
 (defn- -format-response [obj]
   (cond
     (map? obj)  (->> (remove-fns-and-delays obj)   ; recurse over all vals in the map
-                    (map-vals -format-response))
+                     (map-vals -format-response))
     (coll? obj) (map -format-response obj)        ; recurse over all items in the collection
     (clob? obj) (util/jdbc-clob->str obj)
     :else       obj))


store a slot effectively

store a slot effectively

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/nilenso/finenso-time-tracker.git/'


:tada: Add uxbox.util.object ns.

:tada: Add uxbox.util.object ns.

error: pathspec 'frontend/src/uxbox/util/object.cljs' did not match any file(s) known to git

--- frontend/src/uxbox/util/object.cljs
+++ frontend/src/uxbox/util/object.cljs
@@ -0,0 +1,47 @@
+;; This Source Code Form is subject to the terms of the Mozilla Public
+;; License, v. 2.0. If a copy of the MPL was not distributed with this
+;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
+;;
+;; This Source Code Form is "Incompatible With Secondary Licenses", as
+;; defined by the Mozilla Public License, v. 2.0.
+;;
+;; Copyright (c) 2020 UXBOX Labs SL
+
+(ns uxbox.util.object
+  "A collection of helpers for work with javascript objects."
+  (:refer-clojure :exclude [get get-in assoc!])
+  (:require [goog.object :as gobj]))
+
+(defn get
+  ([obj k]
+   (when (object? obj)
+     (unchecked-get obj k)))
+  ([obj k default]
+   (if (object? obj)
+     (or (unchecked-get obj k) default)
+     default)))
+
+(defn get-in
+  [obj keys]
+  (loop [key (first keys)
+         keys (rest keys)
+         res obj]
+    (if (nil? key)
+      res
+      (if (nil? res)
+        res
+        (recur (first keys)
+               (rest keys)
+               (unchecked-get res key))))))
+
+(defn assign!
+  ([a b]
+   (js/Object.assign a b))
+  ([a b & more]
+   (reduce assign! (assign! a b) more)))
+
+(defn assoc!
+  [obj attr value]
+  (when (object? obj)
+    (unchecked-set obj attr value)
+    obj))


added tutorial 8

added tutorial 8

error: pathspec 'src/maqueta/hello/picking.clj' did not match any file(s) known to git

--- src/maqueta/hello/picking.clj
+++ src/maqueta/hello/picking.clj
@@ -0,0 +1,92 @@
+(ns maqueta.hello.picking
+  (:use (maqueta application assets))
+  (:import com.jme3.collision.CollisionResults
+           com.jme3.font.BitmapText
+           (com.jme3.math ColorRGBA Ray Vector3f)
+           (com.jme3.scene Node Geometry)
+           (com.jme3.scene.shape Box Sphere)))
+
+(defn make-cube
+  [name x y z]
+  (let [box (Box. (Vector3f. x y z) 1 1 1)
+        cube (Geometry. name box)
+        mat (load-material "Common/MatDefs/Misc/Unshaded.j3md")]
+    (.setColor mat "Color" (ColorRGBA/randomColor))
+    (.setMaterial cube mat)
+    cube))
+
+(defn make-floor
+  []
+  (let [box (Box. (Vector3f. 0 -4 -5) 15 0.2 15)
+        floor (Geometry. "the Floor" box)
+        mat (load-material "Common/MatDefs/Misc/Unshaded.j3md")]
+    (.setColor mat "Color" ColorRGBA/Gray)
+    (.setMaterial floor mat)
+    floor))
+
+(def shootables (doto (Node. "Shootables")
+                  (.attachChild (make-cube "a Dragon" -2 0 1))
+                  (.attachChild (make-cube "a tin can" 1 -2 0))
+                  (.attachChild (make-cube "the Sheriff" 0 1 -2))
+                  (.attachChild (make-cube "the Deputy" 1 0 -4))
+                  (.attachChild (make-floor))))
+
+(def mark (let [sphere (Sphere. 30 30 0.2)
+                mark (Geometry. "BOOM!" sphere)
+                mat (load-material "Common/MatDefs/Misc/Unshaded.j3md")]
+            (.setColor mat "Color" ColorRGBA/Red)
+            (.setMaterial mark mat)
+            mark))
+
+(defn shoot
+  [app is-pressed tpf]
+  (if (not is-pressed)
+    (let [root-node (.getRootNode app)
+          results (CollisionResults.)
+          cam (.getCamera app)
+          ray (Ray. (.getLocation cam) (.getDirection cam))]
+      (.collideWith shootables ray results)
+      (println "-----" "Collisions?" (.size results) "-----")
+      (doall (map (fn [i]
+                    (let [collision (.getCollision results i)
+                          dist (.getDistance collision)
+                          pt (.getContactPoint collision)
+                          hit (.getName (.getGeometry collision))]
+                      (println "* Collision #" i)
+                      (println " You shot" hit "at" pt "," dist "wu away.")))
+                  (range (.size results))))
+      (if (> (.size results) 0)
+        (let [closest (.getClosestCollision results)]
+          (.setLocalTranslation mark (.getContactPoint closest))
+          (.attachChild root-node mark))
+        (.detachChild root-node mark)))))
+
+(def on-action {:button-left shoot})
+
+(defn init-cross-hairs
+  [gui-node]
+  (let [font (load-font "Interface/Fonts/Default.fnt")
+        ch (BitmapText. font false)]
+    (.detachAllChildren gui-node)
+    (doto ch
+      (.setSize (* 2 (.getRenderedSize (.getCharSet font))))
+      (.setText "+")
+      (.setLocalTranslation (- (/ (.getWidth *app-settings*) 2)
+                               (* 2
+                                  (/ (.getRenderedSize (.getCharSet font))
+                                     3)))
+                            (+ (/ (.getHeight *app-settings*) 2)
+                               (/ (.getLineHeight ch) 2))
+                            0))
+    (.attachChild gui-node ch)))
+
+(defn setup-fn
+  [app]
+  (let [root-node (.getRootNode app)
+        gui-node (.getGuiNode app)]
+    (init-cross-hairs gui-node)
+    (.attachChild root-node shootables)))
+
+(defn -main [& args]
+  (.start (make-app :setup-fn setup-fn
+                    :on-action on-action)))


added p03.clj

added p03.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/drcabana/euler-fp.git/'


added render for other pages

added render for other pages

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/mprokopov/privat24-manager.git/'


Whitespace-only

Whitespace-only

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/'


String resource test

String resource test

This is to test for Java-baesd charset encoding of Java strings

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/delitescere/yada.git/'


Visualise tick intervals as SVG

Visualise tick intervals as SVG

error: pathspec 'dev/src/tick/viz.clj' did not match any file(s) known to git

--- dev/src/tick/viz.clj
+++ dev/src/tick/viz.clj
@@ -0,0 +1,75 @@
+(ns tick.viz
+  (:require
+   [clojure.xml :refer [parse]]
+   [clojure.java.io :as io]
+   [tick.alpha.api :as t]
+   [clojure.data.xml :as x]
+   )
+  (:import
+   [org.apache.batik.swing JSVGCanvas]
+   [javax.xml.parsers DocumentBuilder DocumentBuilderFactory]
+   ))
+
+(x/alias-uri :svg "http://www.w3.org/2000/svg")
+
+(def canvas (JSVGCanvas.))
+
+(defn show-canvas []
+  (let [frame (javax.swing.JFrame.)]
+    (.add (.getContentPane frame) canvas)
+    (.setSize frame 800 200)
+    (.setDefaultCloseOperation frame javax.swing.JFrame/HIDE_ON_CLOSE)
+    (.setVisible frame true)))
+
+(defn until-seconds [a b]
+  (.until a b (t/units :seconds)))
+
+(defn label [obj label]
+  (with-meta obj {:label label}))
+
+(defn view [& ival-sets]
+  (let [tmpfile (java.io.File/createTempFile "tick" ".svg" (io/file (System/getProperty "java.io.tmpdir")))
+        _ (assert (every? t/ordered-disjoint-intervals? ival-sets))
+        left-edge (apply t/min (map first (apply concat ival-sets)))
+        right-edge (apply t/max (map second (apply concat ival-sets)))
+        width (until-seconds left-edge right-edge)
+        scale (float (/ 800 width))
+        bar-height 30
+        bar-margin 40]
+
+    (with-open [f (java.io.PrintWriter. (io/writer tmpfile))]
+      (x/emit
+        {:tag ::svg/svg
+         :attrs {:viewBox "0 0 800 800"}
+         :content
+         (map-indexed
+           (fn [y ivals]
+             (for [[x1 x2 :as ival] ivals]
+               {:tag ::svg/g
+                :content
+                (let [x (* scale (until-seconds left-edge x1))
+                      y (+ bar-margin (* y (+ bar-margin bar-height)))
+                      width (* scale (- (until-seconds left-edge x2)
+                                        (until-seconds left-edge x1)))]
+                  [{:tag ::svg/rect
+                    :attrs {:x x
+                            :y y
+                            :width width
+                            :height bar-height
+                            :fill "#aaf"
+                            :stroke "#88f"
+                            :stroke-width "1px"}}
+
+                   (when-some [text (-> ival meta :label)]
+                     {:tag ::svg/text
+                      :attrs {:x (+ x (/ width 2))
+                              :y (- y (/ bar-height 8))
+                              :text-anchor "middle"
+                              :font-size "130%"}
+
+                      :content (str text)})])}))
+
+           ival-sets)}
+        f))
+
+    (.loadSVGDocument canvas (str (.toURL tmpfile)))))


old compojure entry (duplicated) removed

--- src/leiningen/new/cryogen/project.clj
+++ src/leiningen/new/cryogen/project.clj
@@ -4,7 +4,6 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [compojure "1.1.6"]
                  [hiccup "1.0.5"]
                  [selmer "0.7.2"]
                  [markdown-clj "0.9.57"


[WM TH] handle :not-found user-works response

...and add a 500 default case fallback

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/user-http-api.git/'


clean up services sub

clean up services sub

don't really need a thread-last when it already has a let and only does one thing

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/'


Require langohr.basic

Require langohr.basic

fatal: unable to access 'https://github.com/democracyworks/scheduled-message-works.git/': The requested URL returned error: 403


Iruzkin kopurua eta gogokoak sql eskaeran sartu

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.zer.git/'


La til Clojure-løsning på Sorting Dimonds

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

--- sorting_diamonds/larstvei.clj
+++ sorting_diamonds/larstvei.clj
@@ -0,0 +1,6 @@
+(defn sorting-dimonds [n]
+  (letfn [(move [deck]
+            (when (not-empty deck)
+              (into [(peek deck)] (pop deck))))
+          (step [deck card] (into [card] (move deck)))]
+    (reduce step [] (range n 0 -1))))


Saioa hasita dagoen markatu

Saioa hasita dagoen markatu

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/'


Add app-state text search fn

Add app-state text search fn

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/Reefersleep/sleepydo.git/'


Point to mirror docs

Point to mirror docs

To help people know that they exist and to encourage them to join the
mirrors mailing list.

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/'


move template key into own namespace

move template key into own namespace

to avoid circular loading references

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

--- src/crucible/template_key.clj
+++ src/crucible/template_key.clj
@@ -0,0 +1,6 @@
+(ns crucible.template-key
+  (:require [camel-snake-kebab.core :refer [->PascalCase]]))
+
+(defn ->key
+  [k]
+  (name (->PascalCase k)))


s-m-w ready to send polling script

s-m-w ready to send polling script

Usage:
  lein run -m scheduled-message-works.stats db-uri [interval]

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/scheduled-message-works.git/'


Add directions for viewing the stats chart


some simple clojure scripts

some simple clojure scripts

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


rm unused require

rm unused require

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/jtbeckha/alda.git/'


add type

add type

error: pathspec 'src/bluebell/utils/ebmd/type.clj' did not match any file(s) known to git

--- src/bluebell/utils/ebmd/type.clj
+++ src/bluebell/utils/ebmd/type.clj
@@ -0,0 +1,30 @@
+(ns bluebell.utils.ebmd.type
+  (:require [bluebell.utils.ebmd :refer [def-arg-spec
+                                         pred any-arg]])
+  (:refer-clojure :exclude [any number
+                            sequential set keyword
+                            string coll map empty]))
+
+;;;------- Common arg types -------
+
+(def-arg-spec any any-arg)
+
+(def-arg-spec number (pred number?))
+
+(def-arg-spec sequential (pred sequential?))
+
+(def-arg-spec set (pred set?))
+
+(def-arg-spec keyword (pred keyword?))
+
+(def-arg-spec string (pred string?))
+
+(def-arg-spec nil-value (pred nil?))
+
+(def-arg-spec coll (pred coll?))
+
+(def-arg-spec map (pred map?))
+
+(def-arg-spec empty (pred (fn [x] (and (coll? x)
+                                       (empty? x)))))
+


Bumping versions

Bumping versions

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/'


add enlive dep

add enlive dep

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

--- project.clj
+++ project.clj
@@ -0,0 +1,7 @@
+(defproject snipsnip "0.1.0-SNAPSHOT"
+  :description "Enlive with short feedback loop"
+  :url "http://github.com/claj/snipsnip"
+  :license {:name "Eclipse Public License"
+            :url "http://www.eclipse.org/legal/epl-v10.html"}
+  :dependencies [[org.clojure/clojure "1.7.0"]
+                 [enlive "1.1.6"]])


Upgrade cheshire

Upgrade cheshire

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/terrancesnyder/engulf.git/'


update deps

update deps

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/gavilancomun/mozart-clj.git/'


Version 1.6.1-SNAPSHOT

Version 1.6.1-SNAPSHOT


Switch to version 0.8.0

Switch to version 0.8.0

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/magoyette/marcandregoyette.com.git/'


Bump to 0.2.8-SNAPSHOT

Bump to 0.2.8-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject clj-http "0.2.7"
+(defproject clj-http "0.2.8-SNAPSHOT"
   :description "A Clojure HTTP library wrapping the Apache HttpComponents client."
   :repositories {"sona" "http://oss.sonatype.org/content/repositories/snapshots"}
   :dependencies [[org.clojure/clojure "1.3.0"]


0.9.0-wip16

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject storm/storm "0.9.0-wip15"
+(defproject storm/storm "0.9.0-wip16"
   :url "http://storm-project.clj"
   :description "Distributed and fault-tolerant realtime computation"
   :license {:name "Eclipse Public License - Version 1.0" :url "https://github.com/nathanmarz/storm/blob/master/LICENSE.html"}


Moving on to 1.1.3

Moving on to 1.1.3

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject com.okl.tokenmgr "1.1.2"
+(defproject com.okl.tokenmgr "1.1.3-SNAPSHOT"
   :description "Store tokens in zookeeper and filter them"
   :url "https://github.com/okl/danger-tokenmgr"
   :dependencies [[org.clojure/clojure "1.5.1"]


Refactor rest functions.

Refactor rest functions.

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/couragelabs/freefrog.git/'


add tests for verifying test filters

add tests for verifying test filters

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

--- test/test_test.clj
+++ test/test_test.clj
@@ -0,0 +1,14 @@
+(ns test-test
+  (:use clojure.test))
+
+(deftest #^:foo tag-foo
+  (comment println "tag :foo")
+  (is (= 1 1)))
+
+(deftest #^:bar tag-bar
+  (comment println "tag :bar")
+  (is (= 1 1)))
+
+(deftest #^{:tags [:foo :bar]} tag-foo-and-bar
+  (comment println "tags [:foo :bar]")
+  (is (= 1 1)))


CMR-470: Added messages namespace for ingest specific messages.

error: pathspec 'src/cmr/ingest/services/messages.clj' did not match any file(s) known to git

--- src/cmr/ingest/services/messages.clj
+++ src/cmr/ingest/services/messages.clj
@@ -0,0 +1,8 @@
+(ns cmr.ingest.services.messages
+  (:require [clojure.string :as str]
+            [cmr.common.services.errors :as errors]))
+
+(defn parent-collection-does-not-exist [granule-ur]
+  (format
+    "Parent collection for granule [%s] does not exist."
+    granule-ur))


Solve Area in clojure

Solve Area in clojure

error: pathspec 'solutions/uri/1012/1012.clj' did not match any file(s) known to git

--- solutions/uri/1012/1012.clj
+++ solutions/uri/1012/1012.clj
@@ -0,0 +1,20 @@
+(ns main
+  (:require [clojure.string :as str]))
+
+(def pi 3.14159)
+
+(defn main []
+  (loop [line (read-line)]
+    (when line
+      (let [[a b c] (str/split line #" ")
+            a' (Double/parseDouble a)
+            b' (Double/parseDouble b)
+            c' (Double/parseDouble c)]
+        (printf "TRIANGULO: %.3f%n" (/ (* a' c') 2))
+        (printf "CIRCULO: %.3f%n" (* pi (* c' c')))
+        (printf "TRAPEZIO: %.3f%n" (* (/ (+ a' b') 2) c'))
+        (printf "QUADRADO: %.3f%n" (* b' b'))
+        (printf "RETANGULO: %.3f%n" (* a' b')))
+      (recur (read-line)))))
+
+(main)


Исправление после рефакторинга datatime -> datetime

error: pathspec 'radiolamp-6P3S/src/r6p3s/ui/datetime.cljs' did not match any file(s) known to git

--- radiolamp-6P3S/src/r6p3s/ui/datetime.cljs
+++ radiolamp-6P3S/src/r6p3s/ui/datetime.cljs
@@ -0,0 +1,13 @@
+(ns r6p3s.ui.datetime
+  (:require [om.dom :as dom :include-macros true]
+            [r6p3s.core :as rc]
+            [r6p3s.ui.glyphicon :as gicon]))
+
+
+
+
+(defn render [d]
+  (dom/span
+   #js {:className "text-muted"}
+   (gicon/render "time") " "
+   (rc/date-com-format-datetime d)))


Forgot to check in a file.

Forgot to check in a file.

error: pathspec 'src/midje/emission/plugins/util.clj' did not match any file(s) known to git

--- src/midje/emission/plugins/util.clj
+++ src/midje/emission/plugins/util.clj
@@ -0,0 +1,5 @@
+(ns ^{:doc "General purpose plugin utilities"}
+  midje.emission.plugins.util
+  (:require [midje.clojure-test-facade :as ctf]))
+
+(def output ctf/output)


Make toplevel 'users' immutable

Make toplevel 'users' immutable

error: pathspec 'src/clojure_fabric/client-user.clj' did not match any file(s) known to git

--- src/clojure_fabric/client-user.clj
+++ src/clojure_fabric/client-user.clj
@@ -0,0 +1,329 @@
+;; Copyright 2017 Jong-won Choi <oz.jongwon.choi@gmail.com>
+;;
+;; Licensed under the Apache License, Version 2.0 (the "License")
+;; you may not use this file except in compliance with the License.
+;; You may obtain a copy of the License at
+;;
+;;     http://www.apache.org/licenses/LICENSE-2.0
+;;
+;; Unless required by applicable law or agreed to in writing, software
+;; distributed under the License is distributed on an "AS IS" BASIS,
+;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+;; See the License for the specific language governing permissions and
+;; limitations under the License.
+
+;;
+;; Client and User are merged to simplify mutation operations
+;; User is 'top-level' object and has all information including
+;;      channels and crypto-suite
+
+;;
+;; User implementation of "Fabric SDK Design Spec"
+;;
+;; The User class represents users that have been enrolled and represented by an enrollment
+;; certificate (ECert) and a signing key. The ECert must have been signed by one of the CAs
+;; the blockchain network has been configured to trust. An enrolled user (having a signing key
+;; and ECert) can conduct chaincode deployments, transactions and queries with the Chain.
+;; User ECerts can be obtained from a CA beforehand as part of deploying the application,
+;; or it can be obtained from the optional Fabric COP service via its enrollment process.
+;; Sometimes User identities are confused with Peer identities. User identities represent
+;; signing capability because it has access to the private key, while Peer identities
+;; in the context of the application/SDK only has the certificate for verifying signatures.
+;; An application cannot use the Peer identity to sign things because the application doesn’t
+;; have access to the Peer identity’s private key.
+
+(ns clojure-fabric.client-user
+  (:require [clojure-fabric.channel :as channel]
+            [clojure-fabric.chaincode :as chaincode]
+            [clojure-fabric.crypto-suite :as crypto-suite]))
+
+(defonce ^:private users (atom {}))     ; key = [msp-id name]
+
+(defonce ^:dynamic *user* nil)
+
+(defrecord User [msp-id name channels crypto-suite
+                 roles %roles
+                 private-key certificate
+                 ;; For CA-Client
+                 ca-location])
+
+(defn ca-user?
+  [user]
+  (not (nil? (:ca-location user))))
+
+(defn new-user!
+  [& {:keys [msp-id name channels crypto-suite roles %roles private-key certificate ca-location]
+      :or {channels {} roles #{} %roles #{}}}]
+  ;; roles - client, auditor
+  ;; %roles - peer, validator
+  (swap! users
+         assoc
+         [msp-id name]
+         (->User msp-id name channels crypto-suite roles %roles private-key certificate ca-location)))
+
+(defn get-user
+  [msp-id name]
+  (get @users [msp-id name]))
+
+
+;;; new_chain
+;;;
+;; "Initializes a chain instance with the given name. This is really representing the \"Channel\"
+;;   (as explained above), and this call returns an empty object. To initialize the channel, a list of
+;;   participating endorsers and orderer peers must be configured first on the returned object.
+;;   Params:
+;;         name (str): The name of the chain, recommend using namespaces to avoid collision
+;;   Returns:
+;;         (Chain instance): The uninitialized chain instance."
+;;
+;;
+(defn new-channel!
+  ([channel-name channel-opts]
+   (new-channel! *user* channel-name))
+  ([{msp-id :msp-id user-name :name} channel-name channel-opts]
+   (swap! users assoc-in [[msp-id user-name] channel-name]
+          (channel/make-channel (assoc channel-opts :user-key [msp-id user-name])))))
+
+;;; get_chain
+(defn get-channel
+  "Get a chain instance from the state storage. This allows existing chain instances to be saved
+  for retrieval later and to be shared among instances of the application. Note that it's the
+  application/SDK’s responsibility to record the chain information. If an application is not able to
+  look up the chain information from storage, it may call another API that queries one or more Peers
+  for that information.
+  Params:
+        name (str): The name of the chain
+  Returns:
+        (Chain instance or None): the chain instance for the name.
+  Error:  The state store has not been set
+        A chain does not exist under that name"
+  ;; Implementation Note:
+  ;;    Not a storage operation
+  ([channel-name]
+   (get-channel *user* channel-name))
+  ([{:keys [msp-id name channels]} channel-name]
+   (if-let [found (get-in channels [[msp-id name] channel-name])]
+     found
+     ;; Implementation Note
+     ;;       The spec says that Returns is chain Instance or None
+     ;;       How it can be None and also throw an exception?
+     (throw (Exception. "A channel does not exist under that name")))))
+
+;;; query_chain-info
+(defn query-channel-info
+  "This is a network call to the designated Peer(s) to discover the chain information.
+  The target Peer(s) must be part of the chain in question to be able to return the requested
+  information.
+  Params:
+        name (str): The name of the chain
+        peers (array of Peer instances): target Peers to query
+  Returns:
+        (Chain instance or None): the chain instance for the name.
+  Error:
+        The target Peer(s) does not know anything about the chain"
+
+  ([name peers]
+   (query-channel-info *user* name peers))
+  ([user name peers]
+   (let [{:keys [channel-peers crypto-suite user-context]} (get-channel user name)
+         unknown-peers (clojure.set/difference (set peers) channel-peers)]
+     (if (empty? unknown-peers)
+       (chaincode/send-chaincode-request :query-channel-info
+                                         peers
+                                         user-context
+                                         crypto-suite)
+       #_
+       (chaincode/make-chaincode-signed-proposal :query-channel-info
+                                                 user-context
+                                                 crypto-suite)
+       (throw (Exception. "The target Peer(s) does not know anything about the channel"))))))
+
+
+
+;; (defonce ^:private client-state-store (atom {}))
+;; ;;; set_state_store
+;;
+;; (defn set-state-store!
+;;   "The SDK should have a built-in key value store implementation (suggest a file-based
+;;   implementation to allow easy setup during development). But production systems would want
+;;   a store backed by database for more robust storage and clustering, so that multiple
+;;   app instances can share app state via the database (note that this doesn't necessarily
+;;   make the app stateful). This API makes this pluggable so that different store implementations
+;;   can be selected by the application.
+
+;;   Params:
+;;         store (KeyValueStore): instance of an alternative KeyValueStore implementation
+;;         provided by the consuming app.
+;;   Returns:
+;;         None"
+;;   ([store]
+;;    (set-state-store! *client* store))
+;;   ([client store]
+;;    (swap! client-state-store assoc client (atom {}))))
+
+;; ;;; get_state_store
+;; (defn get-state-store
+;;   "A convenience method for obtaining the state store object in use for this client.
+;; Params:
+;;         None
+;; Returns:
+;;         (KeyValueStore instance): The KeyValueStore implementation object set within this Client,
+;;         or null if it does not exist "
+;;   ([]
+;;    (get-state-store *client*))
+;;   ([client]
+;;    (get @client-state-store client)))
+
+;;; set_crypto_suite
+;;   "Sets an instance of the CryptoSuite interface implementation. A crypto suite encapsulates
+;;   algorithms for digital signatures and encryption with asymmetric key pairs, message encryption
+;;   with a symmetric key, and secure hashing and MAC.
+
+(defn new-crypto-suite!
+  ([crypto-opts]
+   (new-crypto-suite! *user* crypto-opts))
+  ([{:keys [msp-id name]} user crypto-opts]
+   (swap! users assoc-in [[msp-id name] crypto-opts]
+          (crypto-suite/make-crypto-suite crypto-opts))))
+
+;; Params:
+;;   Suite (object): an instance of a crypto suite implementation"
+;;
+;; Immutable
+
+;;; get_crypto_suite
+(defn get-crypto-suite
+  "A convenience method for obtaining the CryptoSuite object in use for this client.
+  Params:
+        None
+  Returns:
+        (CryptoSuite instance): The CryptoSuite implementation object set within this Client,
+        or null if it does not exist"
+  ([]
+   (get-crypto-suite *user*))
+  ([user]
+   (:crypto-suite user)))
+
+;;; set_user_context
+;; "Sets an instance of the User class as the security context of this client instance.
+;;   This user's credentials (ECert) will be used to conduct transactions and queries with
+;;   the blockchain network. Upon setting the user context, the SDK saves the object in a persistence
+;;   cache if the \"state store\" has been set on the Client instance. If no state store has been set,
+;;   this cache will not be established and the application is responsible for setting the user
+;;   context again when the application crashed and is recovered.
+;;   Params:
+;;         user (User): an instance of the User class encapsulating the authenticated user’s
+;;         signing materials (private key and enrollment certificate)"
+;;
+;; See new-user!
+
+
+;;; get_user_context
+
+;; (defn get-user-context
+;;  "As explained above, the client instance can have an optional state store. The SDK saves enrolled
+;;   users in the storage which can be accessed by authorized users of the application
+;;   (authentication is done by the application outside of the SDK). This function attempts to load
+;;   the user by name from the local storage (via the KeyValueStore interface).
+;;   The loaded user object must represent an enrolled user with a valid enrollment certificate
+;;   signed by a trusted CA (such as the COP server).
+;;   Params:
+;;         name (str): The name of the user
+;;   Returns:
+;;         (User instance): The user object corresponding to the name, or null if the user does not
+;;         exist or if the state store has not been set"
+;;   ([name]
+;;    (get-user-context *client* name))
+;;   ([client name]
+;;    ;; TBD
+;;    ))
+;;
+;; See get-user
+
+
+;;;
+;;; Not in spec, but in some SDKs
+;;;
+(defn query-installed-chaincodes
+  ([peer]
+   (query-installed-chaincodes *user* peer))
+  ([user peer]
+   (let [peers (channel/get-peers user)]
+    (if (contains? peers peer)
+      (chaincode/send-chaincode-request :query-installed-chaincodes
+                                        peers
+                                        user)
+      #_
+      (chaincode/make-chaincode-signed-proposal :query-installed-chaincodes
+                                                user-context
+                                                crypto-suite)
+      (throw (Exception. "The target Peer does not know anything about the channel"))))))
+
+
+
+
+
+
+
+;;; get_name
+(defn get-name
+  "Get member name. Required property for the instance objects.
+  Returns (str):
+        The name of the user"
+  ([]
+   (get-name *user*))
+  ([user]
+   (:name user)))
+
+
+;;; get_roles
+(defn get-roles
+ "Get the user’s roles. It’s an array of possible values in “client”, and “auditor”.
+  The member service defines two more roles reserved for peer membership: “peer” and “validator”,
+  which are not exposed to the applications.
+  Returns: (str[]):
+        The roles for this user"
+  ([]
+   (get-roles *user*))
+  ([user]
+   (:roles user)))
+
+;;; get_enrollment_certificate
+;;;
+;;; FIXME: just use :certificate and remove this function?
+(defn get-enrollment-certificate
+  "Returns the underlying ECert representing this user’s identity.
+  Params: none
+  Returns:
+        Certificate in PEM format signed by the trusted CA"
+  ([]
+   (get-enrollment-certificate *user*))
+  ([user]
+   (:certificate user)))
+
+;;; set_name
+;;; Immutable
+
+;;; set_roles
+;;; Immutable
+
+;;; set_enrollment_certificate
+;;; Immutable
+
+
+;;; generate_tcerts
+;; Not required any more(?) - https://jira.hyperledger.org/browse/FAB-5740
+;; (defn generate-tcerts
+;;   "Gets a batch of TCerts to use for transaction. there is a 1-to-1 relationship between TCert
+;;   and Transaction. The TCert can be generated locally by the SDK using the user’s crypto materials.
+;;   Params:
+;;         count (number): how many in the batch to obtain?
+;;         Attributes (string[]): list of attributes to include in the TCert
+;;   Returns (TCert[]):
+;;         An array of TCerts"
+;;   ([count attributes]
+;;    (generate-tcerts *user*))
+;;   ([user count attributes])
+;;   ;; TBD
+;;   ;; Not sure if this is required now (couldn't find any usage in Java code)
+;;   )


functional thinking(on immutability, HOFs) + 4clojure exercises

error: pathspec 'src/clojure_learning/with-clojure-playing-chap-7-FP.clj' did not match any file(s) known to git

--- src/clojure_learning/with-clojure-playing-chap-7-FP.clj
+++ src/clojure_learning/with-clojure-playing-chap-7-FP.clj
@@ -0,0 +1,177 @@
+(use 'clojure.repl)
+
+(map [:a :b :c] #{0 1}); (:a :b)
+
+(let [[head :as init-coll] [1 2 3 4 5]]
+  head); 1
+
+;; function composition:
+(map (comp keyword #(.toLowerCase %) name) '[a b c]); (:a :b :c)
+(map (comp
+        keyword
+        #(.toLowerCase %)
+        name) '[a b c]); (:a :b :c)
+
+;; clojure heavy relies on the varargs arity of arguments -> curries make litlle sense...
+((partial + 4) 100 200); 304
+((comp +) 4 100 200); 304
+
+;; diff between partial & curry: partial attemts to evaluate eagerly the expression
+;; on any given argument -> to see if it can return, while curry returns by definition
+;; each-time another function back, taking yet another argument, until it resolves.
+;; partial application is an implementation of the curry more general process;
+
+;; clojure provides the [complement] function, that returns the opposite boolean value
+;; of the truthy -> false;
+
+;; the [complement] function is equivalent to: comp not ...
+(let [thruttiness (fn [x] x)]
+  ((complement thruttiness) true) ; false
+  ((complement thruttiness) 20)   ; false
+  ((complement thruttiness) nil)) ; true
+
+;; power of deconstruction in action:
+(let [{:keys [foo bar zip]
+         :or {zip "cucu"}} {:foo "foo" :bar "bar"}]
+    (format "foo is: %1s, bar is %2s, whereas zip defaults to: %3s" foo bar zip ))
+
+;; using syms instead of :keywords
+(let [{:syms [foo bar zip]
+         :or {zip "cucu"}} {'foo "foo" 'bar "bar"}]
+    (format "foo is: %1s, bar is %2s, whereas zip defaults to: %3s" foo bar zip ))
+
+
+(let [[foo _ zip] ["foo" "bar" "zip"]]
+  (format "foo is %1s, while zip is %2s..bar is ignored" foo zip))
+
+(let [[head & tail] [1 2 3 4 5]]
+  (format "head is: %1s, while tail is a sequence back deconstructured from the vector DS: %2s" head tail))
+;; "head is: 1, while tail is a sequence back deconstructured from the vector DS: (2 3 4 5)"
+
+(let [ {a 0}   [1 2 3 [4 5 6 7]] ] a); 1
+(let [ {a 0 b 3}   [1 2 3 [4 5 6 7]] ] b);  [4 5 6 7]
+(let [ {[x _ _ z] 3}   [1 2 3 [4 5 6 7]] ] (+ x z));  [4 5 6 7]
+
+(let [ [x y & tail] [1 2 :foo "foo" :bar "bar"]
+       {:keys [foo bar]} (apply hash-map tail) ]
+    (format "using %1d, with %2s %3s" (+ x y) foo bar))
+;; using 3 with foo bar
+
+;; .... and as a one-liner:
+(let [ [x y & {:keys [foo bar]}] [1 2 :foo "foo" :bar "bar"]]
+    (format "using %1d, with %2s %3s" (+ x y) foo bar))
+;; the tail-items must be even -> for the deconstructure in a map to succeed.
+
+;; and back to functions:
+(reduce #(assoc %1 %2 (* %2 %2)) {} [1 2 3 4 5]); {5 25, 4 16, ..., 1 1}
+(doc assoc); assoc [map key val]
+;; in the previous reduce case, the {} initial and first argument of reduce is the map ->
+;; used as %1 1st argument of our literal-func -> 1st time invoking [assoc] using {} will
+;; return a new map having the key: each-item, value: each-item doubled.
+;; reduce can also be used as a transformation function...
+
+;; one way to assign metadata to a function, is to prefix a map, before the func arg list
+;; this metadata can be for example a unit-test for that function:
+(use '[clojure.test :as suite])
+(defn call-twice
+  [f x]
+  (f x)
+  (f x))
+(call-twice (partial println) "some")
+
+;; on way to assign metadata to a function, is to prefix a map, before the func arg list
+;; this metadata can be for example a unit-test for that function:
+(defn join
+  {:test (fn[]
+           (assert (= (join ":" [1 2 3]) "1:333:1")))}
+  [sep coll]
+  (apply str (interpose sep coll)))
+
+;; interpose returns another coll using the sep sparsed in the coll, while applying str on coll, will concatenate
+;; and we have a join function, for which we provide an assertion test as func-metadata
+
+(suite/run-tests)
+;; actual: java.lang.AssertionError: Assert failed: (= (join ":" [1 2 3]) "1:333:1")
+
+(doc interpose)
+(interpose ":" [1 2 3]); (1 ":" 2 ":" 3) -> ret a lazy seq inlining the separator as a well
+
+(doc sort); [[coll] [comp coll]]; takes a comparator as well -> sorting on the same types!!!
+(sort [3 -1 -3 4 9])
+(sort < [3 -1 -3 4 9]); same as without the comparator
+(sort > [3 -1 -3 4 9]); from greatest to lower
+
+;; whenever there's need to sort, by establishing a comparator or mutual comparable things
+;; the [sort-by] comes in place:
+(sort-by :age [{:age 99} {:age 88} {:age 32}]); ({:age 32} {:age 88} {:age 99})
+
+(doc sort-by); the signature: [keyfunc coll] [keyfunc comp coll]
+
+(def plays [{:band "Burial", :plays 979, :loved 9}
+            {:band "Eno", :plays 2333, :loved 15}
+            {:band "Bill Evans", :plays 979, :loved 9} ])
+
+(def sort-by-loved-ratio (partial sort-by #(/ (:plays %) (:loved %))))
+(sort-by-loved-ratio plays)
+;({:band "Burial", :plays 979, :loved 9} {:band "Bill Evans", :plays 979, :loved 9} {:band "Eno", :plays 2333, :loved 15})
+
+(use '[clojure.string :as str])
+
+;; sorting by columns -> in the enumerated order(spreadsheet style)
+(sort-by (columns [:plays :loved :band]) plays)
+;; ({:band "Bill Evans", :plays 979, :loved 9} {:band "Burial", :plays 979, :loved 9} {:band "Eno", :plays 2333, :loved 15})
+(defn columns
+    [column-names]
+    (fn [each-row]
+      (vec (map each-row column-names))))
+
+;; similar with one-liner:
+(sort-by #(vec (map % [:band :plays :loved])) plays)
+;; understanding the complexity :) by de-composing
+(map {:name "cc" :age 33} [:name :age]); ("cc" 33)
+;; using the entire map as a func in the map that will return each value by :key
+({:name "cc" :age 33} :name); "cc"
+
+;;;;;;;;;;;;;;;;;;;;;;;
+;; 4clojure practice ;;
+;;;;;;;;;;;;;;;;;;;;;;;
+(let [ {:keys [head midd tail]} {:head 1 :midd 2 :tail 3}
+        inc-with-five (partial + 5)
+        res (map inc-with-five '(1 2 3) ) ]
+  res) ; (6 7 8)
+
+(let [hof (comp (partial filter #(> % 5)) list)]
+  (hof 3 4 5 6 7)) ; (6 7)
+
+;; Write a function which returns the last element in a sequence:
+((fn [[_ & tail]]
+    (last tail)) [1 3 4]) ; 4
+
+;; but dont use [last] !!! ok here's one using recursions:
+((fn [coll]
+  (loop [curr (first coll)
+         tail (rest coll)]
+    (if (empty? tail)
+        curr
+        (recur (first tail) (rest tail))))) [1 2 3])
+; 3
+
+;; and here's one deconstructing the init coll
+((fn [[head & tail]]
+    (if (empty? tail)
+        head
+        (recur (rest tail)))) [1 2 3])
+; 3
+
+;; or using the in-collection as a function -> to query by last-indice of the in-collection
+((fn [in-coll] (in-coll (dec (count in-coll)))) [1 2 3])
+; 3
+
+;; Write a function which returns the penultimate element from a sequence:
+( (fn [coll]
+    (coll (- (count coll) 2))) [1 2 3])
+
+((fn [[penultimate & tail :as init-coll]]
+    (if (empty? tail)
+      penultimate
+      (recur (rest init-coll) ))) [1 2 3])