Implemented TF-IDF algorithm

Implemented TF-IDF algorithm

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

--- src/seminarski/tfidf.clj
+++ src/seminarski/tfidf.clj
@@ -0,0 +1,182 @@
+(ns seminarski.tfidf
+  (:require [opennlp.nlp :as nlp]
+            [clj-fuzzy.stemmers :as stemmer]
+            [clojure.string :as string]
+            [clojure.set :as cljset]
+            [seminarski.scraping :as scrape]
+            [seminarski.settings :as settings]))
+
+(def tokenizer (nlp/make-tokenizer "models/en-token.bin"))
+(def name-finder (nlp/make-name-finder "models/en-ner-person.bin"))
+
+(defn stem [word]
+  (stemmer/porter word))
+
+(defn get-stop-words [file]
+  (set (tokenizer (slurp file))))
+
+(defn transform-to-lowercase [sentence]
+  (string/lower-case sentence))
+
+(defn filter-stop-words [stop-word-list tokens]
+  (remove stop-word-list tokens))
+
+(defn filter-person-names [tokens]
+  (remove
+    (set (seminarski.tfidf/name-finder tokens))
+    tokens))
+
+(defn process-single-document [doc]
+  (->> doc
+       (tokenizer)
+       (filter-person-names)
+       (map transform-to-lowercase)
+       (filter-stop-words (get-stop-words "util/stopwords.txt"))
+       (map stem)
+       (frequencies)))
+
+(defn partial-process [doc]
+  (->> doc
+       (map transform-to-lowercase)
+       (map stem)
+       (frequencies)))
+
+(defn calculate-tf-classic [frequence scale]
+  (let [frequence (or frequence 0)]
+    (/ frequence scale)))
+
+(defn calculate-tf-log [frequence scale]
+  (let [frequence (or frequence 0)]
+    (+ 1 (Math/log10 frequence))))
+
+(defn calculate-tf-normalize-by-max [frequence scale]
+  (let [frequence (or frequence 0)]
+    (+ 0.4 (* 0.6 (/ frequence scale)))))
+
+(defn calculate-idf [all-docs term]
+  (Math/log10
+    (/ (count all-docs) (count (filter #((:tokens %) term) all-docs)))))
+
+(defn get-all-terms [all-docs]
+  (reduce cljset/union #{}
+    (map #(set (keys (:tokens %))) all-docs)))
+
+(defn get-all-terms-with-frequencies [all-docs]
+  (reduce #(merge-with + %1 (:tokens %2)) {} all-docs))
+
+(defn calculate-idf-key-value [all-docs result-map term]
+  (assoc result-map term
+    (calculate-idf all-docs term)))
+
+(defn get-all-idfs "Get all terms with idf values bound to them" [all-docs all-terms]
+  (reduce (partial calculate-idf-key-value all-docs) {} all-terms))
+
+(defn calculate-tfidf [idf frequence scale tf-fn]
+  (* (tf-fn frequence scale) idf))
+
+(defn get-cast-list [casts]
+  (reduce #(assoc %1 (:imdb_code %2) 1) {} casts))
+
+ (defn add-key-value-pair [significance weight-by result-map key-value]
+   (let [[k v] key-value]
+     (assoc result-map k (* significance weight-by v))))
+
+ (defn get-weighted-attributes [weight-by terms significance]
+   (reduce
+     (partial add-key-value-pair significance weight-by) {} terms))
+
+ (defn merge-vectors [& maps]
+   (apply (partial merge-with +) maps))
+
+
+  (defn create-vector-for-tfidf [movie]
+   (let [description (process-single-document (:description movie))
+         reviews
+           (let [revs (:reviews movie)]
+             (if (empty? revs)
+               {}
+               (process-single-document (scrape/remove-stop-words (string/join " " (take 2 (:reviews movie)))))))
+         base (merge-vectors description reviews)
+         sum (reduce + (vals base))
+         actors (get-weighted-attributes sum (get-cast-list (:actors movie)) 0.05)
+         directors (get-weighted-attributes sum (get-cast-list (:directors movie)) 0.05)
+         title (get-weighted-attributes sum (process-single-document (:title movie)) 0.03)
+         genres (get-weighted-attributes sum (partial-process (:genres movie)) 0.05)
+         final-vector (merge-vectors base actors directors title genres)]
+     {:_id (:_id movie) :tokens final-vector}))
+
+(defn get-preprocessed-data [data]
+  (map create-vector-for-tfidf data))
+
+
+(defn tfidf-for-movie [tf-fn scale vocabulary movie]
+  (try
+      (assoc-in movie [:tokens]
+        (into {}
+          (map
+            (fn [[term freq]]
+              [term (calculate-tfidf (vocabulary term) freq scale tf-fn)])
+            (:tokens movie))))
+   (catch Exception e
+     (.printStackTrace e))))
+
+(defn tfidf-scale-by [scale-fn tf-fn vocabulary movie]
+  (let [scale (reduce scale-fn (vals (:tokens movie)))
+        scale-final (if(= 0 scale) 1 scale)]
+    (tfidf-for-movie tf-fn scale-final vocabulary movie)))
+
+
+(defn tfidf-for-all-without-cutoff "Calculate tfidf values for all movies" [movies vocabulary tfidf-fn]
+  (let [all-terms (get-all-terms vocabulary)
+        idfs (get-all-idfs movies all-terms)
+        tfidf-map (map (partial tfidf-fn idfs) movies)]
+    (spit (str "conf/tfidf" settings/tfidf-variation ".edn") (prn-str tfidf-map))
+    tfidf-map))
+
+(defn remove-words [col words-to-remove]
+     (apply dissoc col words-to-remove))
+
+(defn sort-fn [map-to-sort]
+  (into (sorted-map-by (fn [key1 key2]
+                             (compare
+                               [(get map-to-sort key1) key1]
+                               [(get map-to-sort key2) key2])))
+         map-to-sort))
+
+(defn tfidf-for-all-with-cutoff "Calculate tfidf values for all movies" [movies vocabulary tfidf-fn]
+  (let [all-terms (sort-fn (get-all-terms-with-frequencies vocabulary))
+        removal-percentage (Math/ceil (* settings/cutoff (count all-terms)))
+        words-to-remove (set (into (keys (take removal-percentage all-terms)) (keys (take-last removal-percentage all-terms))))
+        voc (cljset/difference (set (keys all-terms)) words-to-remove)
+        movies-final (map #(update-in % [:tokens] remove-words words-to-remove) movies)
+        idfs (get-all-idfs movies-final voc)
+        tfidf-map (map (partial tfidf-fn idfs) movies-final)]
+    (spit (str "conf/idf" settings/cutoff ".edn") (prn-str idfs))
+    (spit (str "conf/tfidf" settings/tfidf-variation ".edn") (prn-str tfidf-map))
+    tfidf-map))
+
+(defmulti tfidf-for-all
+  (fn [movies vocabulary tfidf-fn cutoff]
+    cutoff))
+
+(defmethod tfidf-for-all 0.0
+  [movies vocabulary tfidf-fn cutoff] (tfidf-for-all-without-cutoff movies vocabulary tfidf-fn))
+
+(defmethod tfidf-for-all :default
+  [movies vocabulary tfidf-fn cutoff] (tfidf-for-all-with-cutoff movies vocabulary tfidf-fn))
+
+(defmulti calculate-tfidf-for-all
+  (fn [movies vocabulary variation]
+    variation))
+
+(defmethod calculate-tfidf-for-all :classic
+  [movies vocabulary variation] (tfidf-for-all movies vocabulary (partial tfidf-scale-by + calculate-tf-classic) settings/cutoff))
+
+(defmethod calculate-tfidf-for-all :aug
+  [movies vocabulary variation] (tfidf-for-all movies vocabulary (partial tfidf-scale-by max calculate-tf-normalize-by-max) settings/cutoff))
+
+(defmethod calculate-tfidf-for-all :log
+  [movies vocabulary variation] (tfidf-for-all movies vocabulary (partial tfidf-for-movie calculate-tf-log 0) settings/cutoff))
+
+
+


util/simpledb.clj: interface to Amazon SimpleDB with Typica library

error: pathspec 'src/org/altlaw/util/simpledb.clj' did not match any file(s) known to git

--- src/org/altlaw/util/simpledb.clj
+++ src/org/altlaw/util/simpledb.clj
@@ -0,0 +1,69 @@
+(ns org.altlaw.util.simpledb
+  (:import (com.xerox.amazonws.sdb SimpleDB ItemAttribute)
+           (java.util ArrayList)))
+
+(defn- keystr [x]
+  (if (keyword? x) (name x) (str x)))
+
+(defn- make-attr-list [keyvals]
+  (let [attrs (ArrayList.)]
+    (doseq [[k v] keyvals]
+      (if (coll? v)
+        (do (.add attrs (ItemAttribute. (keystr k) (keystr (first v)) true))
+            (doseq [vv (rest v)]
+              (.add attrs (ItemAttribute. (keystr k) (keystr vv) false))))
+        (.add attrs (ItemAttribute. (keystr k) (keystr v) true))))
+    attrs))
+
+(defn- parse-attr-list [attrs]
+  (reduce (fn [m attr]
+            (let [k (.getName attr), v (.getValue attr)]
+              (assoc m k
+                     (let [old-v (m k)]
+                       (if old-v
+                         (if (coll? old-v)
+                           (conj old-v v)
+                           (vector old-v v))
+                         v)))))
+          {} attrs))
+
+(def #^{:doc "Returns the (cached) SimpleDB object."}
+     get-simpledb
+     (memoize (fn []
+                (SimpleDB. (System/getenv "AWS_ACCESS_KEY_ID")
+                           (System/getenv "AWS_SECRET_ACCESS_KEY")))))
+
+(def #^{:doc "Returns the (cached) SimpleDB Domain object for name."}
+     get-domain
+     (memoize (fn [name] (.getDomain (get-simpledb) (keystr name)))))
+
+(defn- get-item
+  "Returns the SimpleDB item object with the given name in the
+  domain."
+  [domain-name item-name]
+  (.getItem (get-domain domain-name) (keystr item-name)))
+
+(defn put-attrs
+  "Stores attributes (a map of key=>item or key=>collection) in the
+  item under the domain."
+  [domain-name item-name keyvals]
+  (let [item (get-item domain-name item-name)]
+    (.putAttributes item (make-attr-list keyvals))))
+
+(defn get-attrs
+  "Returns attributes (a map of key=>item or key=>collection) in the
+  item under the domain."
+  ([item] (parse-attr-list (.getAttributes item)))
+  ([domain-name item-name]
+     (let [item (get-item domain-name item-name)]
+       (parse-attr-list (.getAttributes item)))))
+
+(defn delete-item [domain-name item-name]
+  (.deleteItem (get-domain domain-name) (keystr item-name)))
+
+(defn list-items
+  ([domain-name]
+     (.getItemList (.listItems (get-domain domain-name))))
+  ([domain-name query-string]
+     (.getItemList (.listItems (get-domain domain-name)
+                               query-string))))


add data-web with prod functions

add data-web with prod functions

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

--- src/annual_weather/data_web.clj
+++ src/annual_weather/data_web.clj
@@ -0,0 +1,108 @@
+(ns annual-weather.data-web
+  (:import
+    java.util.Calendar
+    java.text.SimpleDateFormat)
+  (:require [clojure.java [io :as io]]
+            [clojure.data [json :as json]]
+            [clojure
+             [pprint :as pp]
+             [string]]
+            [org.httpkit.client :as http]
+            [schema
+             [core :as s]
+             [macros :as sm] ]
+            )
+  (:use [annual-weather data geocode utils]
+        [clj-utils.core]
+        [uncomplicate.fluokitten core jvm]))
+
+(def query-dates
+  {:startdate "1995-01-01"
+  :enddate   "2005-01-01" })
+
+(def query-d
+  {:datatypeid ["EMNT" "EMXT" "MMNT" "MMXT" "MNTM"]
+   :datasetid "GHCNDMS"})
+
+(defn query-first-n-results [n]
+  ; TODO why does this lie
+  {:limit (* 5 12 10)
+   :offset 0})
+
+(def query-n
+  "For a given city, this dataset appears to be an array of maps, each
+  conrtaining one datapoint.  The datapoints move through all
+  cateugories for a date, then advance"
+  (merge
+    query-dates
+    query-d
+    (query-first-n-results (* 5 12 10))))
+
+(def query-l (assoc query-n :stationid "GHCND:AJ000037985"))
+
+(def Bucketed {s/Any {s/Str [s/Int] } })
+
+(def D3-Schema [{:key s/Int
+                 :value {s/Str [s/Int] } }])
+
+; TODO is there a builtin for this?
+; Also not quite right.
+(defn vec-spread [& fns]
+  (fn [x]
+    (vec (map apply fns (repeat x)))))
+
+
+(let [df (SimpleDateFormat. "yyyy-MM-dd")]
+  (defn parse-ncdc-date [s]
+    (.parse df s)))
+
+; TODO for now group by month of year
+(defn bucket-date-str [s]
+  (.get (doto (Calendar/getInstance)
+          (.setTime (parse-ncdc-date s)))
+        Calendar/MONTH))
+
+; TODO do we need to merge now?
+(defn ncdc-data-seq-to-map [xs]
+  (apply merge-with concat
+        (for [x xs] {(x :datatype) [(x :value)]})))
+
+; TODO what is the input schema ?
+(sm/defn group-results :- Bucketed
+  [res]
+  (->> res
+       (group-by (comp bucket-date-str :date))
+       (fmap ncdc-data-seq-to-map)))
+
+(sm/defn groups-to-d3-style :- D3-Schema
+  [gs :- Bucketed]
+  (vec (for [[k v] gs] {:key k :value v})))
+
+(def->> data-for-human-location
+  (find-nearest-station query-n) ; find a station
+  :id
+  (assoc query-n :stationid)
+  (query-cdo :data) ; Ask for weather data
+  unpack-http-kit-json-res ; parse the response
+  :results)
+
+(def mock-data true)
+
+(defn api-handler []
+  (if mock-data
+    (read-string (slurp "la-data-d3"))
+    (-> "San Jose, CA"
+        data-for-human-location
+        group-results
+        groups-to-d3-style)))
+
+; TODO handle errors more pleasantly
+; Catch exceptions and serve up a nice response
+(defn search-handler [s]
+  (if mock-data
+    (read-string (slurp "la-data-d3"))
+    (-> s
+        ((fn [s] (println s) s) )
+        data-for-human-location
+        group-results
+        groups-to-d3-style)))


Add circuit beaker namespace

Add circuit beaker namespace

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

--- src/beehive/circuit_breaker.clj
+++ src/beehive/circuit_breaker.clj
@@ -0,0 +1,49 @@
+;; Copyright 2016 Timothy Brooks
+;;
+;; 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.
+
+(ns beehive.circuit-breaker
+  (:import (net.uncontended.precipice.circuit BreakerConfig
+                                              BreakerConfigBuilder
+                                              DefaultCircuitBreaker
+                                              NoOpCircuitBreaker)))
+
+(defn no-opt-breaker []
+  (NoOpCircuitBreaker.))
+
+(defn default-breaker
+  [{:keys [trailing-period-millis
+           failure-threshold
+           failure-percentage-threshold
+           backoff-time-millis
+           health-refresh-millis
+           sample-size-threshold]}]
+  (let [config (cond-> (BreakerConfigBuilder.)
+                       trailing-period-millis
+                       (.trailingPeriodMillis trailing-period-millis)
+
+                       failure-threshold
+                       (.failureThreshold failure-threshold)
+
+                       failure-percentage-threshold
+                       (.failurePercentageThreshold failure-percentage-threshold)
+
+                       backoff-time-millis
+                       (.backOffTimeMillis backoff-time-millis)
+
+                       health-refresh-millis
+                       (.healthRefreshMillis health-refresh-millis)
+
+                       sample-size-threshold
+                       (.sampleSizeThreshold sample-size-threshold))]
+    (DefaultCircuitBreaker. ^BreakerConfig (.build config))))


can equip items

can equip items

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


fix async pipeline

fix async pipeline

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


reorg

reorg

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


add the tree of turn

add the tree of turn

--- src/cljs/triboard/logic/turn.cljs
+++ src/cljs/triboard/logic/turn.cljs
@@ -66,3 +66,13 @@
       (with-available-moves)
       (with-next-player))
     turn))
+
+;; TODO - Available moves from the current position
+;; TODO - To be used inside the game
+
+(defn available-turns
+  "Transform the available moves into available turns"
+  [turn]
+  (move/map-game-tree
+    #(apply-moves turn %)
+    (move/available-transitions (:board turn))))


New output file.

New output file.

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


permission checks on annotation list & create endpoints.  list endpoint now supports filtering by object_model & id.

--- src/metabase/api/annotation.clj
+++ src/metabase/api/annotation.clj
@@ -1,5 +1,5 @@
 (ns metabase.api.annotation
-  (:require [korma.core :refer [where subselect fields]]
+  (:require [korma.core :as korma]
             [compojure.core :refer [defroutes GET PUT POST DELETE]]
             [medley.core :refer [mapply]]
             [metabase.api.common :refer :all]
@@ -12,17 +12,22 @@
             [metabase.util :as util]))

-(defendpoint GET "/" [org]
-  ;; TODO - permissions check
-  ;; TODO - filter by object_model
-  ;; TODO - filter by object_id
-  (check-400 org)
-  (-> (sel :many Annotation :organization_id org)
-    (hydrate :author)))
+(defendpoint GET "/" [org object_model object_id]
+  (require-params org)
+  (read-check Org org)
+  (if (and object_model object_id)
+    ;; caller wants annotations about a specific entity
+    (-> (sel :many Annotation :organization_id org :object_type object_model :object_id object_id (korma/order :start :DESC))
+      (hydrate :author))
+    ;; default is to return all annotations
+    (-> (sel :many Annotation :organization_id org (korma/order :start :DESC))
+      (hydrate :author))))

 (defendpoint POST "/" [:as {body :body}]
   (check-400 (util/contains-many? body :organization :start :end :title :body :annotation_type :object_type_id :object_id))
+  ;; user only needs to be member of an organization (read perms) to be able to post annotations
+  (read-check Org (:organization body))
   (check-500 (->> (-> body
                     (select-keys [:organization :title :body :annotation_type :object_type_id :object_id])
                     ;; NOTE - we need to parse string -> date


minor changes

minor 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/Zallin/fhirvc.git/'


bleh 2

bleh 2

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/OttoJursch/sched-system.git/'


Traits in progress

Traits in progress

error: pathspec 'src/edu/berkeley/ai/util/traits.clj' did not match any file(s) known to git

--- src/edu/berkeley/ai/util/traits.clj
+++ src/edu/berkeley/ai/util/traits.clj
@@ -0,0 +1,45 @@
+(ns edu.berkeley.ai.util.traits
+  (:require [edu.berkeley.ai.util :as util]))
+
+
+(defn- parse-protocols-and-method-pairs [args]
+  (when (seq args)
+    (let [[proto & rest] args
+          [methods more] (split-with coll? rest)]
+      (println proto)
+      (assert (symbol? proto))
+      (cons [proto methods]
+            (parse-protocols-and-method-pairs more)))))
+
+(defn- parse-protocols-and-methods [args]
+  (let [pairs (parse-protocols-and-method-pairs args)]
+    (assert (apply distinct? (cons nil (map first pairs))))
+    (into {} pairs)))
+
+(defn- parse-bindings [b]
+  (let [pairs (map vec (partition-all 2 b))]
+    (assert (apply distinct? (cons nil (map first pairs))))
+    (into {} pairs)))
+
+(defmacro deftrait [name child-traits state-bindings & protocols-and-methods]
+  `(def ~name
+        '[~(set child-traits) ~(parse-bindings state-bindings) ~(parse-protocols-and-methods protocols-and-methods)]))
+
+;(defmacro defrecord-trait [name fields ])
+
+(defn- merge-traits [traits]
+  (apply map apply
+         [clojure.set/union util/merge-disjoint util/merge-disjoint]
+         traits))
+
+(defn- expand-traits
+  "Expand out a set of traits into a single [binding-map impl-map]"
+  [traits]
+  (let [merged (merge-traits traits)]
+    (rest (merge-traits [merged (expand-traits (first merged))]))))
+
+
+
+(defmacro reify-traits [[& traits] specs]
+
+  )


orriz aldatzean azken iruzkinak kargatu

orriz aldatzean azken iruzkinak kargatu

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


state machine with mutual recursion

state machine with mutual recursion

error: pathspec 'src/sandbox/mr/statemachine.clj' did not match any file(s) known to git

--- src/sandbox/mr/statemachine.clj
+++ src/sandbox/mr/statemachine.clj
@@ -0,0 +1,37 @@
+(ns sandbox.mr.statemachine)
+
+(declare plasma vapor liquid solid)
+
+(defn plasma [[transition & rest-transitions]]
+  #(case transition
+     nil true
+     :deionization (vapor rest-transitions)
+     false))
+
+(defn vapor [[transition & rest-transitions]]
+  #(case transition
+     nil true
+     :condensation (liquid rest-transitions)
+     :deposition (solid rest-transitions)
+     :ionization (plasma rest-transitions)
+     false))
+
+(defn liquid [[transition & rest-transitions]]
+  #(case transition
+     nil true
+     :vaporization (vapor rest-transitions)
+     :freezing (solid rest-transitions)
+     false))
+
+(defn solid [[transition & rest-transitions]]
+  #(case transition
+     nil true
+     :melding (liquid rest-transitions)
+     :sublimation (vapor rest-transitions)
+     false))
+
+(def valid-sequence [:melding :vaporization :ionization :deionization])
+(def invalid-sequence [:vaporization :freezing])
+
+(trampoline solid valid-sequence)
+(trampoline liquid invalid-sequence)


Avoided copying hidden files

Avoided copying hidden files

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/hudren/ebook-novel.git/'


Add simple ~/.lein/profiles.clj that pulls in lein-exec

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

--- lein-profiles.clj
+++ lein-profiles.clj
@@ -0,0 +1,4 @@
+; This goes in ~/.lein/profiles.clj.
+; Run "$ lein" after saving this to get plugin
+{:user {:plugins [[lein-exec "0.3.6"]]}}
+


avere (to have): subject must be human

avere (to have): subject must be human

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


add multirember a lat

add multirember a lat

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/carolove/clojure-ring-app.git/'


start working on /catchup as a plugin, using PersistentQueues for db

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

--- src/subrosa/plugins/catchup.clj
+++ src/subrosa/plugins/catchup.clj
@@ -0,0 +1,100 @@
+(ns subrosa.plugins.catchup
+  (:use [subrosa.commands :only [defcommand]]
+        [subrosa.config :only [config]]
+        [subrosa.client]
+        [subrosa.hooks :only [add-hook]]
+        [clojure.contrib.condition :only [raise]])
+  (:import (java.util Date)
+           (java.text SimpleDateFormat)))
+
+(defn- format-date []
+  (.format (SimpleDateFormat. "yyyy-MM-dd") (Date.)))
+
+(defn- format-time []
+  (.format (SimpleDateFormat. "HH:mm:ss") (Date.)))
+
+(def msg-db-agent (agent {}))
+
+(def max-msgs-per-room 10)
+
+(defn- add-msg-fn [msg]
+  (fn update-msg-agent [db]
+    (let [room (:room msg)
+          text (str (format-date) ":" (format-time) ": " (:msg msg))]
+      (if (db room)
+        ;; have the room already
+        (do
+          (swap! (db room) (fn update-msg-atom [q]
+                             (conj (if (>= (count q) max-msgs-per-room)
+                                     (pop q)
+                                     q)
+                                   text)))
+          db)
+        ;; don't have the room
+        (assoc db room (atom (-> (clojure.lang.PersistentQueue/EMPTY)
+                                 (conj text))))))))
+
+(defn add-msg [room-name msg]
+  (println :adding msg :to room-name)
+  (send msg-db-agent
+        (add-msg-fn {:room room-name :msg msg})))
+
+(defn messages-for [room]
+  (if (@msg-db-agent room)
+    (seq @(@msg-db-agent room))
+    []))
+
+(defmulti catchup-dispatch (fn [& args] (first args)))
+
+(defmethod catchup-dispatch 'privmsg-room-hook [hook channel room-name msg]
+  (add-msg room-name (format "<%s> %s" (nick-for-channel channel) msg)))
+
+(defmethod catchup-dispatch 'join-hook [hook channel room-name]
+  (add-msg room-name
+           (format "--- join: %s (%s) joined %s"
+                   (nick-for-channel channel)
+                   (format-client channel)
+                   room-name)))
+
+(defmethod catchup-dispatch 'part-hook [hook channel room-name]
+  (add-msg room-name
+           (format "--- part: %s left %s"
+                   (nick-for-channel channel)
+                   room-name)))
+
+(defmethod catchup-dispatch 'quit-hook [hook channel quit-msg]
+  (doseq [room-name (rooms-for-nick (nick-for-channel channel))]
+    (add-msg room-name
+             (format "--- quit: %s (Quit: %s)"
+                     (nick-for-channel channel)
+                     (or quit-msg "Client Quit")
+                     room-name))))
+
+(defmethod catchup-dispatch 'nick-hook [hook channel old-nick new-nick]
+  (doseq [room-name (rooms-for-nick old-nick)]
+    (add-msg room-name
+             (format "--- nick: %s is now known as %s" old-nick new-nick))))
+
+(defmethod catchup-dispatch 'topic-hook [hook channel room-name old-topic
+                                         new-topic]
+  (add-msg room-name
+           (format "--- topic: %s set the topic to \"%s\""
+                   (nick-for-channel channel) new-topic)))
+
+(defn catchup-log [& args]
+  (apply catchup-dispatch args))
+
+(add-hook ::catchup 'privmsg-room-hook catchup-log)
+(add-hook ::catchup 'join-hook catchup-log)
+(add-hook ::catchup 'part-hook catchup-log)
+(add-hook ::catchup 'quit-hook catchup-log)
+(add-hook ::catchup 'nick-hook catchup-log)
+(add-hook ::catchup 'topic-hook catchup-log)
+
+(defcommand catchup [channel room]
+  (println :catchup room)
+  (if room
+    (println :msgs (messages-for room))
+    (raise {:type :client-error
+            :code 999
+            :msg ":No room given"})))


unit tests for /api/activity endpoints.

unit tests for /api/activity endpoints.

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

--- test/metabase/api/activity_test.clj
+++ test/metabase/api/activity_test.clj
@@ -0,0 +1,166 @@
+(ns metabase.api.activity-test
+  "Tests for /api/activity endpoints."
+  (:require [expectations :refer :all]
+            [metabase.db :as db]
+            [metabase.http-client :refer :all]
+            (metabase.models [activity :refer [Activity]]
+                             [card :refer [Card]]
+                             [dashboard :refer [Dashboard]]
+                             [view-log :refer [ViewLog]])
+            [metabase.test.data :refer :all]
+            [metabase.test.data.users :refer :all]
+            [metabase.test.util :refer [match-$ expect-eval-actual-first random-name with-temp]]
+            [metabase.util :as u]))
+
+;; GET /
+
+; Things we are testing for:
+;  1. ordered by timestamp DESC
+;  2. :user and :model_exists are hydrated
+
+; NOTE: timestamp matching was being a real PITA so I cheated a bit.  ideally we'd fix that
+(expect-let [activity1 (db/ins Activity
+                         :topic     "install"
+                         :details   {}
+                         :timestamp (u/parse-iso8601 "2015-09-09T12:13:14.888Z"))
+             activity2 (db/ins Activity
+                         :topic     "dashboard-create"
+                         :user_id   (user->id :crowberto)
+                         :model     "dashboard"
+                         :model_id  1234
+                         :details   {:description  "Because I can!"
+                                     :name         "Bwahahaha"
+                                     :public_perms 2}
+                         :timestamp (u/parse-iso8601 "2015-09-10T18:53:01.632Z"))
+             activity3 (db/ins Activity
+                         :topic     "user-joined"
+                         :user_id   (user->id :rasta)
+                         :model     "user"
+                         :details   {}
+                         :timestamp (u/parse-iso8601 "2015-09-10T05:33:43.641Z"))]
+  [(match-$ (db/sel :one Activity :id (:id activity2))
+     {:id           $
+      :topic        "dashboard-create"
+      :user_id      $
+      :user         (match-$ (fetch-user :crowberto)
+                      {:id           (user->id :crowberto)
+                       :email        $
+                       :date_joined  $
+                       :first_name   $
+                       :last_name    $
+                       :last_login   $
+                       :is_superuser $
+                       :common_name  $})
+      :model        $
+      :model_id     $
+      :model_exists false
+      :database_id  nil
+      :database     nil
+      :table_id     nil
+      :table        nil
+      :custom_id    nil
+      :details      $})
+   (match-$ (db/sel :one Activity :id (:id activity3))
+     {:id           $
+      :topic        "user-joined"
+      :user_id      $
+      :user         (match-$ (fetch-user :rasta)
+                      {:id           (user->id :rasta)
+                       :email        $
+                       :date_joined  $
+                       :first_name   $
+                       :last_name    $
+                       :last_login   $
+                       :is_superuser $
+                       :common_name  $})
+      :model        $
+      :model_id     $
+      :model_exists nil
+      :database_id  nil
+      :database     nil
+      :table_id     nil
+      :table        nil
+      :custom_id    nil
+      :details      $})
+   (match-$ (db/sel :one Activity :id (:id activity1))
+     {:id           $
+      :topic        "install"
+      :user_id      nil
+      :user         nil
+      :model        $
+      :model_id     $
+      :model_exists nil
+      :database_id  nil
+      :database     nil
+      :table_id     nil
+      :table        nil
+      :custom_id    nil
+      :details      $})]
+  (->> ((user->client :crowberto) :get 200 "activity")
+       (map #(dissoc % :timestamp))))
+
+
+;; GET /recent_views
+
+; Things we are testing for:
+;  1. ordering is sorted by most recent
+;  2. results are filtered to current user
+;  3. `:model_object` is hydrated in each result
+;  4. we filter out entries where `:model_object` is nil (object doesn't exist)
+
+(defn- create-card []
+  (db/ins Card
+    :name                   "rand-name"
+    :creator_id             (user->id :crowberto)
+    :public_perms           2
+    :display                "table"
+    :dataset_query          {}
+    :visualization_settings {}))
+
+(defn- create-dash []
+  (db/ins Dashboard
+    :name         "rand-name"
+    :description  "rand-name"
+    :creator_id   (user->id :crowberto)
+    :public_perms 2))
+
+(expect-let [card1 (create-card)
+             dash1 (create-dash)
+             card2 (create-card)]
+  [{:cnt      1
+    :user_id  (user->id :crowberto)
+    :model    "card"
+    :model_id (:id card1)
+    :model_object {:id          (:id card1)
+                   :name        (:name card1)
+                   :description (:description card1)
+                   :display     (name (:display card1))}}
+   {:cnt      1
+    :user_id  (user->id :crowberto)
+    :model    "dashboard"
+    :model_id (:id dash1)
+    :model_object {:id          (:id dash1)
+                   :name        (:name dash1)
+                   :description (:description dash1)}}
+   {:cnt      1
+    :user_id  (user->id :crowberto)
+    :model    "card"
+    :model_id (:id card2)
+    :model_object {:id          (:id card2)
+                   :name        (:name card2)
+                   :description (:description card2)
+                   :display     (name (:display card2))}}]
+  (let [create-view (fn [user model model-id]
+                      (db/ins ViewLog
+                        :user_id  user
+                        :model    model
+                        :model_id model-id
+                        :timestamp (u/new-sql-timestamp)))]
+    (do
+      (create-view (user->id :crowberto) "card" (:id card2))
+      (create-view (user->id :crowberto) "dashboard" (:id dash1))
+      (create-view (user->id :crowberto) "card" (:id card1))
+      (create-view (user->id :crowberto) "card" 36478)
+      (create-view (user->id :rasta) "card" (:id card1))
+      (->> ((user->client :crowberto) :get 200 "activity/recent_views")
+           (map #(dissoc % :max_ts))))))


added data.csv-test

added data.csv-test

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

--- test/clojure/data/csv_test.cljc
+++ test/clojure/data/csv_test.cljc
@@ -0,0 +1,79 @@
+(ns clojure.data.csv-test
+  (:require
+   #?(:clj [clojure.test :refer [deftest is]]
+      :cljs [cljs.test :refer-macros [deftest is]])
+   [clojure.data.csv :refer [read-csv write-csv]])
+  (:import #?(:clj [java.io Reader StringReader StringWriter EOFException]
+              :cljs [])))
+
+(def ^{:private true} simple
+  "Year,Make,Model
+1997,Ford,E350
+2000,Mercury,Cougar
+")
+
+(def ^{:private true} simple-alt-sep
+  "Year;Make;Model
+1997;Ford;E350
+2000;Mercury;Cougar
+")
+
+(def ^{:private true} complicated
+  "1997,Ford,E350,\"ac, abs, moon\",3000.00
+1999,Chevy,\"Venture \"\"Extended Edition\"\"\",\"\",4900.00
+1999,Chevy,\"Venture \"\"Extended Edition, Very Large\"\"\",\"\",5000.00
+1996,Jeep,Grand Cherokee,\"MUST SELL!
+air, moon roof, loaded\",4799.00")
+
+(deftest reading
+  (let [csv (read-csv simple)]
+    (is (= (count csv) 3))
+    (is (= (count (first csv)) 3))
+    (is (= (first csv) ["Year" "Make" "Model"]))
+    (is (= (last csv) ["2000" "Mercury" "Cougar"])))
+  (let [csv (read-csv simple-alt-sep :separator \;)]
+    (is (= (count csv) 3))
+    (is (= (count (first csv)) 3))
+    (is (= (first csv) ["Year" "Make" "Model"]))
+    (is (= (last csv) ["2000" "Mercury" "Cougar"])))
+  (let [csv (read-csv complicated)]
+    (is (= (count csv) 4))
+    (is (= (count (first csv)) 5))
+    (is (= (first csv)
+           ["1997" "Ford" "E350" "ac, abs, moon" "3000.00"]))
+    (is (= (last csv)
+           ["1996" "Jeep" "Grand Cherokee", "MUST SELL!\nair, moon roof, loaded" "4799.00"]))))
+
+(defn create-stringwriter []
+  #?(:clj (StringWriter.)
+     :cljs (clojure.data.csv/Writer. "")))
+
+(deftest reading-and-writing
+  (let [string-writer (create-stringwriter)]
+    (->> simple read-csv (write-csv string-writer))
+    (is (= simple
+	   (str string-writer)))))
+
+(deftest throw-if-quoted-on-eof
+  (let [s "ab,\"de,gh\nij,kl,mn"]
+    (is (thrown-with-msg? #?(:clj java.io.EOFException :cljs js/Error)
+                          #"CSV error \(unexpected end of file\)"
+                          (doall (read-csv s))))))
+
+(deftest parse-line-endings
+  (let [csv (read-csv "Year,Make,Model\n1997,Ford,E350")]
+    (is (= 2 (count csv)))
+    (is (= ["Year" "Make" "Model"] (first csv)))
+    (is (= ["1997" "Ford" "E350"] (second csv))))
+  (let [csv (read-csv "Year,Make,Model\r\n1997,Ford,E350")]
+    (is (= 2 (count csv)))
+    (is (= ["Year" "Make" "Model"] (first csv)))
+    (is (= ["1997" "Ford" "E350"] (second csv))))
+  (let [csv (read-csv "Year,Make,Model\r1997,Ford,E350")]
+    (is (= 2 (count csv)))
+    (is (= ["Year" "Make" "Model"] (first csv)))
+    (is (= ["1997" "Ford" "E350"] (second csv))))
+  (let [csv (read-csv "Year,Make,\"Model\"\r1997,Ford,E350")]
+    (is (= 2 (count csv)))
+    (is (= ["Year" "Make" "Model"] (first csv)))
+    (is (= ["1997" "Ford" "E350"] (second csv)))))


Add an integration test for victorops

Add an integration test for victorops

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

--- test/riemann/victorops_test.clj
+++ test/riemann/victorops_test.clj
@@ -0,0 +1,43 @@
+(ns riemann.victorops-test
+  (:use riemann.victorops
+        clojure.test)
+  (:require [riemann.logging :as logging]))
+
+(def api-key (System/getenv "VICTOROPS_API_KEY"))
+(def routing-key (System/getenv "VICTOROPS_ROUTING_KEY"))
+
+(when-not api-key
+  (println "export VICTOROPS_API_KEY=\"...\" to run these tests."))
+
+(when-not routing-key
+  (println "export VICTOROPS_ROUTING_KEY=\"...\" to run these tests."))
+
+(logging/init)
+
+(deftest ^:victorops ^:integration test-info
+  (let [vo (victorops api-key routing-key)]
+    ((:info vo) {:host "localhost"
+                :service "victorops info notification"
+                :metric 42
+                :state "info"})))
+
+(deftest ^:victorops ^:integration test-recovery
+  (let [vo (victorops api-key routing-key)]
+    ((:recovery vo) {:host "localhost"
+                    :service "victorops recovery notification"
+                    :metric 0.5
+                    :state "ok"})))
+
+(deftest ^:victorops ^:integration test-warning
+  (let [vo (victorops api-key routing-key)]
+    ((:warning vo) {:host "localhost"
+                    :service "victorops warning notification"
+                    :metric 0.5
+                    :state "warning"})))
+
+(deftest ^:victorops ^:integration test-critical
+  (let [vo (victorops api-key routing-key)]
+    ((:critical vo) {:host "localhost"
+                    :service "victorops critical notification"
+                    :metric 0.5
+                    :state "critical"})))


refactor customization import to be not require new code

uses "custom-<name>-<lang>" naming convention; format-field -> insert-row-field

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


Add :play command to play currently loaded score

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


Updated other gene type assertion rule

Updated other gene type assertion rule

Cannot complete rule until I know what SO concept to subclass

error: pathspec 'resources/rules/post_identifier_merge/ice_to_bio/other_gene_type_assertions.clj' did not match any file(s) known to git

--- resources/rules/post_identifier_merge/ice_to_bio/other_gene_type_assertions.clj
+++ resources/rules/post_identifier_merge/ice_to_bio/other_gene_type_assertions.clj
@@ -0,0 +1,22 @@
+;; ---------------------------------------------
+;; --------- Other Gene Type Assertion ---------
+;; ---------------------------------------------
+`{:name "other-gene-type-assertion"
+  :description "This rule asserts other gene type"
+  :head ((?/gene rdfs/subClassOf obo/XXXXXXX)) ; other maps to kso:DNA_Sequence
+
+  :body ((?/record rdf/type ccp/IAO_EXT_0000681) ; ccp:NCBI_gene_info_record
+       (?/record obo/BFO_0000051 ?/dna_field_value) ; BFO:has_part
+       (?/gene_field_value rdf/type ccp/IAO_EXT_0000876) ; ccp:NCBI_gene_info_record__gene_identifier_field_value
+       (?/gene_field_value rdf/type ?/gene_ice_id)
+       (?/gene_ice_id obo/IAO_0000219 ?/gene) ; IAO:denotes
+
+       ;; retrieve gene type
+       (?/record obo/BFO_0000051 ?/type_field_value) ; BFO:has_part
+       (?/type_field_value rdf/type ccp/IAO_EXT_0000884) ; ccp:NCBI_gene_info_record__type_of_gene_field_value
+       (?/type_field_value rdf/type ?/type_ice_id)
+       (?/type_ice_id obo/IAO_0000219 ?/type) ; IAO:denotes
+
+       (= ?/type "other"))
+
+  }


add-files! Only send notification if `files' isn't empty.

fatal: unable to access 'https://github.com/DR-YangLong/pepa.git/': The requested URL returned error: 403


enhanced schema, began refactoring entity persistence into own area

error: pathspec 'src/credo/api/database/init.clj' did not match any file(s) known to git

--- src/credo/api/database/init.clj
+++ src/credo/api/database/init.clj
@@ -0,0 +1,139 @@
+(ns credo.api.database.init
+  (:require [datomic.api :as d]
+            [noir.io :as io]))
+
+;;database
+(def uri "datomic:mem://credo")
+
+(d/delete-database uri)
+(d/create-database uri)
+
+(def conn (d/connect uri))
+
+;;initialize schema
+(defn init-schema []
+  (d/transact conn  (read-string (io/slurp-resource "/schemata/schema.edn"))))
+
+(init-schema)
+
+(defn init-users []
+  (let [t       [{:db/id (d/tempid :db.part/user)
+                  :person/account (java.net.URI. "http://test.credo.io")
+                  :person/firstName "oliver"
+                  :person/lastName "gorman"
+                  :person/email "oli@test.credo.io"
+                  :person.metrics/height 0.0
+                  :person.metrics/weight 0.0}
+                 {:db/id (d/tempid :db.part/user)
+                  :person/account (java.net.URI. "http://test.credo.io")
+                  :person/firstName "glenn"
+                  :person/lastName "bates"
+                  :person/email "glenn@test.credo.io"
+                  :person.metrics/height 0.0
+                  :person.metrics/weight 0.0}
+                 {:db/id (d/tempid :db.part/user)
+                  :person/account (java.net.URI. "http://test.credo.io")
+                  :person/firstName "mike"
+                  :person/lastName "nuteson"
+                  :person/email "mike@test.credo.io"
+                  :person.metrics/height 0.0
+                  :person.metrics/weight 0.0}
+                 {:db/id (d/tempid :db.part/user)
+                  :person/account (java.net.URI. "http://test.credo.io")
+                  :person/firstName "luis"
+                  :person/lastName "andrade"
+                  :person/email "luis@test.credo.io"
+                  :person.metrics/height 0.0
+                  :person.metrics/weight 0.0}
+                 {:db/id (d/tempid :db.part/user)
+                  :person/account (java.net.URI. "http://test.credo.io")
+                  :person/firstName "christian"
+                  :person/lastName "anschuetz"
+                  :person/email "christian@test.credo.io"
+                  :person.metrics/height 0.0
+                  :person.metrics/weight 0.0}]
+        tx      @(d/transact conn t)]
+    ;;(d/touch (d/entity db  (d/resolve-tempid db (:tempids tx) tID)))
+    (str tx)))
+
+(init-users)
+
+(defn init-programs []
+  (let [t       [{:db/id (d/tempid :db.part/user)
+                  :program/id (d/squuid)
+                  :program/name "science... it works"
+                  :program/description "a science based approach to better health"
+                  :program/parameters [{:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will get 8 hours of sleep every day"}
+                                       {:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will do 15 minutes of interval sprints 3 times a week"}
+                                       {:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will do stronglifts 5x5 workouts 3 times a week"}
+                                       {:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will only consume my target calories"}
+                                       {:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will drink 3l of water per day"}]
+                  :program/type :program.type/public}
+                 {:db/id (d/tempid :db.part/user)
+                  :program/id (d/squuid)
+                  :program/name "kmetz crossfit 722"
+                  :program/description "the way of the cross"
+                  :program/parameters [{:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will get 8 hours of sleep every day"}
+                                       {:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will do 15 minutes of interval sprints 3 times a week"}
+                                       {:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will do stronglifts 5x5 workouts 3 times a week"}]
+                  :program/type :program.type/public}]
+        tx      @(d/transact conn t)]
+    ;;(d/touch (d/entity db  (d/resolve-tempid db (:tempids tx) tID)))
+    (str tx)))
+
+(init-programs)
+
+(defn init-challenge []
+  (let [t       [{:db/id (d/tempid :db.part/user)
+                  :challenge/id (d/squuid)
+                  :program/name "science... it works"
+                  :program/description "a science based approach to better health"
+                  :program/parameters [{:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will get 8 hours of sleep every day"}
+                                       {:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will do 15 minutes of interval sprints 3 times a week"}
+                                       {:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will do stronglifts 5x5 workouts 3 times a week"}
+                                       {:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will only consume my target calories"}
+                                       {:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will drink 3l of water per day"}]
+                  :program/type :program.type/public}
+                 {:db/id (d/tempid :db.part/user)
+                  :program/id (d/squuid)
+                  :program/name "kmetz crossfit 722"
+                  :program/description "the way of the cross"
+                  :program/parameters [{:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will get 8 hours of sleep every day"}
+                                       {:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will do 15 minutes of interval sprints 3 times a week"}
+                                       {:program.parameter/id (d/squuid)
+                                        :program.parameter/text
+                                        "I will do stronglifts 5x5 workouts 3 times a week"}]
+                  :program/type :program.type/public}]
+        tx      @(d/transact conn t)]
+    ;;(d/touch (d/entity db  (d/resolve-tempid db (:tempids tx) tID)))
+    (str tx)))


export recent badges and pages

export recent badges and pages

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


Calculate wiki ngrams

Calculate wiki ngrams

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

--- src/clojure/real_wsdm/wiki_ngrams.clj
+++ src/clojure/real_wsdm/wiki_ngrams.clj
@@ -0,0 +1,36 @@
+(ns real-wsdm.wiki-ngrams
+  (:require [clojure.java.io :as io]
+            [real-wsdm.galago-util :refer :all]
+            [clojure.string :as str]))
+
+(defn extract-ngrams
+  [tokens]
+  (concat
+    (map list tokens)
+    (partition 2 1 tokens)
+    (partition 3 1 tokens)))
+
+(defn add-ngram
+  [ngram-count ngram]
+  (let [old-value (get ngram-count ngram 0)]
+    (assoc ngram-count ngram (inc old-value))))
+
+(defn add-ngrams
+  [ngram-count ngrams]
+  (reduce
+    add-ngram
+    ngram-count
+    ngrams))
+
+(defn ngram-count
+  [lines]
+  (reduce
+    add-ngrams
+    {}
+    (map #(->> % tokenize (map stem) extract-ngrams) lines)))
+
+(defn -main
+  [wiki-titles-path]
+  (with-open [rdr (io/reader wiki-titles-path)]
+    (doseq [[:ngram count] (ngram-count (line-seq rdr))]
+      (println (str (str/join " " ngram) "\t" count)))))


[#818] user-auth store

[#818] user-auth store

error: pathspec 'Dashboard/app/cljs/src/org/akvo/flow/dashboard/user_auth/store.cljs' did not match any file(s) known to git

--- Dashboard/app/cljs/src/org/akvo/flow/dashboard/user_auth/store.cljs
+++ Dashboard/app/cljs/src/org/akvo/flow/dashboard/user_auth/store.cljs
@@ -0,0 +1,53 @@
+(ns org.akvo.flow.dashboard.user-auth.store
+  (:require  [clojure.set :as set]
+             [org.akvo.flow.dashboard.app-state :refer (app-state)]
+             [org.akvo.flow.dashboard.dispatcher :as dispatcher]
+             [org.akvo.flow.dashboard.ajax-helpers :as ajax]
+             [ajax.core :refer (GET POST PUT DELETE)])
+  (:require-macros [org.akvo.flow.dashboard.dispatcher :refer (dispatch-loop)]))
+
+
+(defn get-by-user-id [user-auth user-id]
+  {:pre [(integer? user-id)]}
+  (get-in user-auth [:by-user-id user-id]))
+
+
+
+(dispatch-loop
+ :user-auth/fetch _
+ (GET "/rest/user_auth"
+      (merge ajax/default-ajax-config
+             {:handler (fn [response]
+                         (let [user-auth (get response "user_auth")]
+                           (swap! app-state assoc-in [:user-auth :by-id]
+                                  (ajax/index-by "keyId" user-auth))
+                           (swap! app-state assoc-in [:user-auth :by-user-id]
+                                  (group-by #(get % "userId") user-auth))))})))
+
+(dispatch-loop
+ :user-auth/create auth
+ (let [{:keys [user role object-path]} auth]
+   (assert (integer? user))
+   (assert (integer? role))
+   (assert (string? object-path))
+   (POST "/rest/user_auth"
+         (merge ajax/default-ajax-config
+                {:params {"userId" user
+                          "roleId" role
+                          "objectPath" object-path}
+                 :handler (fn [{:strs [user_auth]}]
+                            (swap! app-state assoc-in [:user-auth :by-id (get user_auth "keyId")] user_auth)
+                            (swap! app-state update-in [:user-auth :by-user-id (get user_auth "userId")] conj user_auth))}))))
+
+(dispatch-loop
+ :user-auth/delete user-auth
+ (let [key-id (get user-auth "keyId")
+       user-id (get user-auth "userId")]
+    (assert (integer? (get user-auth "keyId")))
+    (DELETE (str "/rest/user_auth/" key-id)
+            (merge ajax/default-ajax-config
+                   {:handler (fn [_]
+                               (swap! app-state update-in [:user-auth :by-id] dissoc key-id)
+                               (swap! app-state update-in [:user-auth :by-user-id user-id]
+                                      (fn [user-auths]
+                                        (vec (remove #(= (get % "keyId") key-id) user-auths)))))}))))


[WM] Bump ext. service timeout to 10s

[WM] Bump ext. service timeout to 10s

fatal: unable to access 'https://github.com/democracyworks/election-http-api.git/': The requested URL returned error: 403


Use refresh-all in user.clj to avoid user not getting reloaded.

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


yggdrasil.parser now successfully separates a score into instruments


Mezua aldatu

Mezua aldatu

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


Version 0.5.0

Version 0.5.0

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject sablono "0.5.0-SNAPSHOT"
+(defproject sablono "0.5.0"
   :description "Lisp style templating for Facebook's React."
   :url "http://github.com/r0man/sablono"
   :author "r0man"


:smiley_cat: release 0.1.0

:smiley_cat: release 0.1.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/HealthUnlocked/lein-docker-compose.git/'


0.0.2

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


fix dependency

fix dependency

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


0.8.2-wip5

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject storm "0.8.2-wip4"
+(defproject storm "0.8.2-wip5"
   :source-path "src/clj"
   :test-path "test/clj"
   :java-source-path "src/jvm"


Initial commit of rule to generate ICE records for each object property

error: pathspec 'kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/pre-identifier-merge/step_a-ontology_to_ice/step_c/object_property_record_gen.clj' did not match any file(s) known to git

--- kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/pre-identifier-merge/step_a-ontology_to_ice/step_c/object_property_record_gen.clj
+++ kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/pre-identifier-merge/step_a-ontology_to_ice/step_c/object_property_record_gen.clj
@@ -0,0 +1,39 @@
+;; -----------------------------------------------
+;; --------- Object Property Record Gen ---------
+;; -----------------------------------------------
+`{:name "object-property-record-gen"
+  :description "This rule generates an instance of an Object Property
+  Record (IAO_EXT_0000310) for each object property, including field
+  values for the property identifier, definition, and label."
+  :head ((?/record rdf/type ccp/IAO_EXT_0000310) ;; ccp:object property record
+         (?/record obo/BFO_0000051 ?/id_field_value) ; obo:has part
+         (?/id_field_value rdf/type ccp/IAO_EXT_0000314) ; ccp:object property id field value
+         (?/id_field_value rdf/type ?/id)
+         (?/id_field_value rdfs/label ?/bound_id_string)
+         (?/record obo/BFO_0000051 ?/definition_field_value) ; obo:has part
+         (?/definition_field_value rdf/type ccp/IAO_EXT_0000313) ; ccp:object property record definition field value
+         (?/definition_field_value rdfs/label ?/bound_definition)
+         (?/record obo/BFO_0000051 ?/label_field_value)
+         (?/label_field_value rdf/type ccp/IAO_EXT_0000315) ; ccp:object property record label field value
+         (?/label_field_value rdfs/label ?/bound_label))
+  :reify ([?/record {:ln (:sha-1 ?/id)
+                    :ns "ccp" :prefix "R_" :suffix ""}]
+           [?/id_field_value {:ln (:sha-1 ?/id)
+               :ns "ccp" :prefix "F_" :suffix ""}]
+           [?/definition_field_value {:ln (:sha-1 ?/bound_definition)
+               :ns "ccp" :prefix "F_" :suffix ""}]
+           [?/label_field_value {:ln (:sha-1 ?/bound_label)
+               :ns "ccp" :prefix "F_" :suffix ""}])
+  :sparql-string "prefix ccp: <http://ccp.ucdenver.edu/obo/ext/>
+                  prefix obo: <http://purl.obolibrary.org/obo/>
+                  prefix oboInOwl: <http://www.geneontology.org/formats/oboInOwl#>
+                  select ?id ?property ?bound_definition ?bound_label ?bound_id_string {
+                  ?id rdf:type ccp:IAO_EXT_0000306 .
+                  ?id obo:IAO_0000219 ?property .
+                  optional {?property obo:IAO_0000115 ?definition } .
+                  optional {?property rdfs:label ?label } .
+                  optional {?property oboInOwl:id ?id_string } .
+                  bind(IF(bound(?definition), ?definition, 'no definition') as ?bound_definition) .
+                  bind(IF(bound(?id_string), ?id_string, 'no id string') as ?bound_id_string) .
+                  bind(IF(bound(?label), ?label, 'no label') as ?bound_label) .
+                  }" }


Example: Trace context from Christian Meschke

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

error: pathspec 'doc/examples/trace-context.clj' did not match any file(s) known to git

--- doc/examples/trace-context.clj
+++ doc/examples/trace-context.clj
@@ -0,0 +1,40 @@
+;;; Daniel Borchmann, 2011
+;;; This file is in the public domain.
+
+(use 'conexp.main)
+
+;;;
+
+(defn trace-context
+  "Returns the trace context of ctx-S in ctx-K."
+  [ctx-S ctx-K]
+  (let [H    (set-of [h 1] | h (objects ctx-S)),
+        N    (set-of [n 1] | n (attributes ctx-S)),
+        G    (set-of [g 2] | g (objects ctx-K)),
+        M    (set-of [m 2] | m (attributes ctx-K)),
+        I_HN (set-of [[g 1] [m 1]] | [g m] (incidence ctx-K)
+                                     :when (and (contains? H [g 1])
+                                                (contains? N [m 1]))),
+        I_GN (set-of [[g 2] [m 1]] | [g m] (incidence ctx-K)
+                                     :when (and (contains? G [g 2])
+                                                (contains? N [m 1]))),
+        I_HM (set-of [[g 1] [m 2]] | [g m] (incidence ctx-K)
+                                     :when (and (contains? H [g 1])
+                                                (contains? M [m 2]))),
+        I_GM (incidence
+              (smallest-bond (make-context-nc G N I_GN)
+                             (make-context-nc H M I_HM)
+                             (set-of [[g 2] [m 2]] | [g m] (incidence ctx-K))))]
+    (make-context-nc (union H G)
+                     (union N M)
+                     (union I_HN I_GN I_HM I_GM))))
+
+(defn interval-context
+  "Returns the formal context representing the interval induced by the pair [E F] in the concept
+  lattice of ctx."
+  [ctx [E F]]
+  (make-context (aprime ctx F) (oprime ctx E) (incidence ctx)))
+
+;;;
+
+nil


changes

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/clojure-ml/cml.git/'


CMR-3050: Add primary keys to three metadata_db tables

error: pathspec 'metadata-db-app/src/migrations/046_add_primary_keys_to_providers_and_work_tables.clj' did not match any file(s) known to git

--- metadata-db-app/src/migrations/046_add_primary_keys_to_providers_and_work_tables.clj
+++ metadata-db-app/src/migrations/046_add_primary_keys_to_providers_and_work_tables.clj
@@ -0,0 +1,24 @@
+(ns migrations.046-add-primary-keys-to-providers-and-work-tables
+  "Adds primary keys to three database tables."
+  (:require [config.mdb-migrate-helper :as h]))
+
+(defn up
+  "Migrates the database up to version 46."
+  []
+  (println "migrations.046-add-primary-keys-to-providers-and-work-tables up...")
+  (h/sql "alter table providers drop constraint unique_provider_id")
+  (h/sql "alter table providers add constraint providers_pk primary key (provider_id)")
+  (h/sql (str "alter table sync_delete_work add constraint sync_delete_work_pk "
+              "primary key (concept_id, revision_id)"))
+  (h/sql (str "alter table get_concepts_work_area add constraint get_concepts_work_area_pk "
+              "primary key (concept_id, revision_id)")))
+
+(defn down
+  "Migrates the database down from version 46."
+  []
+  (println "migrations.046-add-primary-keys-to-providers-and-work-tables down...")
+  (h/sql "alter table providers drop constraint providers_pk")
+  (h/sql (str "alter table providers add constraint unique_provider_id unique(provider_id) "
+              "using index (create unique index provider_id_index on providers(provider_id))"))
+  (h/sql "alter table sync_delete_work drop constraint sync_delete_work_pk")
+  (h/sql "alter table get_concepts_work_area drop constraint get_concepts_work_area_pk"))


remove excess space

remove excess space

--- test/metabase/api/user_test.clj
+++ test/metabase/api/user_test.clj
@@ -7,7 +7,6 @@
                       [test-utils :refer [deserialize-dates match-$]])))

 (def rasta-org-perm-id (delay (sel :one :id OrgPerm :organization_id @org-id :user_id (user->id :rasta))))
-

 ;; ## GET /api/user/current


Solve Distance in clojure

Solve Distance in clojure

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

--- solutions/uri/1016/1016.clj
+++ solutions/uri/1016/1016.clj
@@ -0,0 +1,8 @@
+(ns main)
+
+(defn main []
+  (let [n (read-line)
+        n' (Integer/parseInt n)]
+    (printf "%d minutos%n" (* (quot 150 60) n'))))
+
+(main)


Fix small indentation issue

Fix small indentation issue

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 new core file

Add new core file

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

--- src/clj/introspect/core.clj
+++ src/clj/introspect/core.clj
@@ -0,0 +1,52 @@
+(ns introspect.core
+  (:import [introspect IntrospectProfilingAgent Interceptor])
+  (:require [introspect.stacktrace :as stacktrace]))
+
+
+(def method-calls (atom {}))
+
+(def format-signature #(str "(" (clojure.string/join " -> " %) ")"))
+(def join-with-newline #(clojure.string/join "\n\t" %))
+
+(defn get-type
+  [a]
+  (if (fn? a)
+    clojure.lang.IFn
+    (type a)))
+
+(defn introspect-function
+  [class-name args return-value]
+  (let [current-call-types  (conj (map get-type args) (type return-value))
+        previous-call-types (get @method-calls class-name)]
+    ;; (println current-call-types)
+    (when (and (not (empty? previous-call-types))
+               (nil? (get previous-call-types current-call-types))
+               ;; TODO: check for subclassing
+               )
+      (println
+       (str
+        "\nDetected unusual method call: "
+        (class class-name)
+        " was called with arguments \n\t"
+        (format-signature current-call-types)
+        "\nprevious calls were with\n\t"
+        (join-with-newline (map format-signature previous-call-types))
+        "\nStacktrace:\n")
+       (stacktrace/format-stack-trace (.getStackTrace (Thread/currentThread)))))
+
+    (swap! method-calls
+           update-in
+           [class-name]
+           #(conj (or % #{}) current-call-types))
+    ))
+
+(defn introspect-namespace
+  [namespace-sym]
+  (IntrospectProfilingAgent/initializeAgent (-> namespace-sym
+                                                name
+                                                (.replace "-" "_")))
+  (compile namespace-sym)
+  ;; v.ns.name.name.replace('.', '/').replace('-','_') + "$" + munge(v.sym.name);
+  )
+
+(Interceptor/setCallback introspect-function)


SD performance

SD performance


update delete copy to hint at deactivation

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


pmap over parents in breadcrumbs

pmap over parents in breadcrumbs

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


Add string namespace.

Add string namespace.

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

--- src/main/clojure/ssblog/string.clj
+++ src/main/clojure/ssblog/string.clj
@@ -0,0 +1,62 @@
+;; -*- coding: utf-8 -*-
+;;
+;; © 2014 Steven Surgnier
+;; Author: Steven Surgnier <stevensurgnier@gmail.com>
+;;
+
+(ns ssblog.string)
+
+(defn if-empty-then-nil
+  "If S is empty then return nil else return S."
+  [s]
+  (if (empty? s) nil s))
+
+(defn get-leading-char-count
+  "Return the count of repeated leading characters in a given string."
+  ([string] (get-leading-char-count (first string) string))
+  ([a string]
+     (let [p #(= a (if (char? a) % (str %)))]
+       (count (take-while p string)))))
+
+(defn get-trailing-char-count
+  "Return the count of repeated trailing characters in a given string."
+  ([string] (get-leading-char-count (reverse string)))
+  ([a string]
+     (get-leading-char-count a (reverse string))))
+
+(defn rep
+  "Return a string of S repeated N times."
+  [n s]
+  (apply str (repeat n s)))
+
+(defn break
+  "Break a string into a vector of two elements. Default behavior is to
+   return the matched string at the tail of the left element. If :r is set
+   to true then the matched string will be returned at the head of the
+   right element."
+  [a string & {:keys [r] :or {r false}}]
+  (cond
+   (nil? string) [nil string]
+
+   (instance? java.util.regex.Pattern a)
+   (let [m (re-matcher a string)]
+     (if-not (.find m)
+       [string]
+       (let [index (if r (.start m) (.end m))
+             fst (subs string 0 index)
+             sec (subs string index)]
+         [(if-empty-then-nil fst)
+          (if-empty-then-nil sec)])))
+
+   (string? a)
+   (let [start (.indexOf string a)]
+     (if (>= start 0)
+       (let [index (if r start (+ start (count a)))]
+         [(subs string 0 index) (subs string index)])
+       [nil string]))
+
+   (integer? a)
+   (let [index (if r (dec a) a)]
+     [(subs string 0 index) (subs string index)])
+
+   :else [nil string]))


Update ss-examples-from-clojure-spec-guide-test

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

--- test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_600_clojure_spec/ss_examples_from_clojure_spec_guide/sss_080_collections.clj
+++ test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_600_clojure_spec/ss_examples_from_clojure_spec_guide/sss_080_collections.clj
@@ -0,0 +1,123 @@
+(ns com.nomistech.clojure-the-language.c-200-clojure-basics.s-600-clojure-spec.ss-examples-from-clojure-spec-guide.sss-080-collections
+  (:require [clojure.spec.alpha :as s]
+            [midje.sweet :refer :all]))
+
+;;;; ___________________________________________________________________________
+
+;;;; A few helpers are provided for other special collection cases:
+;;;; - `s/coll-of`
+;;;; - `s/tuple`
+;;;; - `s/map-of`
+
+;;;; Note: Both `s/coll-of` and `s/map-of` will conform all of their elements,
+;;;; which may make them unsuitable for large collections. In that case,
+;;;; consider `s/every` or for maps `s/every-kv`, which do not do exhaustive
+;;;; checking (and which therefore do not do any conforming).
+
+;;;; ___________________________________________________________________________
+;;;; `coll-of`
+;;;; For homogenous collections of arbitrary size, with elements satisfying
+;;;; a predicate.
+
+(fact (s/valid? (s/coll-of keyword?) [:a :b :c])
+  => true)
+
+(fact (s/valid? (s/coll-of number?) #{5 10 2})
+  => true)
+
+;;;; `coll-of` can be passed a number of keyword arg options:
+;;;;     :kind      - a predicate that the incoming collection must satisfy,
+;;;;                  such as vector?
+;;;;     :count     - specifies exact expected count
+;;;;     :min-count - checks that collection has (<= min-count count)
+;;;;     :max-count - checks that collection has (<= count max-count)
+;;;;     :distinct  - checks that all elements are distinct
+;;;;     :into      - one of [], (), {}, or #{} for output conformed value.
+;;;;                  If :into is not specified, the input collection type
+;;;;                   will be used.
+
+(s/def ::vnum3
+  (s/coll-of number?
+             :kind     vector?
+             :count    3
+             :distinct true
+             :into     #{}))
+
+(fact "`s/conform` produces a set"
+  (s/conform ::vnum3 [1 2 3])
+  => #{1 2 3})
+
+(fact "`s/valid?` checks for a vector"
+  (s/valid? ::vnum3 [1 2 3])
+  => true)
+
+;; (s/explain ::vnum3 [1 2 :a])
+;; =prints=>
+;; :a - failed: number? in: [2] spec: :<the-full-ns-name>/vnum3
+
+;; (s/explain ::vnum3 #{1 2 3})
+;; =prints=>
+;; #{1 3 2} - failed: vector? spec: :<the-full-ns-name>/vnum3
+
+;; (s/explain ::vnum3 [1 2 3 4])
+;; =prints=>
+;; [1 2 3 4] - failed: (= 3 (count %)) spec: :<the-full-ns-name>/vnum3
+
+;; (s/explain ::vnum3 [1 1 1])
+;; =prints=>
+;; [1 1 1] - failed: distinct? spec: :<the-full-ns-name>/vnum3
+
+;;;; ___________________________________________________________________________
+;;;; `s/tuple`
+;;;; For a fixed-size positional collection with fields of known type at
+;;;; each position.
+
+(s/def ::point (s/tuple double? double? double?))
+
+(fact (s/conform ::point [1.5 2.5 -0.5])
+  => [1.5 2.5 -0.5])
+
+;;;; ___________________________________________________________________________
+;;;; Alternatives to `s/tuple`
+
+(fact "About alternatives to `s/tuple`"
+
+  (fact "Regular expression" ; but note that we haven't introduced `s/cat` yet
+    ;; Conforms to map with named keys based on the `s/cat` tags.
+    ;; Allows for matching nested structure (not needed here).
+    (s/conform (s/cat :x double? :y double? :z double?)
+               [1.5 2.5 -0.5])
+    => {:x 1.5 :y 2.5 :z -0.5})
+
+  (fact "Collection"
+    ;; Conforms to map with named keys based on the `s/cat` tags.
+    ;; Allows for matching nested structure (not needed here).
+    (fact "OK example"
+      (s/conform (s/coll-of double?)
+                 [1.5 2.5 -0.5])
+      => [1.5 2.5 -0.5])
+    (fact "But this allows things that weren't allowed before, for example"
+      (s/conform (s/coll-of double?)
+                 [1.0 2.0 3.0 4.0])
+      => [1.0 2.0 3.0 4.0])))
+
+;;;; ___________________________________________________________________________
+;;;; `s/map-of`
+;;;; For maps with homogenous key and value predicates.
+
+;;;; Compare with `s/keys`, which specifies maps with keywords as keys and
+;;;; varied types of value.
+
+(s/def ::scores (s/map-of string? int?))
+
+(fact (s/valid? ::scores {"Sally" 1000
+                          "Joe"   500})
+  => true)
+
+;;;; By default `s/map-of` will validate but not conform keys because conformed
+;;;; keys might create key duplicates that would cause entries in the map to be
+;;;; overridden. If conformed keys are desired, pass the option :conform-keys
+;;;; true.
+
+;;;; You can also use the various count-related options on `s/map-of` that you
+;;;; have with `s/coll-of`.


[TH] clean up whitespaces

[TH] clean up whitespaces

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


Move users observer from yetibot to core

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

--- src/yetibot/core/observers/users.clj
+++ src/yetibot/core/observers/users.clj
@@ -0,0 +1,30 @@
+(ns yetibot.core.observers.users
+  (:require
+    [yetibot.core.models.users :as users]
+    [yetibot.core.adapters.campfire :as cf]
+    [yetibot.core.hooks :refer [obs-hook]]
+    [yetibot.core.chat :refer [chat-data-structure]]))
+
+(obs-hook
+  #{:enter}
+  (fn [event-info]
+    (users/add-user (:chat-source event-info)
+                    (:user event-info))))
+
+(obs-hook
+  #{:leave}
+  (fn [event-info]
+    (users/remove-user (:chat-source event-info)
+                       (-> event-info :user :id))))
+
+; (obs-hook
+;   ["KickMessage" "LeaveMessage" "EnterMessage"]
+;   (fn [event-json]
+;     ; TODO
+;     ; (users/reset-users)
+;     ))
+
+; (obs-hook
+;   ["TextMessage" "PasteMessage"]
+;   (fn [event-json]
+;     (users/update-active-timestamp event-json)))


Add example script to log pressed characters

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


update tests

update tests


Add stress test.

Add stress test.

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

--- test/onyx/stress/checkpoint_test.clj
+++ test/onyx/stress/checkpoint_test.clj
@@ -0,0 +1,136 @@
+(ns onyx.stress.checkpoint-test
+  (:require [clojure.core.async :refer [chan >!! <!! close! sliding-buffer dropping-buffer]]
+            [clojure.test :refer [deftest is]]
+            [onyx.plugin.core-async :refer [take-segments!]]
+            [schema.core :as s]
+            [onyx.schema :as os]
+            [onyx.static.uuid :refer [random-uuid]]
+            [onyx.test-helper :refer [load-config with-test-env]]
+            [onyx.api]))
+
+(def test-state (atom []))
+
+(s/defn update-atom! [event :- os/Event
+                      window :- os/Window
+                      trigger :- os/Trigger
+                      {:keys [lower-bound upper-bound event-type] :as state-event} :- os/StateEvent
+                      extent-state]
+  (when (zero? (rand-int 5000)) (println "TEST STATE HAS" (count @test-state)))
+  (when-not (= :job-completed event-type)
+    (swap! test-state conj [lower-bound upper-bound extent-state])))
+
+(def in-chan (atom nil))
+(def in-buffer (atom nil))
+
+(def out-chan (atom nil))
+
+(defn inject-in-ch [event lifecycle]
+  {:core.async/buffer in-buffer
+   :core.async/chan @in-chan})
+
+(defn inject-out-ch [event lifecycle]
+  {:core.async/chan @out-chan})
+
+(def in-calls
+  {:lifecycle/before-task-start inject-in-ch})
+
+(def out-calls
+  {:lifecycle/before-task-start inject-out-ch})
+
+#_(deftest conj-test
+    (let [input (->> (repeat 10000
+                             [{:id 1  :age 21 :event-time #inst "2015-09-13T03:00:00.829-00:00"}
+                              {:id 2  :age 12 :event-time #inst "2015-09-13T03:04:00.829-00:00"}
+                              {:id 3  :age 3  :event-time #inst "2015-09-13T03:05:00.829-00:00"}
+                              {:id 4  :age 64 :event-time #inst "2015-09-13T03:06:00.829-00:00"}
+                              {:id 5  :age 53 :event-time #inst "2015-09-13T03:07:00.829-00:00"}
+                              {:id 6  :age 52 :event-time #inst "2015-09-13T03:08:00.829-00:00"}
+                              {:id 7  :age 24 :event-time #inst "2015-09-13T03:09:00.829-00:00"}
+                              {:id 8  :age 35 :event-time #inst "2015-09-13T03:15:00.829-00:00"}
+                              {:id 9  :age 49 :event-time #inst "2015-09-13T03:25:00.829-00:00"}
+                              {:id 10 :age 37 :event-time #inst "2015-09-13T03:45:00.829-00:00"}
+                              {:id 11 :age 15 :event-time #inst "2015-09-13T03:03:00.829-00:00"}
+                              {:id 12 :age 22 :event-time #inst "2015-09-13T03:56:00.829-00:00"}
+                              {:id 13 :age 83 :event-time #inst "2015-09-13T03:59:00.829-00:00"}
+                              {:id 14 :age 60 :event-time #inst "2015-09-13T03:32:00.829-00:00"}
+                              {:id 15 :age 35 :event-time #inst "2015-09-13T03:16:00.829-00:00"}])
+                     (reduce into [])
+                     (map (fn [a]
+                            (assoc a
+                                   :randstuff
+                                   (repeatedly 400
+                                               #(rand-int 256))))))
+
+
+          id (random-uuid)
+          config (load-config)
+          env-config (assoc (:env-config config) :onyx/tenancy-id id)
+          peer-config (assoc (:peer-config config) :onyx/tenancy-id id :onyx.peer/coordinator-barrier-period-ms 20000)
+          batch-size 20
+          workflow
+          [[:in :identity] [:identity :out]]
+
+          catalog
+          [{:onyx/name :in
+            :onyx/plugin :onyx.plugin.core-async/input
+            :onyx/type :input
+            :onyx/medium :core.async
+            :onyx/batch-size batch-size
+            :onyx/max-peers 1
+            :onyx/doc "Reads segments from a core.async channel"}
+
+           {:onyx/name :identity
+            :onyx/fn :clojure.core/identity
+            :onyx/type :function
+            :onyx/max-peers 1
+            :onyx/batch-size batch-size}
+
+           {:onyx/name :out
+            :onyx/plugin :onyx.plugin.core-async/output
+            :onyx/type :output
+            :onyx/medium :core.async
+            :onyx/batch-size batch-size
+            :onyx/max-peers 1
+            :onyx/doc "Writes segments to a core.async channel"}]
+
+          windows
+          [{:window/id :collect-segments
+            :window/task :identity
+            :window/type :fixed
+            ;:window/aggregation [:onyx.windowing.aggregation/collect-by-key :randstuff]
+            :window/aggregation :onyx.windowing.aggregation/conj
+            :window/window-key :event-time
+            :window/range [5 :minutes]}]
+
+          triggers
+          [{:trigger/window-id :collect-segments
+            :trigger/refinement :onyx.refinements/accumulating
+            :trigger/fire-all-extents? true
+            :trigger/on :onyx.triggers/segment
+            :trigger/threshold [5 :elements]
+            :trigger/sync ::update-atom!}]
+
+          lifecycles
+          [{:lifecycle/task :in
+            :lifecycle/calls ::in-calls}
+           {:lifecycle/task :out
+            :lifecycle/calls ::out-calls}]]
+
+    (reset! in-chan (chan (inc (count input))))
+    (reset! in-buffer {})
+    (reset! out-chan (chan (dropping-buffer 1)))
+    (reset! test-state [])
+
+    (with-test-env [test-env [3 env-config peer-config]]
+      (doseq [i input]
+        (>!! @in-chan i))
+        (close! @in-chan)
+        (let [job (onyx.api/submit-job
+                   peer-config
+                   {:catalog catalog
+                    :workflow workflow
+                    :lifecycles lifecycles
+                    :windows windows
+                    :triggers triggers
+                    :task-scheduler :onyx.task-scheduler/balanced}) ]
+          (onyx.test-helper/feedback-exception! peer-config (:job-id job))))))


load the dropped file's contents

load the dropped file's contents

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


Added chebi identifier typing rule

Added chebi identifier typing rule

error: pathspec 'kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/bio_to_ice/step_c/chebi_identifier_typing.clj' did not match any file(s) known to git

--- kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/bio_to_ice/step_c/chebi_identifier_typing.clj
+++ kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/bio_to_ice/step_c/chebi_identifier_typing.clj
@@ -0,0 +1,14 @@
+;; -----------------------------------------------
+;; --------- chebi identifier typing ---------
+;; -----------------------------------------------
+;; specifically types the ontology identifiers
+`{:name "chebi-identifier-typing"
+  :head ((?/id rdf/type ccp/IAO_EXT_0000198)) ; chebi ontology identifier
+  :sparql-string "prefix obo: <http://purl.obolibrary.org/obo/>
+                  prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+                  prefix oboInOwl: <http://www.geneontology.org/formats/oboInOwl#>
+                  select ?id {
+                  ?id rdf:type ccp:IAO_EXT_0000088 .
+                  ?id obo:IAO_0000219 ?c .
+                  ?c oboInOwl:hasOBONamespace 'chebi_ontology'}"
+  }


tweaks to default lein profile

tweaks to default lein profile

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


solved

solved

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

--- src/4clojure/distinct.clj
+++ src/4clojure/distinct.clj
@@ -0,0 +1,23 @@
+;; Find Distinct Items
+;; http://www.4clojure.com/problem/56
+
+;; Difficulty:	Medium
+;; Topics:	seqs core-functions
+
+
+;; Write a function which removes the duplicates from a sequence. Order of the items must be maintained.
+
+
+(defn __ [coll]
+  coll)
+
+;; use reduce to aggregate, some to find if element is in agregated coll
+;; if not - conj, else: do nothing
+
+(= (__ [1 2 1 3 1 2 4]) [1 2 3 4])
+
+(= (__ [:a :a :b :b :c :c]) [:a :b :c])
+
+(= (__ '([2 4] [1 2] [1 3] [1 3])) '([2 4] [1 2] [1 3]))
+
+(= (__ (range 50)) (range 50))


create new core.clj

create new core.clj

error: pathspec 'brave-true/clojure-noob/src/clojure_noob/core.clj' did not match any file(s) known to git


remove bleh

remove bleh

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


prefer "return" over "ret"

prefer "return" over "ret"

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


UI/UX work

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


[WM] correct spelling of "initialize" in core.clj


Swing demo

Swing demo

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

--- src/insane_noises/swing.clj
+++ src/insane_noises/swing.clj
@@ -0,0 +1,35 @@
+;; https://github.com/overtone/overtone/wiki/Swing
+;; Someone asked at the Clojure West Unjam whether it was possible
+;; to have a swing beat instead of the relentless techno OONTZ OONTZ OONTZ.
+;; Why yes, yes it is:
+
+;; boot the server
+(use 'overtone.live)
+
+(definst c-hat [amp 0.8 t 0.04]
+  (let [env (env-gen (perc 0.001 t) 1 1 0 1 FREE)
+        noise (white-noise)
+        sqr (* (env-gen (perc 0.01 0.04)) (pulse 880 0.2))
+        filt (bpf (+ sqr noise) 9000 0.5)]
+    (* amp env filt)))
+
+
+(definst o-hat [amp 0.8 t 0.5]
+  (let [env (env-gen (perc 0.001 t) 1 1 0 1 FREE)
+        noise (white-noise)
+        sqr (* (env-gen (perc 0.01 0.04)) (pulse 880 0.2))
+        filt (bpf (+ sqr noise) 9000 0.5)]
+    (* amp env filt)))
+
+; define a metronome at a given tempo, expressed in beats per minute.
+(def metro (metronome 140))
+
+(defn swinger [beat]
+  (at (metro beat) (o-hat))
+  (at (metro (inc beat)) (c-hat))
+  (at (metro (+ 1.65 beat)) (c-hat))
+  (apply-at (metro (+ 2 beat)) #'swinger (+ 2 beat) []))
+
+(swinger (metro))
+
+(stop)


removing comments

removing comments

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


change default category to :cleaning

change default category to :cleaning

temporary patch until we figure out a better default category solution

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


Stub for the module server_test.clj

Stub for the module server_test.clj

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

--- test/emender_jenkins/server_test.clj
+++ test/emender_jenkins/server_test.clj
@@ -0,0 +1,18 @@
+(ns emender-jenkins.core-test
+  (:require [clojure.test :refer :all]
+            [emender-jenkins.server :refer :all]))
+
+
+;(get-api-command nil "/api")
+
+;(get-api-command "/" "/api")
+;(get-api-command "xyzzy/" "/api")
+;(get-api-command "xyzzy/xyzzy" "/api")
+
+;(get-api-command "/api" "/api")
+
+;(get-api-command "/api/create_job", "/api")
+
+;(get-api-command "/api/system/banners" "/api")
+
+


Add pre/post conditions to MQ utility functions.

Signed-off-by: Deepak Giridharagopal <d11186354d1ef01ca06ae37d7e23e827da13e85f@puppetlabs.com>

--- src/com/puppetlabs/mq.clj
+++ src/com/puppetlabs/mq.clj
@@ -19,8 +19,13 @@
   `dir` - What directory in which to store the broker's data files. It
   will be created if it doesn't exist."
   ([dir]
+     {:pre  [(string? dir)]
+      :post [(instance? BrokerService %)]}
      (build-embedded-broker "localhost" dir))
   ([name dir]
+     {:pre  [(string? name)
+             (string? dir)]
+      :post [(instance? BrokerService %)]}
      (doto (BrokerService.)
        (.setBrokerName name)
        (.setDataDirectory dir)
@@ -42,6 +47,7 @@
 (defn connect!
   "Connect to the specified broker URI."
   [uri]
+  {:pre [(string? uri)]}
   (activemq/activemq-connection uri))

 (defn connect-and-publish!
@@ -64,6 +70,9 @@
   `timeout` - how many millis to wait for an incoming message before
   we consider the endpoint drained."
   [connection endpoint timeout]
+  {:pre  [(string? endpoint)
+          (integer? timeout)]
+   :post [(vector? %)]}
   (with-open [consumer (mq-conn/seqable connection {:endpoint endpoint :timeout timeout})]
     (reduce into []
             (map #(do (mq-seq/ack consumer) [%1])


commenting out failing SNS test

commenting out failing SNS test


add github oauth & user fetching by token

error: pathspec 'src/braid/server/api/github.clj' did not match any file(s) known to git

--- src/braid/server/api/github.clj
+++ src/braid/server/api/github.clj
@@ -0,0 +1,55 @@
+(ns braid.server.api.github
+  (:require [org.httpkit.client :as http]
+            [clojure.data.json :as json]
+            [braid.server.conf :refer [config]]
+            [braid.server.cache :as cache]
+            [braid.server.crypto :as crypto]
+            [braid.server.db :as db]
+            [braid.server.util :refer [map->query-str]]))
+
+(defn build-authorize-link
+  []
+  (let [state (crypto/random-nonce 20)]
+    (cache/cache-set! state (.getTime (java.util.Date.)))
+    (str "https://github.com/login/oauth/authorize?"
+         (map->query-str
+           {:client_id (config :github-client-id)
+            :scope "user:email"
+            :redirect_uri (str (config :site-url) "/oauth/github")
+            :state state}))))
+
+(defn exchange-token
+  [code state]
+  (when-let [ts (cache/cache-get state)]
+    (cache/cache-del! state)
+    ; Was the request from the last 30 minutes?
+    (when (< 0 (- (.getTime (java.util.Date.)) (Long. ts)) (* 1000 60 30))
+      (let [resp @(http/post "https://github.com/login/oauth/access_token"
+                             {:headers {"Accept" "application/json"}
+                              :form-params
+                              {:client_id (config :github-client-id)
+                               :client_secret (config :github-client-secret)
+                               :code code
+                               :redirect_uri (str (config :site-url) "/oauth/github")
+                               :state state}})]
+        (json/read-str (:body resp) :key-fn keyword)))))
+
+(defn email-address
+  [token]
+  (let [resp @(http/get "https://api.github.com/user/emails"
+                {:headers {"Authorization" (str "token " token)}})
+        emails (json/read-str (:body resp) :key-fn keyword)]
+    (->> emails
+         (filter #(and (:verified %) (:primary %)) )
+         first
+         :email)))
+
+(defn login
+  [token]
+  (let [email (email-address token)]
+    (db/user-with-email email)))
+
+(defn register
+  [token]
+  ; TODO: create a passwordless user with email
+  )


Publish options normalization tests

Publish options normalization tests

error: pathspec 'modules/messaging/src/test/clojure/test/immutant/messaging/core.clj' did not match any file(s) known to git

--- modules/messaging/src/test/clojure/test/immutant/messaging/core.clj
+++ modules/messaging/src/test/clojure/test/immutant/messaging/core.clj
@@ -0,0 +1,52 @@
+;; Copyright 2008-2012 Red Hat, Inc, and individual contributors.
+;;
+;; This is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU Lesser General Public License as
+;; published by the Free Software Foundation; either version 2.1 of
+;; the License, or (at your option) any later version.
+;;
+;; This software is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; Lesser General Public License for more details.
+;;
+;; You should have received a copy of the GNU Lesser General Public
+;; License along with this software; if not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+(ns test.immutant.messaging.core
+  (:use [immutant.messaging.core])
+  (:import (javax.jms DeliveryMode))
+  (:use [clojure.test]))
+
+(def producer (proxy [javax.jms.MessageProducer] []
+                (getDeliveryMode [] DeliveryMode/PERSISTENT)
+                (getPriority [] (Integer. 4))
+                (getTimeToLive [] (Long. 99999))))
+
+(deftest options-missing
+  (let [opts (normalize [] producer)]
+    (is (= (:delivery opts) DeliveryMode/PERSISTENT))
+    (is (= (:priority opts) 4))
+    (is (= (:ttl opts) 99999))))
+
+(deftest option-persistent-false
+  (let [opts (normalize {:persistent false} producer)]
+    (is (= (:delivery opts) DeliveryMode/NON_PERSISTENT))))
+
+(deftest option-persistent-true
+  (let [opts (normalize {:persistent true} producer)]
+    (is (= (:delivery opts) DeliveryMode/PERSISTENT))))
+
+(deftest option-priority-keyword
+  (let [opts (normalize {:priority :high} producer)]
+    (is (= (:priority opts) 7))))
+
+(deftest option-priority-integer
+  (let [opts (normalize {:priority 8} producer)]
+    (is (= (:priority opts) 8))))
+
+(deftest option-ttl-long
+  (let [opts (normalize {:ttl 1000} producer)]
+    (is (= (:ttl opts) 1000))))


Create qsort.clj

Create qsort.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/binape/code-snippets.git/'