This thang is a clone of the tmp one. TODO: refactor out common parts

error: pathspec 'src/doctopus/storage/storage_impls/permanent_fs.clj' did not match any file(s) known to git

--- src/doctopus/storage/storage_impls/permanent_fs.clj
+++ src/doctopus/storage/storage_impls/permanent_fs.clj
@@ -0,0 +1,43 @@
+(ns doctopus.storage.storage-impls.permanent-fs
+  (:require [clojure.string :as str]
+            [doctopus.files :as files]
+            [doctopus.files.storage-impls :refer :all]
+            [me.raynes.fs :as fs]
+            [doctopus.configuration :refer [server-config]])
+  (:import [doctopus.files.storage-impls.BackendImplementation]))
+
+(def root (fs/file (:permanent-fs-root (server-config))))
+(if-not (fs/exists? root) (fs/mkdirs root))
+
+(defn- load-html-file
+  [rel-path]
+  (let [html-re #"\.html$"
+        assure-suffix #(if (re-find html-re rel-path) rel-path (str rel-path ".html"))
+        file-handle (fs/file root rel-path)]
+    (slurp file-handle)))
+
+(defn save-html-file
+  "Expects a key, a relative path, and the data to write. `Key' is
+  assumed to be the name of a particular documentation set, and
+  becomes the primary subdirectory in the filesystem."
+  [key rel-path data]
+  (binding [fs/*cwd* root]
+    (let [assure-relativity #(if (re-find #"^/" %) (subs % 1) %)
+          file-handle (fs/file key (assure-relativity rel-path))]
+      (fs/mkdirs (fs/parent file-handle))
+      (spit file-handle data))))
+
+(defn save-fn
+  [key path-html-pairs]
+  (doseq [[path html] path-html-pairs] (save-html-file key path html)))
+
+(defn load-fn
+  "This is as Version 1 a way of doing this as I can think of:
+
+  1. We load html
+  2. We wrap that html in a function that returns itself, so we can Bidi"
+  [key]
+  (binding [fs/*cwd* root]
+    (let [dir (fs/file key)
+          rel-path-html-pairs (files/read-html dir)]
+      (into [] (map (fn [[rel-path html]] [rel-path (fn [_] html)]) rel-path-html-pairs)))))


Handle json-to-object-array in entity_to_json test

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


removed typo on line 19

removed typo on line 19

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


add environment helpers

add environment helpers

fatal: unable to access 'https://github.com/prathamesh-sonpatki/frontend.git/': The requested URL returned error: 403


restore the state specific voter registration fn lookup

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


hide ipam if not provided

hide ipam if not provided

--- src/cljs/swarmpit/component/network/info.cljs
+++ src/cljs/swarmpit/component/network/info.cljs
@@ -17,7 +17,8 @@
             [swarmpit.time :as time]
             [swarmpit.routes :as routes]
             [sablono.core :refer-macros [html]]
-            [rum.core :as rum]))
+            [rum.core :as rum]
+            [clojure.string :as str]))

 (enable-console-print!)

@@ -73,8 +74,10 @@
     (form/item-main "Name" networkName)
     (form/item-main "Driver" driver)
     (form/item-main "Created" (form/item-date created))
-    (form/item-main "Subnet" (:subnet ipam))
-    (form/item-main "Gateway" (:gateway ipam))
+    (when (not (str/blank? (:subnet ipam)))
+      (form/item-main "Subnet" (:subnet ipam)))
+    (when (not (str/blank? (:gateway ipam)))
+      (form/item-main "Gateway" (:gateway ipam)))
     (when (and stack (not-empty services))
       (comp/box
         {}


Remove stroke border around triangles

Remove stroke border around triangles

These borders make an interesting maze pattern, but
we're taking it out.

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


Add missing file

Add missing file

error: pathspec 'backend/src/circle/util/coerce.clj' did not match any file(s) known to git

--- backend/src/circle/util/coerce.clj
+++ backend/src/circle/util/coerce.clj
@@ -0,0 +1,11 @@
+(ns circle.util.coerce
+  "Functions that attempt to coerce arguments from one type to another"
+  (:use [circle.util.core :only (apply-if)])
+  (:use [circle.util.predicates :only (named?)]))
+
+(defn to-name
+  "Returns x, or (name x) if supported"
+  [x]
+  (apply-if (named? x) name x))
+
+


Deprecate redirect-after-post function

Deprecate redirect-after-post function

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


New module: process_info.clj

New module: process_info.clj

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

--- src/emender_jenkins/process_info.clj
+++ src/emender_jenkins/process_info.clj
@@ -0,0 +1,22 @@
+(ns emender-jenkins.process-info)
+
+(defn get-current-pid
+    []
+    (-> (java.lang.management.ManagementFactory/getRuntimeMXBean)
+        (.getName)
+        (clojure.string/split #"@")
+        (first)))
+
+(defn read-properties
+    []
+    {:java-version    (System/getProperty "java.version")
+     :java-class-path (System/getProperty "java.class.path")
+     :java-home       (System/getProperty "java.home")
+     :java-vendor     (System/getProperty "java.vendor")
+     :os-arch         (System/getProperty "os.arch")
+     :os-name         (System/getProperty "os.name")
+     :os-version      (System/getProperty "os.version")
+     :user-dir        (System/getProperty "user.dir")
+     :user-home       (System/getProperty "user.home")
+     :user-name       (System/getProperty "user.name")})
+


Improve startup config message

Improve startup config message

--- src/buildviz/main.clj
+++ src/buildviz/main.clj
@@ -6,15 +6,25 @@
             [buildviz.util.http :as http]
             [clojure.string :as str]))

-(def data-dir (if-let [data-dir (System/getenv "BUILDVIZ_DATA_DIR")]
+(def ^:private data-dir (if-let [data-dir (System/getenv "BUILDVIZ_DATA_DIR")]
                 data-dir
                 "data/"))

-(def pipeline-name (System/getenv "BUILDVIZ_PIPELINE_NAME"))
+(def ^:private pipeline-name (System/getenv "BUILDVIZ_PIPELINE_NAME"))
+
+(def ^:private config-params [["BUILDVIZ_DATA_DIR" data-dir]
+                              ["BUILDVIZ_PIPELINE_NAME" (or pipeline-name
+                                                            "")]
+                              ["PORT" (or (System/getenv "PORT")
+                                          3000)]])

 (defn help []
-  (println "Available environment variables:" (str/join ", " ["PORT" "BUILDVIZ_DATA_DIR" "BUILDVIZ_PIPELINE_NAME"]))
-  (println "Storing builds in" data-dir))
+  (println "Starting buildviz with config")
+  (->> config-params
+       (map (fn [[env-var value]]
+              (format "  %s: '%s'" env-var value)))
+       (map println)
+       doall))

 (def app
   (let [builds (storage/load-builds data-dir)]


New module hurvinek.exporter with functions to export data to JSON, EDN, and CSV

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

--- src/hurvinek/exporter.clj
+++ src/hurvinek/exporter.clj
@@ -0,0 +1,36 @@
+;
+;  (C) Copyright 2016  Pavel Tisnovsky
+;
+;  All rights reserved. This program and the accompanying materials
+;  are made available under the terms of the Eclipse Public License v1.0
+;  which accompanies this distribution, and is available at
+;  http://www.eclipse.org/legal/epl-v10.html
+;
+;  Contributors:
+;      Pavel Tisnovsky
+;
+
+(ns hurvinek.exporter
+    "Module with functions to export data into selected format.")
+
+(require '[clojure.data.json      :as json])
+(require '[clojure.xml            :as xml])
+(require '[clojure.data.csv       :as csv])
+
+(defn data->json
+    "Convert/format any data to JSON format."
+    [products]
+    (json/write-str products))
+
+(defn data->edn
+    "Convert/format any data to EDN format."
+    [data]
+    (with-out-str
+        (clojure.pprint/pprint data)))
+
+(defn data->csv
+    "Convert/format any data to CSV format."
+    [data]
+    (with-out-str
+        (csv/write-csv *out* data)))
+


Keys for the date map.

Keys for the date map.

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


remove unused requires

remove unused requires

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/Yleisradio/yle-api-template.git/'


don't reload the utils file to keep debug global stable

fatal: unable to access 'https://github.com/verma/lein-figwheel.git/': The requested URL returned error: 403


pep-031 solved

pep-031 solved

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

--- src/pep_031/solution1.clj
+++ src/pep_031/solution1.clj
@@ -0,0 +1,17 @@
+(ns pep-031.solution1)
+
+(def coins [200 100 50 20 10 5 2 1])
+
+(defn count-change [amount coins]
+  (cond
+    (= amount 0) 1
+    (< amount 0) 0
+    (empty? coins) 0
+    :else (+ (count-change amount (rest coins))
+            (count-change (- amount (first coins)) coins))))
+
+(defn solve [n]
+  (count-change n coins))
+
+(defn -main [& _]
+  (solve 200))


Stub for db-interface namespace

Stub for db-interface namespace

fatal: unable to access 'https://github.com/emender/emender-service.git/': The requested URL returned error: 403


Added recent articles template.

Added recent articles template.

fatal: unable to access 'https://github.com/Idorobots/lambda-blog.git/': The requested URL returned error: 403


Problem 100. :)

Problem 100. :)

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

--- src/project_euler/problem_0100.clj
+++ src/project_euler/problem_0100.clj
@@ -0,0 +1,37 @@
+(ns project-euler.problem_0100)
+
+;; If a box contains twenty-one coloured discs,
+;; composed of fifteen blue discs and six red discs, and two discs were taken at random,
+;; it can be seen that the probability of taking two blue discs, P(BB) = (15/21)×(14/20) = 1/2.
+
+;; The next such arrangement,
+;; for which there is exactly 50% chance of taking two blue discs at random,
+;; is a box containing eighty-five blue discs and thirty-five red discs.
+
+;; By finding the first arrangement to contain over 10^12 = 1,000,000,000,000 discs in total,
+;; determine the number of blue discs that the box would contain.
+
+
+(defn solution-from [x]
+  (let [r (Math/sqrt 0.5)]
+    (->> (iterate inc x)
+         (map
+          (fn [x]
+            (let [blue-1 (bigint (* r x))
+                  blue   (inc blue-1)]
+              [(== (*' 2 blue blue-1) (*' x (dec x))) blue x]
+              )))
+         (filter first)
+         (first)
+         (rest)
+         )))
+
+(defn solution []
+  (loop [tot 21, r 5]
+    (let [[blue tot'] (solution-from (bigint (* tot r)))]
+      (if (< tot' 1000000000000)
+        (recur tot' (/ tot' tot))
+        blue)
+      )))
+
+;;-> 756872327473


add vim scheduler

add vim scheduler

fatal: unable to access 'https://github.com/liquidz/panpan-bot.git/': The requested URL returned error: 403


feed system to perform-effect

feed system to perform-effect

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


Disable swank.

Disable swank.

--- src/clojars/web.clj
+++ src/clojars/web.clj
@@ -194,8 +194,8 @@
           (with-session)
           (with-db))

-(require 'swank.swank)
-(swank.swank/start-server "/dev/null" :port 4005)
+;(require 'swank.swank)
+;(swank.swank/start-server "/dev/null" :port 4005)

 (run-server {:port 8000}
             "/*" (servlet clojars-app))


test fix

test fix

--- test/metabase/api/meta/field_test.clj
+++ test/metabase/api/meta/field_test.clj
@@ -59,7 +59,7 @@
       {:description nil
        :table_id (table->id :venues)
        :special_type "latitude"
-       :name "LONGITUDE"
+       :name "LATITUDE"
        :updated_at $
        :active true
        :id $


Get codegen working for stateless components; WIP state loading

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


Add test for pipeline

Add test for pipeline

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

--- test/clj_gatling/pipeline_test.clj
+++ test/clj_gatling/pipeline_test.clj
@@ -0,0 +1,27 @@
+(ns clj-gatling.pipeline-test
+  (:require [clojure.test :refer :all]
+            [clj-gatling.test-helpers :refer :all]
+            [clj-gatling.report :refer [short-summary-reporter]]
+            [clj-gatling.pipeline :as pipeline]))
+
+(def test-simu
+  {:name "Test simulation"
+   :scenarios [{:name "Test scenario"
+                :steps [{:name "Step1" :request (fn [_] true)}
+                        {:name "Step2" :request (fn [_] false)}]}]})
+
+(defn- stub-executor [node-ids]
+  (fn [node-id simulation-fn simulation options]
+    (swap! node-ids conj node-id)
+    (simulation-fn simulation options)))
+
+(deftest running-pipeline
+  (let [node-ids (atom #{})
+        executor (stub-executor node-ids)]
+    (pipeline/run test-simu {:executor executor
+                             :nodes 3
+                             :concurrency 20
+                             :timeout-in-ms 1000
+                             :batch-size 5
+                             :reporters [short-summary-reporter]})
+    (is (= #{0 1 2} @node-ids))))


test ephemeris-api.points

test ephemeris-api.points

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

--- test/ephemeris_api/points_test.clj
+++ test/ephemeris_api/points_test.clj
@@ -0,0 +1,12 @@
+(ns ephemeris-api.points-test
+  (:require [clojure.test :refer :all]
+            [ephemeris-api.points :as ps]))
+
+(deftest points-test
+  (is (= 0 (ps/lookup :Sun)))
+  (is (= :Sun (ps/lookup 0)))
+  (is (nil? (ps/lookup :Unknown)))
+  (is (true? (ps/known? :Sun)))
+  (is (false? (ps/known? :Unknown)))
+  (is (= "Helios" (ps/nameit :Sun)))
+  (is (= "Sun" (ps/nameit :Sun :en))))


Full melody, sans differing note lengths.

error: pathspec 'src/overtunes/songs/row_row_row_your_boat.clj' did not match any file(s) known to git

--- src/overtunes/songs/row_row_row_your_boat.clj
+++ src/overtunes/songs/row_row_row_your_boat.clj
@@ -0,0 +1,32 @@
+(ns overtunes.songs.row-row-row-your-boat
+  (:use
+    [overtone.live :only [at now]]
+    [overtone.inst.sampled-piano :only [sampled-piano]]))
+
+(def major-scale #(apply + (take % (cycle [2 2 1 2 2 2 1]))))
+(def g-major #(+ 67 (major-scale %)))
+
+(defn ms-per-beat [ms start] #(+ start (* % ms)))
+(defn after [timing beats] #(timing (+ beats %)))
+
+(def row-row-row-your-boat [0 0 0 1 2])
+(def gently-down-the-stream [2 1 2 3 4])
+(def merrily-merrily-merrily-merrily [7 7 7 4 4 4 2 2 2 0 0 0])
+(def life-is-but-a-dream [4 3 2 1 0])
+
+(def melody
+  (concat
+    row-row-row-your-boat
+    gently-down-the-stream
+    merrily-merrily-merrily-merrily
+    life-is-but-a-dream))
+
+(defn melody# [timing notes]
+  (let [note# #(at (timing %1) (sampled-piano (g-major %2)))]
+    (dorun (map-indexed note# notes))))
+
+(defn play# []
+  (let [timing (ms-per-beat 700 (now))]
+    (melody# timing melody)))
+
+(play#)


This is precisely the use case for promise-chan

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


don't call render-form without a context

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


refactor

refactor

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


bump version to 2.8.9

bump version to 2.8.9

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


Version 35-SNAPSHOT

Version 35-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject clojars-web "34"
+(defproject clojars-web "35-SNAPSHOT"
   :min-lein-version "2.0.0"
   :dependencies [[org.clojure/clojure "1.8.0"]
                  [org.clojure/tools.cli "0.2.1"]


Bump version to 0.3.1

Bump version to 0.3.1

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


[WM] Update datomic-toolbox to 2.0.1

[WM] Update datomic-toolbox to 2.0.1

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


bump version

bump version

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject me.shenfeng/http-kit "1.0.1"
+(defproject me.shenfeng/http-kit "1.0.2"
   :description "Event driven HTTP server and HTTP client in java and clojure, only depend on JDK."
   :dependencies [[org.clojure/clojure "1.4.0"]
                  [org.slf4j/slf4j-api "1.6.4"]]


[TH DG] Added the most recent lein profiles.

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


Begin 0.0.2

Begin 0.0.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/dignati/om-charts.git/'


Project changes

Project 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/aarkerio/cmsclj.git/'


Upgrade xerial sqlite

Upgrade xerial sqlite

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


:test-commands for cljsbuild

:test-commands for cljsbuild

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


version bump for next release

version bump for next release

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


we *always* want clojure.pprint

we *always* want clojure.pprint

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


intersection solved

intersection solved

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

--- src/4clojure/intersection.clj
+++ src/4clojure/intersection.clj
@@ -0,0 +1,50 @@
+;; Set Intersection
+;; http://www.4clojure.com/problem/81
+
+
+;; Difficulty:	Easy
+;; Topics:	set-theory
+
+
+;; Write a function which returns the intersection of two sets. The intersection is the sub-set of items that each set has in common.
+
+(defn coll-contains? [coll x]
+  (some #{x} coll))
+
+(some #{4} #{0 1 2 3})
+
+(defn __ [a b]
+  (set (filter #(coll-contains? b %) a)))
+
+
+(= (__ #{0 1 2 3} #{2 3 4 5}) #{2 3})
+
+(= (__ #{0 1 2} #{3 4 5}) #{})
+
+(= (__ #{:a :b :c :d} #{:c :e :a :f :d}) #{:a :c :d})
+
+;; 4Clojure copy paste
+(fn [a b] (set (filter #(some #{%} b) a)))
+
+
+;; _artem_uv's solution:
+(fn f
+  ([s1 s2]
+   (f s1 s2 '()))
+  ([s1 s2 r]
+   (if (empty? s1)
+     (set r)
+   (if (contains? s2 (first s1))
+     (recur (rest s1) s2 (into r (vector (first s1))))
+     (recur (rest s1) s2 r)))))
+
+;; _pcl's solution:
+(fn [x y] (reduce #(if (contains? x %2) (conj %1 %2) %1) #{}  y))
+
+;; aceeca1's solution:
+(comp set filter)
+; shortest
+
+;; adereth's solution:
+(fn [s1 s2] (set (filter s1 s2)))
+; equivalent of shortest but with not needed anonymous function


Handling hex better

Handling hex better

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


fix checkbox persistence bug

fix checkbox persistence bug

also the checkboxes are switches now

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


printing utc in url scrapers

printing utc in url scrapers

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


add data generating functions(tags,urls)

error: pathspec 'src/bookmarks/db/seeddata.clj' did not match any file(s) known to git

--- src/bookmarks/db/seeddata.clj
+++ src/bookmarks/db/seeddata.clj
@@ -0,0 +1,9 @@
+(ns bookmarks.db.seeddata
+  (:require [bookmarks.files :refer [get-words]]))
+
+(defn gen-tags [file-path]
+  (distinct (filter (fn [w] (>= (count w) 3))
+                    (get-words file-path))))
+(defn gen-urls [file-path]
+  (map (fn [w] (str "http://www."w ".com"))
+       (gen-tags file-path)))


add cider-nrepl to leinengen profile

add cider-nrepl to leinengen profile

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

--- dotfiles/lein/profiles.clj
+++ dotfiles/lein/profiles.clj
@@ -0,0 +1 @@
+{:user {:plugins [[cider/cider-nrepl "0.8.2"]]}}


Problem 0050.

Problem 0050.

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

--- src/project_euler/problem_0050.clj
+++ src/project_euler/problem_0050.clj
@@ -0,0 +1,54 @@
+(ns project-euler.problem_0050)
+
+
+;; The prime 41, can be written as the sum of six consecutive primes:
+
+;; 41 = 2 + 3 + 5 + 7 + 11 + 13
+;; This is the longest sum of consecutive primes that adds to a prime below one-hundred.
+
+;; The longest sum of consecutive primes below one-thousand that adds to a prime,
+;; contains 21 terms, and is equal to 953.
+
+;; Which prime, below one-million, can be written as the sum of the most consecutive primes?
+
+;; from problem 0007 ----------------------------------
+;;....................................................
+
+(defn prime?
+  [n]
+  {:pre [(integer? n) (> n 0)]}
+  (or (== 2 n)
+      (let [mmax (+ (Math/sqrt n) 1)]
+        (not (some #(== 0 (rem n %)) (concat [2] (range 3 mmax 2))))
+        )))
+
+;;----------------------------------------------------------------------------
+(def sum-max 1000000)
+
+(def primes-vec (vec (filter prime? (range 2 sum-max))))
+(def primes-set (set primes-vec))
+(def n (count primes-vec))
+
+(defn longuest-starting-at [i]
+  (loop [j i, lj nil, s 0, ls nil]
+    (if (and (< s sum-max) (< j n))
+      (let [s (+ s (primes-vec j))]
+        (if (contains? primes-set s)
+          (recur (inc j) j  s s)
+          (recur (inc j) lj s ls)
+          ))
+      [lj ls]
+      )))
+
+(defn solution []
+  (loop [i 0, li 0, lj 0, ls nil]
+    (if (< i n)
+      (let [[tlj tls] (longuest-starting-at i)]
+        (if (> (- tlj i) (- lj li))
+          (recur (inc i) i  tlj tls)
+          (recur (inc i) li lj  ls)
+          ))
+      ls
+      )))
+
+;;-> 997651


Working on problem_0095.

Working on problem_0095.

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

--- src/project_euler/problem_0095.clj
+++ src/project_euler/problem_0095.clj
@@ -0,0 +1,58 @@
+(ns project-euler.problem_0095)
+
+;; The proper divisors of a number are all the divisors excluding the number itself.
+;; For example, the proper divisors of 28 are 1, 2, 4, 7, and 14.
+;; As the sum of these divisors is equal to 28, we call it a perfect number.
+
+;; Interestingly the sum of the proper divisors of 220 is 284 and the sum of the proper divisors of 284 is 220,
+;; forming a chain of two numbers. For this reason, 220 and 284 are called an amicable pair.
+
+;; Perhaps less well known are longer chains.
+;; For example, starting with 12496, we form a chain of five numbers:
+
+;; 12496 → 14288 → 15472 → 14536 → 14264 (→ 12496 → ...)
+
+;; Since this chain returns to its starting point, it is called an amicable chain.
+
+;; Find the smallest member of the longest amicable chain with no element exceeding one million.
+
+
+;; from problem 0012 ....................................................................................
+(defn factors
+  [x]
+  (->> (range 1 (inc (int (Math/sqrt x))))
+       (filter #(== 0 (rem x %)))
+       (mapcat #(let [q (/ x %)]
+                  (if (== q %) [%] [% q])))
+       ))
+;;........................................................................................................
+
+;; from problem 0021 ....................................................................................
+(defn sum-of-proper-divisors
+  [n]
+  (->> (factors n)
+       (filter #(not (== n %)))
+       (reduce +)
+       ))
+;;........................................................................................................
+
+(defn search-chain [n]
+  (loop [n n, seen-pos {}, seen-vec [], cnt 0]
+    (if (> n 1000000)
+      [seen-vec (count seen-vec)]
+      (if-let [ix (seen-pos n)]
+        [seen-vec ix]
+        (recur (sum-of-proper-divisors n) (assoc seen-pos n cnt) (conj seen-vec n) (inc cnt))))
+    ))
+
+(defn solution []
+  (->> (loop [not-seen (set (range 1000000))
+              l-chain  []]
+         (if (seq not-seen)
+           (let [[seen ch-ix] (search-chain (first not-seen))
+                 ch           (subvec seen ch-ix)]
+             (if (> (count ch) (count l-chain))
+               (recur (apply disj not-seen seen) ch)
+               (recur (apply disj not-seen seen) l-chain)))
+           l-chain)
+         )))


Support more grouping types

Support more grouping types

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


clojure.spec: Add intro to `valid?`

clojure.spec: Add intro to `valid?`

--- test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_600_clojure_spec.clj
+++ test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_600_clojure_spec.clj
@@ -5,10 +5,10 @@
 ;;;; ___________________________________________________________________________
 ;;;; Stuff from https://clojure.org/guides/spec

-(fact
-  (s/conform even? 1000)
-  => 1000)
+(fact "Intro to `conform`: spec X value -> value"
+  (fact (s/conform even? 1000) => 1000)
+  (fact (s/conform even? 1001) => :clojure.spec.alpha/invalid))

-(fact
-  (s/conform even? 999)
-  => :clojure.spec.alpha/invalid)
+(fact "Intro to `valid?`: spec X value -> boolean"
+  (fact (s/valid? even? 1000) => true)
+  (fact (s/valid? even? 1001) => false))


Add unit test for mutate and update the charts.

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

--- test/clj_diff/test/performance.clj
+++ test/clj_diff/test/performance.clj
@@ -0,0 +1,23 @@
+(ns clj-diff.test.performance
+  (:use [clj-diff.core])
+  (:use [clj-diff.performance] :reload)
+  (:use [clojure.test]))
+
+(deftest mutate-test
+  (let [a "abcdefghijklmnopqrstuvwxyz"
+        changes #(count (flatten (map rest (:+ %))))
+        largest-group #(apply max (map count (map rest (:+ %))))]
+    (is (<= (changes (diff a (mutate a 1 1)))
+           1))
+    (is (<= (changes (diff a (mutate a 2 1)))
+            2))
+    (is (<= (changes (diff a (mutate a 5 1)))
+            5))
+    (is (<= (changes (diff a (mutate a 5 5)))
+            5))
+    (is (<= (largest-group (diff a (mutate a 5 5)))
+            5))
+    (is (<= (changes (diff a (mutate a 10 5)))
+            10))
+    (is (<= (largest-group (diff a (mutate a 10 5)))
+            5))))


Add stub for rotational-cipher

Add stub for rotational-cipher

error: pathspec 'exercises/rotational-cipher/src/rotational_cipher.clj' did not match any file(s) known to git

--- exercises/rotational-cipher/src/rotational_cipher.clj
+++ exercises/rotational-cipher/src/rotational_cipher.clj
@@ -0,0 +1,5 @@
+(ns rotational-cipher)
+
+(defn rotate [] ;; <- Arglist goes here
+      ;; your code goes here
+      )


add postorder traversal functions

add postorder traversal functions

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

--- src/bracketolojy/zip.clj
+++ src/bracketolojy/zip.clj
@@ -0,0 +1,33 @@
+(ns bracketolojy.zip
+  (:require [clojure.zip :as zip]))
+
+(defn- leftmost-descendant
+  "Given a zipper loc, returns its leftmost descendent (ie, down repeatedly)."
+  [loc]
+  (if (and (zip/branch? loc) (zip/down loc))
+    (recur (zip/down loc))
+    loc))
+
+(defn post-order-first
+  "Given a root node, returns the first node of a postorder tree walk. See
+   comment on postorder-next."
+  [loc]
+  (leftmost-descendant loc))
+
+(defn post-order-next
+  "Moves to the next loc in the hierarchy in postorder traversal. Behaves like
+   clojure.zip/next otherwise. Note that unlike with a pre-order walk, the root
+   is NOT the first element in the walk order, so be sure to take that into
+   account in your algorithm if it matters (ie, call postorder-first first
+   thing before processing a node)."
+  [loc]
+  (if (zip/end? loc) ;; If it's the end, return the end.
+    loc
+    (if-not (zip/up loc)
+      [(zip/node loc) :end]
+      ;; Node is internal, so we got to it by having traversed its children.
+      ;; Instead, we want to try to move to the leftmost descendant of our
+      ;; right sibling, if possible.
+      (or (and (zip/right loc) (leftmost-descendant (zip/right loc)))
+          ;; There was no right sibling, we must move back up the tree.
+          (zip/up loc)))))


Prevent multiple invocations of do operators

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


AES encription.

AES encription.

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


post-resources should allow any of supplied schemas

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


kata6: add dev dependency to trace/repl

kata6: add dev dependency to trace/repl

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/schaueho/clojure-codekata.git/'


[DG] No extra z's

[DG] No extra z's

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


Add problem58.clj

Add problem58.clj

5.752 seconds

Faster than the python version. Will consider implementing Miller-Rabin
in clojure too.

error: pathspec 'euler_clojure/src/euler/problem58.clj' did not match any file(s) known to git

--- euler_clojure/src/euler/problem58.clj
+++ euler_clojure/src/euler/problem58.clj
@@ -0,0 +1,44 @@
+(ns euler.problem58
+  "Starting with 1 and spiralling anticlockwise in the following way,
+  a square spiral with side length 7 is formed.
+
+    37 36 35 34 33 32 31
+    38 17 16 15 14 13 30
+    39 18  5  4  3 12 29
+    40 19  6  1  2 11 28
+    41 20  7  8  9 10 27
+    42 21 22 23 24 25 26
+    43 44 45 46 47 48 49
+
+  It is interesting to note that the odd squares lie along the bottom
+  right diagonal, but what is more interesting is that 8 out of the 13
+  numbers lying along both diagonals are prime; that is, a ratio of
+  8/13 ≈ 62%.
+
+  If one complete new layer is wrapped around the spiral above, a
+  square spiral with side length 9 will be formed. If this process is
+  continued, what is the side length of the square spiral for which
+  the ratio of primes along both diagonals first falls below 10%?"
+  (:require [euler.toolset :refer [prime?]]
+            [clojure.math.numeric-tower :as math]))
+
+(defn squared [n] (math/expt n 2))
+
+;; Given the bottom right corner number, return the square length.
+(defn square-length [n] (math/sqrt n))
+
+(defn corners [n]
+  ;; Given the bottom right corner number, return the four corner numbers.
+  ;; 49 => (49 43 37 31)
+  (let [x (dec (square-length n))]
+    (take 4 (iterate #(- % x) n))))
+
+(defn problem58 []
+  (loop [x 7         ; The current square-length.
+         primes 8    ; The number of primes found thus far.
+         total 13]   ; The total number of corner numbers checked.
+    (if (< (/ primes total) 0.10)
+      x
+      (recur (+ x 2)
+             (+ primes (count (filter prime? (corners (squared (+ x 2))))))
+             (+ total 4)))))


Use monger to add food items

Use monger to add food 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/expez/jada.git/'


Revert "move sequential partition much further up, set a saner split between scalars and aggregates"

==> This caused sequences to have a two-byte tag when UTF-8 encoded, and
    so actually wasn't a very good split of the 7-bit space we're living
    with at the moment.

This reverts commit 28f89666e21db1b266fdc3a85deeb66b2f07efed.

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


load emil0r objects again

load emil0r objects again

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


[WM] Make ocd-id-level fn more flexible

[WM] Make ocd-id-level fn more flexible

The fall-through case now returns the key of the last key:value pair in
the OCD-ID. So you'll get :borough from
ocd-division/country:us/state:ak/borough:bfe, for example.

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


removed call to -main

removed call to -main

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


Update camel-snake-kebab to 0.4.1

Update camel-snake-kebab to 0.4.1

--- project.clj
+++ project.clj
@@ -10,7 +10,7 @@
                  [digest "1.4.9"]
                  [bgzf4j "0.1.0"]
                  [com.climate/claypoole "1.1.4"]
-                 [camel-snake-kebab "0.4.0"]
+                 [camel-snake-kebab "0.4.1"]
                  [proton "0.1.8"]]
   :profiles {:dev {:dependencies [[org.clojure/clojure "1.10.1"]
                                   [cavia "0.5.1"]


adjust version to 0.1.1

adjust version to 0.1.1

--- project.clj
+++ project.clj
@@ -14,7 +14,7 @@
 ;;; limitations under the License.
 ;;;

-(defproject clj-starbuck "0.1.0"
+(defproject clj-starbuck "0.1.1"
   :description "Decouple your application's modules"
   :url "http://github.com/olivermg/clj-starbuck"
   :license {:name "Apache License, Version 2.0"


[DG] Refactored with entity->notification-type

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


Clojure Collector: bump clojure to 1.9.0 (closes #3779)

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/liveintent-berlin/snowplow.git/'


added jdk1.7.0_60

added jdk1.7.0_60

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


saioa-hasi laguntzailea

saioa-hasi laguntzailea

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


Marking test as working to test clojars push functionality

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


more information for repl user

more information for repl user

--- sidecar/src/figwheel_sidecar/auto_builder.clj
+++ sidecar/src/figwheel_sidecar/auto_builder.clj
@@ -50,7 +50,7 @@
         logfile-path (or (:server-logfile figwheel-server) "figwheel_server.log")
         _ (mkdirs logfile-path)
         log-writer (io/writer logfile-path :append true)]
-    (println "Server output being sent to logfile:" logfile-path)
+    (println "Server output being sent to logfile:" logfile-path "\n")
     (binding [*out* log-writer
               *err* log-writer]
       ;; blocking build to ensure code exists before repl starts
@@ -60,6 +60,7 @@
     (if (:id (first builds'))
       (println "Launching ClojureScript REPL for build:" (:id (first builds')))
       (println "Launching ClojureScript REPL"))
+    (println "Prompt will show when figwheel connects to your application")
     (fig-repl/repl (first builds') figwheel-server)))

 (defn autobuild [src-dirs build-options figwheel-options]


Only call from the entities ns

Only call from the entities ns

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


partway through 12.2

partway through 12.2

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

--- src/joy/gui/DynaFrame.clj
+++ src/joy/gui/DynaFrame.clj
@@ -0,0 +1,28 @@
+(ns joy.gui.DynaFrame
+  (:gen-class
+   :name joy.gui.DynaFrame
+   :extends javax.swing.JFrame
+   :implements [clojure.lang.IMeta]
+   :prefix df-
+   :state state
+   :init init
+   :constructors {[String] [String]
+                  [] [String]}
+   :methods [[display [java.awt.Container] void]
+             ^{:static true} [version [] String]])
+  (:import (javax.swing JFrame JPanel JComponent)
+           (java.awt BorderLayout Container)))
+
+(defn df-init [title]
+  [[title] (atom {::title title})])
+
+(defn df-meta [this] @(.state this))
+(defn version [] "1.0")
+
+(defn df-display [this pane]
+  (doto this
+    (-> .getContentPane .removeAll)
+    (.setContentPane (doto (JPanel.)
+                       (.add pane BorderLayout/CENTER)))
+    (.pack)
+    (.setVisible true)))


Updated configuration.

Updated configuration.

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


Add functions for interacting with EBS snapshots

error: pathspec 'src/circle/admin/ebs.clj' did not match any file(s) known to git

--- src/circle/admin/ebs.clj
+++ src/circle/admin/ebs.clj
@@ -0,0 +1,43 @@
+(ns circle.admin.ebs
+  (:require [org.jclouds.ec2.ebs2 :as ebs])
+  (:require [circle.backend.ec2 :as ec2])
+  (:use [circle.utils.except :only (throw-if-not)])
+  (:use [circle.aws-credentials :only (jclouds-compute)]))
+
+(defn default-volume [instance-id]
+  (let [inst (ec2/instance instance-id)
+        devices (map bean (-> inst :blockDeviceMappings))
+        root-dev (-> inst :rootDeviceName)
+        dev (first (filter #(not= root-dev (:deviceName %)) devices))]
+    (-> dev :ebs (bean) :volumeId)))
+
+(defn volume-from-id
+  "returns a Volume from the id"
+  [vol-id]
+  (->>
+   jclouds-compute
+   (ebs/volumes)
+   (filter #(= vol-id (.getId %)))
+   (first)))
+
+(defn take-snapshot
+  "Create a snapshot of an EBS volume.
+  ec2-id - and AWS instance id
+  description -
+
+  Options:
+  vol-id - the vol-id. If not specified, uses the first non-root device.
+   "
+  [ec2-id description & {:keys [vol-id]}]
+  (ebs/create-snapshot jclouds-compute (volume-from-id (or vol-id (default-volume ec2-id))) description))
+
+(defn latest-snapshot
+  "Returns the snapshot-id with matching description"
+  [description]
+  (->>
+   (ebs/snapshots jclouds-compute :owner "self")
+   (map bean)
+   (filter #(= description (:description %)))
+   (sort-by :startTime)
+   (last)
+   :id))


Get rid of a few more accidental println.

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


Clojure Collector: bump compojure to 1.6.1 (closes #3780)


Created .lein/profiles.

Created .lein/profiles.

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

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -0,0 +1,3 @@
+{:user {:plugins [[org.clojars.ibdknox/lein-nailgun "1.1.1"]
+                  [clj-stacktrace "0.2.4"]
+                  [lein-pprint "1.1.1"]]}}


Updated location of preview app

Updated location of preview app

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


Better docstring for session store

Better docstring for session store

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


reorg beginnings of core into core,core*

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


Kill -save-async in favor of accumulate-novelty

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/leif47/immutabledb-experimental.git/'


Add macro example from section 7.1

Add macro example from section 7.1

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

--- src/clojure/clojure_walkthrough/cjia/ch07_xx.clj
+++ src/clojure/clojure_walkthrough/cjia/ch07_xx.clj
@@ -0,0 +1,18 @@
+(ns clojure-walkthrough.cjia.ch07-xx)
+; 7.1: Macro basic
+
+; 7.1.1: Textual substitution
+
+(def a-ref (ref 0))
+
+(dosync
+ (ref-set a-ref 1)) ; 1
+
+;; You could implement this using the macros like
+; (syn-set a-ref 1)
+
+(defmacro sync-set [r v]
+  (list 'dosync
+        (list 'ref-set r v)))
+
+(sync-set a-ref 1) ;; 1


added mastersign.imaging namespace for image related functions

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

--- src/mastersign/imaging.clj
+++ src/mastersign/imaging.clj
@@ -0,0 +1,20 @@
+(ns mastersign.imaging
+  (:import [java.io File])
+  (:import [java.awt.image BufferedImage])
+  (:import [javax.imageio ImageIO]))
+
+(defn image
+  [w h]
+  (BufferedImage. w h BufferedImage/TYPE_INT_ARGB))
+
+(defn create-image
+  [w h f]
+  (let [img (image w h)
+        g (.createGraphics img)]
+    (f g w h)
+    (.dispose g)
+    img))
+
+(defn save-image
+  [img path]
+  (ImageIO/write img "png" (File. path)))


microbench WIP

microbench WIP


More selective pr-str-ing

More selective pr-str-ing

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


[WM SD] use form-works-timeout config in wire-up

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/vote-by-mail-works.git/'


Ensure missing lang attr when nil arg

Ensure missing lang attr when nil arg

...in find-notification-type

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


update tests

update tests

--- test/metabase/driver/generic_sql/query_processor_test.clj
+++ test/metabase/driver/generic_sql/query_processor_test.clj
@@ -11,7 +11,7 @@
 ;; Check that we get an error response formatted the way we'd expect
 (expect
     {:status :failed
-     :error "Column \"CHECKINS.NAME\" not found; SQL statement:\nSELECT \"CHECKINS\".* FROM \"CHECKINS\" WHERE (\"CHECKINS\".\"NAME\" = ?)"}
+     :error "Column \"CHECKINS.NAME\" not found; SQL statement:\nSELECT \"CHECKINS\".* FROM \"CHECKINS\" WHERE (\"CHECKINS\".\"NAME\" = ?) LIMIT 10000"}
   ;; This will print a stacktrace. Better to reassure people that that's on purpose than to make people question whether the tests are working
   (do (log/info (color/green "NOTE: The following stacktrace is expected <3"))
       (driver/process-query {:database @db-id


fix reportError for spouts and bolts

fix reportError for spouts and bolts

--- src/clj/backtype/storm/daemon/executor.clj
+++ src/clj/backtype/storm/daemon/executor.clj
@@ -325,7 +325,7 @@
         ^Integer max-spout-pending (if max-spout-pending (int max-spout-pending))
         worker-context (:worker-context executor-data)
         transfer-fn (:transfer-fn executor-data)
-        report-error-fn (:report-error-fn executor-data)
+        report-error-fn (:report-error executor-data)
         spouts (ArrayList. (map :object (vals task-datas)))
         sampler (:sampler executor-data)
         rand (Random. (Utils/secureRandomLong))
@@ -456,7 +456,7 @@
         worker-context (:worker-context executor-data)
         storm-conf (:storm-conf executor-data)
         executor-stats (:stats executor-data)
-        report-error-fn (:report-error-fn executor-data)
+        report-error-fn (:report-error executor-data)
         sampler (:sampler executor-data)
         rand (Random. (Utils/secureRandomLong))
         tuple-action-fn (fn [task-id ^TupleImpl tuple]


Added Smallest problem.

Added Smallest problem.

error: pathspec 'src/clojush/problems/software/smallest.clj' did not match any file(s) known to git

--- src/clojush/problems/software/smallest.clj
+++ src/clojush/problems/software/smallest.clj
@@ -0,0 +1,171 @@
+;; smallest.clj
+;; Tom Helmuth, thelmuth@cs.umass.edu
+;;
+;; Problem Source: Program Repair Benchmark Paper (add citation later)
+;;
+;; Given 4 integers, print the smallest of them.
+;;
+;; input stack has 4 integers
+
+(ns clojush.problems.software.smallest
+  (:use clojush.pushgp.pushgp
+        [clojush pushstate interpreter random util globals]
+        clojush.instructions.tag
+        clojure.math.numeric-tower
+        ))
+
+; Atom generators
+(def smallest-atom-generators
+  (concat (list
+            ;;; end constants
+            (fn [] (- (lrand-int 201) 100))
+            ;;; end ERCs
+            (tag-instruction-erc [:exec :integer :boolean] 1000)
+            (tagged-instruction-erc 1000)
+            ;;; end tagERCs
+            'in1
+            'in2
+            'in3
+            'in4
+            ;;; end input instructions
+            )
+          (registered-for-stacks [:integer :boolean :exec :print])))
+
+;; A list of data domains for the problem. Each domain is a vector containing
+;; a "set" of inputs and two integers representing how many cases from the set
+;; should be used as training and testing cases respectively. Each "set" of
+;; inputs is either a list or a function that, when called, will create a
+;; random element of the set.
+(def smallest-data-domains
+  [[['(0 0 0 0) '(-44 -44 -7 -13) '(0 4 -99 -33) '(-22 -22 -22 -22) '(99 100 99 100)] 5 0] ;; Edge cases by hand
+   [(fn [] (shuffle (conj (repeat 3 (- (lrand-int 201) 100))
+                          (- (lrand-int 201) 100)))) 10 100] ;; Edge cases where 3 of 4 are the same
+   [(fn [] (repeat 4 (- (lrand-int 201) 100))) 5 100] ;; Edge cases where all are the same
+   [(fn [] (repeatedly 4 #(lrand-int 101))) 20 200] ;; Each input includes 4 integers in range [0,100]
+   [(fn [] (repeatedly 4 #(- (lrand-int 201) 100))) 60 600] ;; Each input includes 4 integers in range [-100,100]
+   ])
+
+(defn test-and-train-data-from-domains
+  "Takes a list of domains and creates a set of (random) train inputs and a set of test
+   inputs based on the domains. Returns [train test]. A program should not
+   be considered a solution unless it is perfect on both the train and test
+   cases."
+  [domains]
+  (apply mapv concat (map (fn [[input-set n-train n-test]]
+                            (if (fn? input-set)
+                              (vector (repeatedly n-train input-set)
+                                      (repeatedly n-test input-set))
+                              (vector (if (>= n-train (count input-set))
+                                        input-set
+                                        (take n-train (shuffle input-set)))
+                                      (if (>= n-test (count input-set))
+                                        input-set
+                                        (take n-test (shuffle input-set))))))
+                          domains)))
+
+;;Can make Smallest test data like this:
+;(test-and-train-data-from-domains smallest-data-domains)
+
+; Helper function for error function
+(defn smallest-test-cases
+  "Takes a sequence of inputs and gives IO test cases of the form
+   [[input1 input2 input3] output]."
+  [inputs]
+  (map #(vector %
+                (apply min %))
+       inputs))
+
+; Define error function. For now, each run uses different random inputs
+(defn smallest-error-function
+  "Returns the error function for the Smallest problem. Takes as
+   input Smallest data domains."
+  [data-domains]
+  (let [[train-cases test-cases] (map smallest-test-cases
+                                      (test-and-train-data-from-domains data-domains))]
+    (when true ;; Change to false to not print test cases
+      (doseq [[i case] (map vector (range) train-cases)]
+        (println (format "Train Case: %3d | Input/Output: %s" i (str case))))
+      (doseq [[i case] (map vector (range) test-cases)]
+        (println (format "Test Case: %3d | Input/Output: %s" i (str case)))))
+    (fn the-actual-smallest-error-function
+      ([program]
+        (the-actual-smallest-error-function program :train))
+      ([program data-cases] ;; data-cases should be :train or :test
+        (the-actual-smallest-error-function program data-cases false))
+      ([program data-cases print-outputs]
+        (let [behavior (atom '())
+              errors (doall
+                       (for [[[input1 input2 input3 input4] out-int] (case data-cases
+                                                                                :train train-cases
+                                                                                :test test-cases
+                                                                                [])]
+                         (let [final-state (run-push program
+                                                     (->> (make-push-state)
+                                                       (push-item input4 :input)
+                                                       (push-item input3 :input)
+                                                       (push-item input2 :input)
+                                                       (push-item input1 :input)
+                                                       (push-item "" :output)))
+                               printed-result (stack-ref :output 0 final-state)]
+                           (when print-outputs
+                             (println (format "Correct output: %-19s | Program output: %-19s" (str out-int) printed-result)))
+                           ; Record the behavior
+                           (when @global-print-behavioral-diversity
+                             (swap! behavior conj printed-result))
+                           ; Each test case is either right or wrong
+                           (if (= printed-result (str out-int))
+                             0
+                             1))))]
+          (when @global-print-behavioral-diversity
+            (swap! population-behaviors conj @behavior))
+          errors)))))
+
+(defn smallest-report
+  "Custom generational report."
+  [best population generation error-function report-simplifications]
+  (let [best-program (not-lazy (:program best))
+        best-test-errors (error-function best-program :test)
+        best-total-test-error (apply +' best-test-errors)]
+    (println ";;******************************")
+    (printf ";; -*- Smallest problem report - generation %s\n" generation)(flush)
+    (println "Test total error for best:" best-total-test-error)
+    (println (format "Test mean error for best: %.5f" (double (/ best-total-test-error (count best-test-errors)))))
+    (when (zero? (:total-error best))
+      (doseq [[i error] (map vector
+                             (range)
+                             best-test-errors)]
+        (println (format "Test Case  %3d | Error: %d" i error))))
+    (println ";;------------------------------")
+    (println "Outputs of best individual on training cases:")
+    (error-function best-program :train true)
+    (println ";;******************************")
+    )) ;; To do validation, could have this function return an altered best individual
+       ;; with total-error > 0 if it had error of zero on train but not on validation
+       ;; set. Would need a third category of data cases, or a defined split of training cases.
+
+
+; Define the argmap
+(def argmap
+  {:error-function (smallest-error-function smallest-data-domains)
+   :atom-generators smallest-atom-generators
+   :max-points 200
+   :max-points-in-initial-program 100
+   :evalpush-limit 200
+   :population-size 1000
+   :max-generations 200
+   :parent-selection :lexicase
+   :epigenetic-markers [:close]
+   :genetic-operator-probabilities {:alternation 0.2
+                                    :uniform-mutation 0.2
+                                    :uniform-close-mutation 0.1
+                                    [:alternation :uniform-mutation] 0.5
+                                    }
+   :alternation-rate 0.01
+   :alignment-deviation 5
+   :uniform-mutation-rate 0.01
+   :problem-specific-report smallest-report
+   :print-behavioral-diversity true
+   :report-simplifications 0
+   :final-report-simplifications 5000
+   ;:max-error 1
+   })


Clojure day 17 solution.

Clojure day 17 solution.

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

--- clojure/src/advent2016/day17.clj
+++ clojure/src/advent2016/day17.clj
@@ -0,0 +1,49 @@
+(ns advent2016.day17
+  (:require [advent2016.core :refer [md5]]
+            [loom.alg-generic :refer [bf-traverse]]))
+
+(def broken "hijkl")
+(def example1 "ihgpwlah")
+(def example2 "kglvqrro")
+(def example3 "ulqzkmiv")
+(def puzzle "veumntbg")
+
+(defn move [[x y] dir]
+  (condp = dir
+    :U [x (dec y)]
+    :D [x (inc y)]
+    :L [(dec x) y]
+    :R [(inc x) y]))
+
+(defn legal [pos [dir open?]]
+  (when (and open? (not= pos [3 3]))
+    (let [[x y] (move pos dir)]
+      (when (and (>= 3 x 0) (>= 3 y 0))
+        dir))))
+
+(defn doors [passcode [path pos]]
+  (->> (map name path)
+       (apply str)
+       (str passcode)
+       md5
+       (take 4)
+       (map #{\b \c \d \e \f})
+       (map vector [:U :D :L :R])
+       (keep #(legal pos %))
+       (map (juxt (partial conj path)
+                  (partial move pos)))))
+
+(defn vault [[path pos] _ _] (when (= pos [3 3]) path))
+
+(def solution1 (-> (partial doors puzzle)
+                   (bf-traverse [[] [0 0]] :f vault)
+                   (->> (remove nil?)
+                        first
+                        (map name)
+                        (apply str))))
+
+(def solution2 (-> (partial doors puzzle)
+                   (bf-traverse [[] [0 0]] :f vault)
+                   (->> (remove nil?)
+                        (map count)
+                        (apply max))))


First pass at bfs

First pass at bfs

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

--- clojure/src/hackerrank/graph.clj
+++ clojure/src/hackerrank/graph.clj
@@ -0,0 +1,60 @@
+(ns hackerrank.graph)
+
+(require '[clojure.string :as s])
+(require '[clojure.set :as cs])
+
+(defn build-graph [num-nodes edge-list]
+  (let [initial-graph
+        (reduce (fn [acc idx]
+                  (assoc acc (keyword (str idx)) nil))
+                {}
+                (range 1 (inc num-nodes)))]
+    (reduce (fn [acc edge]
+              (let [src (first edge)
+                    dest (last edge)
+                    next-src-vec (into (src acc) (vec (list dest)))
+                    next-dest-vec (into (dest acc) (vec (list src)))]
+                (assoc (assoc acc dest (vec next-dest-vec)) src (vec next-src-vec))))
+            {}
+            edge-list)))
+
+(defn find-depth-helper [graph src-set dest visited-set depth]
+  (let [next-visited-set (into visited-set src-set)
+        next-src-set (cs/difference (set (flatten (map graph src-set))) next-visited-set)]
+    (cond
+      (src-set dest) depth
+      (empty? next-src-set) -1
+      :else (recur graph next-src-set dest next-visited-set (inc depth)))))
+
+(defn find-depth [graph src dest]
+  (if
+    (= src dest) 0
+    (find-depth-helper graph (set (src graph)) dest #{} 1)))
+
+(defn next-level [graph src]
+  (vec (set (flatten (map graph (src graph))))))
+
+(defn -main []
+  (let [num-test-cases (Integer/parseInt (s/trim (read-line)))]
+    (doseq [i (range num-test-cases)]
+      (let [edges-and-nodes (s/split (s/trim (read-line)) #" ")
+            nodes (Integer/parseInt (first edges-and-nodes))
+            edges (Integer/parseInt (last edges-and-nodes))
+            edge-list (reduce
+                       (fn [acc line]
+                         (let [line-parsed (map keyword (s/split (s/trim (read-line)) #" "))]
+                           (into acc [line-parsed])))
+                       []
+                       (range edges))
+            start-node (s/trim (read-line))
+            g (build-graph nodes edge-list)
+            res (map
+                 #(if (> % 0) (* 6 %) %)
+                 (filter
+                  #(not (= % 0))
+                  (map
+                   #(find-depth g (keyword start-node) (keyword (str %)))
+                   (range 1 (inc nodes)))))]
+        (doseq [r res]
+          (print (str r " ")))
+        (println "")))))


Add property parsing utilities with function specs

error: pathspec 'src/main/workflo/macros/props/util.cljc' did not match any file(s) known to git

--- src/main/workflo/macros/props/util.cljc
+++ src/main/workflo/macros/props/util.cljc
@@ -0,0 +1,58 @@
+(ns workflo.macros.props.util
+  (:require #?(:cljs [cljs.spec :as s]
+               :clj  [clojure.spec :as s])
+            [clojure.string :refer [capitalize]]))
+
+(s/fdef combine-properties-and-property-groups
+  :args (s/cat :props-and-groups vector?)
+  :ret  vector?)
+
+(defn combine-properties-and-groups
+  "Takes a vector of property names or [base subprops] groups,
+   e.g. [foo [bar [baz ruux]]], and returns a flat vector into which
+   the group vectors are spliced, e.g. [foo bar [bax ruux]]."
+  [props-and-groups]
+  (transduce (map (fn [prop-or-group]
+                    (cond-> prop-or-group
+                      (not (vector? prop-or-group))
+                      vector)))
+             (comp vec concat)
+             []
+             props-and-groups))
+
+
+(s/fdef capitalized-name
+  :args (s/cat :x (s/and symbol?
+                         #(not (nil? (name %)))))
+  :ret string?
+  :fn (s/and #(= (first (:ret %))
+                 (first (capitalize (name (:x (:args %))))))
+             #(= (rest (:ret %))
+                 (rest (name (:x (:args %)))))))
+
+(defn capitalized-name
+  "Returns the name of a symbol, keyword or string, with the first
+   letter capitalized."
+  [x]
+  (apply str
+         (capitalize (first (name x)))
+         (rest (name x))))
+
+(s/fdef capitalized-symbol?
+  :args (s/cat :x ::s/any)
+  :ret boolean?
+  :fn (s/or
+       :capitalized-symbol
+       (s/and #(symbol? (:x (:args %)))
+              #(= (first (name (:x (:args %))))
+                  (first (capitalize (first (name (:x (:args %)))))))
+              #(true? (:ret %)))
+       :other
+       #(false? (:ret %))))
+
+(defn capitalized-symbol?
+  "Returns true if x is a symbol that starts with a capital letter."
+  [x]
+  (and (symbol? x)
+       (= (name x)
+          (capitalized-name x))))


fix older versions of clojure not being able to annotate primatives ಠ_ಠ

--- src/clj_http/client.clj
+++ src/clj_http/client.clj
@@ -380,7 +380,7 @@
        (instance? InputStream body)
        (client (-> req (assoc :body
                          (if length
-                           (InputStreamEntity. ^InputStream body ^long length)
+                           (InputStreamEntity. ^InputStream body length)
                            (maybe-wrap-entity
                             req
                             (InputStreamEntity. ^InputStream body -1))))))


Reorganized requires.

Reorganized requires.

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


resolve all doc-dir with sensible resolving - again

--- user.clj
+++ user.clj
@@ -29,11 +29,9 @@
   (doto arg prn))

 (defn doc-dir "Prints docs for a given namespace" [nsname]
-  (let [ [resolved unresolved] (split resolve (clojure.repl/dir-fn nsname)) ]
-    (doseq [sym resolved]
-      (@#'clojure.repl/print-doc (meta (sym-to-var sym))))
-    (when-not (empty? unresolved)
-      (println (str "\n" "Unable to resolve these symbols: " (string/join ", " unresolved))))))
+  (let [resolved (map #(ns-resolve (the-ns nsname) %) (clojure.repl/dir-fn nsname))]
+    (doseq [v resolved]
+      (@#'clojure.repl/print-doc (meta v)))))

 ; TODO: macroize for non-reply repls
 ;(defn jdoc "javadoc an object" [obj]


Fucking emacs.

Fucking emacs.

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


Remove :data from schema validation errors

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


cluster: check command context

cluster: check command context

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


[WM] use map query form in db

[WM] use map query form in db


Add support for :retry-handler

Add support for :retry-handler

--- src/clj_http/core2.clj
+++ src/clj_http/core2.clj
@@ -10,6 +10,7 @@
            (java.util Locale)
            (org.apache.http HttpEntity HeaderIterator HttpHost HttpRequest
                             HttpEntityEnclosingRequest HttpResponse)
+           (org.apache.http.client HttpRequestRetryHandler)
            (org.apache.http.client.methods HttpDelete HttpGet HttpPost HttpPut
                                            HttpOptions HttpPatch
                                            HttpHead
@@ -139,15 +140,15 @@

 (defn request
   [{:keys [body
+           conn-mgr
            cookie-store
            multipart
+           query-string
+           retry-handler
            request-method
            scheme
            server-name
            server-port
-           request-method
-           query-string
-           conn-mgr
            uri]
     :as req}]
   (let [scheme (name scheme)
@@ -163,6 +164,11 @@
       (.addHeader http-req "Connection" "close"))
     (when cookie-store
       (.setCookieStore context cookie-store))
+    (when retry-handler
+      (.setRetryHandler client
+                        (proxy [HttpRequestRetryHandler] []
+                          (retryRequest [e cnt context]
+                            (retry-handler e cnt context)))))
     (if multipart
       (.setEntity ^HttpEntityEnclosingRequest http-req
                   (mp/create-multipart-entity multipart))


test parse-uri

test parse-uri

error: pathspec 'test-cljs/frontend/test_routes.cljs' did not match any file(s) known to git

--- test-cljs/frontend/test_routes.cljs
+++ test-cljs/frontend/test_routes.cljs
@@ -0,0 +1,24 @@
+(ns frontend.test-routes
+  (:require [clojure.string :as string]
+            [om.core :as om :include-macros true]
+            [om.dom]
+            [cemerick.cljs.test]
+            [secretary.core :as secretary]
+            [cljs.core.async :as async]
+            [frontend.routes :as routes])
+  (:require-macros [cemerick.cljs.test :refer (is deftest with-test run-tests testing test-var)]))
+
+(deftest parse-uri-works
+  (testing "a basic uri"
+    (is (= ["/page/subpage" nil nil] (routes/parse-uri "/page/subpage")))
+    (is (= ["/page" nil nil] (routes/parse-uri "/page"))))
+
+  (testing "a uri with query parameters"
+    (is (= ["/page" "abc=123&xyz=789" nil] (routes/parse-uri "/page?abc=123&xyz=789"))))
+
+  (testing "a uri with an anchor"
+    (is (= ["/page" nil "here"] (routes/parse-uri "/page#here")))
+    (is (= ["/page" nil "here?partOf=anchor"] (routes/parse-uri "/page#here?partOf=anchor"))))
+
+  (testing "a uri with both anchor and query parameters"
+    (is (= ["/page" "abc=123" "here"] (routes/parse-uri "/page?abc=123#here")))))


Prep HTML/JavaScript escape changes for pull

Removes brittle ui test

--- test/clj/backtype/storm/ui_test.clj
+++ test/clj/backtype/storm/ui_test.clj
@@ -1,52 +0,0 @@
-(ns backtype.storm.ui-test
-  (:use [backtype.storm.ui core])
-  (:use [clojure test])
-  (:use [hiccup.core :only (html)])
-)
-
-(deftest test-javascript-escaped-in-action-buttons
-  (let [expected-s "confirmAction('XX\\\"XX\\'XX\\\\XX\\/XX\\nXX', 'XX\\\"XX\\'XX\\\\XX\\/XX\\nXX', 'activate', false, 0)"
-        malicious-js "XX\"XX'XX\\XX/XX
-XX"
-        result (topology-action-button malicious-js malicious-js
-                                "Activate" "activate" false 0 true)
-        onclick (:onclick (second result))]
-
-    (is (= expected-s onclick)
-        "Escapes quotes, slashes, back-slashes, and new-lines.")
-  )
-)
-
-(deftest test-topology-link-escapes-content-html
-  (let [topo-name "BOGUSTOPO"]
-    (is (= (str "<BLINK>foobar")
-           (html (topology-link topo-name "<BLINK>foobar"))))
-  )
-)
-
-(deftest test-component-link-escapes-content-html
-  (let [topo-name "BOGUSTOPO"]
-    (is (= (str "<BLINK>comp-id")
-           (html (component-link topo-name "<BLINK>comp-id"))))
-  )
-)
-
-; main-topology-summary-table
-; submit topo name like "<BLINK>foobar"
-; Load / and visually confirm the 'id' column does not blink for the topo.
-
-; topology-summary-table
-; submit topo name like "<BLINK>foobar"
-; Load / and visually confirm the 'id' column does not blink for the topo or the name
-
-; topology-summary-table
-; submit topo name like "<BLINK>foobar"
-; Load / and visually confirm the 'id' column does not blink for the topo or the name
-
-; component-page
-; recompile a topology (such as the ExclamationTopology from storm-starter) and hardcode bolt/spout names with '<blink>'
-; Load the bolt or spout component page and visually confirm the 'id' column does not blink the component name.
-
-; bolt-input-summary-table
-; recompile a topology (such as the ExclamationTopology from storm-starter) and hardcode bolt names with '<blink>'
-; A bolt component page and visually confirm the 'component' column of the Input stats does not blink the component name.


Validate OrganizationMembership POST/PUT organization_id

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


Removing printlns

Removing printlns

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


Indentation

Indentation


Fix a few description typos

Fix a few description typos

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


core,core* WIP

core,core* WIP

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


don't assume boxed args (doesn't seem necessary at this point)


consistent formatting for (with-meta ...) in warp plans


ensure we are returning a set from tried-to-register


whitespace

whitespace

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


Create modern dialect.

Create modern dialect.

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

--- src/manners/modern.clj
+++ src/manners/modern.clj
@@ -0,0 +1,10 @@
+(ns manners.modern
+  (:require [manners.utils :refer [defalias]]
+            [manners.victorian :as vic]))
+
+(defalias valid? vic/proper?)
+(defalias invalid? vic/rude?)
+(defalias errors vic/bad-manners)
+(defalias validate! vic/avow!)
+(defalias validator vic/coach)
+(defalias throw-errors vic/falter)


Pulse card truncation warning and general cleanup

--- src/metabase/pulse.clj
+++ src/metabase/pulse.clj
@@ -3,6 +3,7 @@
             [clj-time.core :as t]
             [clj-time.coerce :as c]
             [clj-time.format :as f]
+            [clojure.java.io :as io]
             [clojure.tools.logging :as log]
             [clojure.pprint :refer [cl-format]]
             [clojure.string :refer [upper-case]]
@@ -15,12 +16,26 @@

 (def ^:private card-width 400)

-(def ^:private font-style "font-family: Lato, \"Helvetica Neue\", Helvetica, Arial, sans-serif;")
-(def ^:private section-style font-style)
-(def ^:private header-style  (str font-style "font-size: 16px; font-weight: 700; color: rgb(57,67,64); text-decoration: none;"))
-(def ^:private scalar-style  (str font-style "font-size: 32px; font-weight: 400; color: rgb(45,134,212);"))
-(def ^:private bar-th-style  (str font-style "font-size: 10px; font-weight: 400; color: rgb(57,67,64); border-bottom: 4px solid rgb(248, 248, 248); padding-top: 0px; padding-bottom: 10px;"))
+(def ^:private rows-limit 10)
+(def ^:private cols-limit 3)
+
+;;; ## STYLES
+
+(def ^:private color-brand  "rgb(80,158,227)")
+(def ^:private color-purple "rgb(135,93,175)")
+(def ^:private color-grey-1 "rgb(248,248,248)")
+(def ^:private color-grey-2 "rgb(189,193,191)")
+(def ^:private color-grey-3 "rgb(124,131,129)")
+(def ^:private color-grey-4 "rgb(57,67,64)")
+
+(def ^:private font-style    "font-family: Lato, \"Helvetica Neue\", Helvetica, Arial, sans-serif;")
+(def ^:private section-style (str font-style))
+(def ^:private header-style  (str font-style "font-size: 16px; font-weight: 700; color: " color-grey-4 "; text-decoration: none;"))
+(def ^:private scalar-style  (str font-style "font-size: 32px; font-weight: 400; color: " color-brand ";"))
+(def ^:private bar-th-style  (str font-style "font-size: 10px; font-weight: 400; color: " color-grey-4 "; border-bottom: 4px solid " color-grey-1 "; padding-top: 0px; padding-bottom: 10px;"))
 (def ^:private bar-td-style  (str font-style "font-size: 16px; font-weight: 400; text-align: left; padding-right: 1em; padding-top: 8px;"))
+(def ^:private button-style  (str font-style "display: inline-block; box-sizing: border-box; padding: 8px; color: " color-brand "; border: 1px solid " color-brand "; border-radius: 4px; text-decoration: none; "))
+

 (defn- format-number
   [n]
@@ -50,36 +65,76 @@
     (number? value) (format-number value)
     :else (str value)))

-(defn render-table-row
-  [index row bar-column max-value]
-  [:tr {:style (if (odd? index) "color: rgb(189,193,191);" "color: rgb(124,131,129);")}
-    [:td {:style bar-td-style} (-> row first format-cell h)]
-    [:td {:style (str bar-td-style "font-weight: 700;")} (-> row second format-cell h)]
-    (if bar-column [:td {:style (str bar-td-style "width: 99%;")}
-      [:div {:style (str "background-color: rgb(135, 93, 175); height: 20px; width: " (float (* 100 (/ (bar-column row) max-value))) "%")} " "]])])
+(defn card-href
+  [card]
+  (h (str (setting/get :-site-url) "/card/" (:id card) "?clone")))
+
+(defn render-button
+  [text href icon render-img]
+  [:a {:style button-style :href href}
+    [:span (h text)]
+    (if icon [:img {:style "margin-left: 4px;"
+                    :width 16
+                    :src (-> (str "frontend_client/app/img/" icon "@2x.png") io/resource io/input-stream org.apache.commons.io.IOUtils/toByteArray render-img)}])])
+

 (defn render-table
-  [{:keys [cols rows]} bar-column]
-  (let [max-value (if bar-column (apply max (map bar-column rows)))
-        truncated-rows (take 10 rows)]
-    [:table {:style "border-collapse: collapse;"}
+  [card rows cols render-img col-indexes bar-column]
+  (let [max-value (if bar-column (apply max (map bar-column rows)))]
+    [:table {:style (str "padding-bottom: 8px; border-bottom: 4px solid " color-grey-1 ";")}
       [:thead
         [:tr
-          [:th {:style (str bar-td-style bar-th-style "min-width: 60px;")}
-            (-> cols first :display_name upper-case h)]
-          [:th {:style (str bar-td-style bar-th-style "min-width: 60px;")}
-            (-> cols second :display_name upper-case h)]
+          (map (fn [col-idx]
+                [:th {:style (str bar-td-style bar-th-style "min-width: 60px;")}
+                  (-> cols (nth col-idx) :display_name upper-case h)])
+                col-indexes)
           (if bar-column [:th {:style (str bar-td-style bar-th-style "width: 99%;")}])]]
       [:tbody
-        (map-indexed #(render-table-row %1 %2 bar-column max-value) truncated-rows)]]))
-
-(defn render-bar-chart
-  [data]
-  [:div
-    (render-table data second)])
-
-(defn render-scalar
-  [data]
+        (map-indexed (fn [row-idx row]
+          [:tr {:style (str "color: " (if (odd? row-idx) color-grey-2 color-grey-3) ";")}
+            (map (fn [col-idx]
+                  [:td {:style (str bar-td-style (if (and bar-column (= col-idx 1)) "font-weight: 700;"))}
+                    (-> row (nth col-idx) format-cell h)])
+                  col-indexes)
+            (if bar-column [:td {:style (str bar-td-style "width: 99%;")}
+              [:div {:style (str "background-color: " color-purple "; height: 20px; width: " (float (* 100 (/ (bar-column row) max-value))) "%")} " "]])])
+          rows)]]))
+
+(defn render-truncation-warning
+  [card {:keys [cols rows] :as data} render-img rows-limit cols-limit]
+  (if (or (> (count rows) rows-limit)
+          (> (count cols) cols-limit))
+    [:div {:style "padding-top: 16px;"}
+      (if (> (count rows) rows-limit)
+        [:div {:style (str "color: " color-grey-2 "; padding-bottom: 10px;")}
+          "Showing " [:strong {:style (str "color: " color-grey-3 ";")} (format-number rows-limit)]
+          " of "     [:strong {:style (str "color: " color-grey-3 ";")} (format-number (count rows))]
+          " rows."])
+      (if (> (count cols) cols-limit)
+        [:div {:style (str "color: " color-grey-2 "; padding-bottom: 10px;")}
+          "Showing " [:strong {:style (str "color: " color-grey-3 ";")} (format-number cols-limit)]
+          " of "     [:strong {:style (str "color: " color-grey-3 ";")} (format-number (count cols))]
+          " columns."])
+      [:div (render-button "View all" (card-href card) "external_link" render-img)]]))
+
+(defn render-card-table
+  [card {:keys [cols rows] :as data} render-img]
+  (let [truncated-rows (take rows-limit rows)
+        truncated-cols (take cols-limit cols)
+        col-indexes (map-indexed (fn [i _] i) truncated-cols)]
+    [:div
+      (render-table card truncated-rows truncated-cols render-img col-indexes nil)
+      (render-truncation-warning card data render-img rows-limit cols-limit)]))
+
+(defn render-card-bar
+  [card {:keys [cols rows] :as data} render-img]
+  (let [truncated-rows (take rows-limit rows)]
+    [:div
+      (render-table card truncated-rows cols render-img [0 1] second)
+      (render-truncation-warning card data render-img rows-limit 2)]))
+
+(defn render-card-scalar
+  [card data render-img]
   [:div {:style scalar-style}
     (-> data :rows first first format-cell h)])

@@ -106,8 +161,8 @@
     (javax.imageio.ImageIO/write image "png" os)
     (.toByteArray os)))

-(defn render-sparkline
-  [{:keys [rows cols] :as data} render-img]
+(defn render-card-sparkline
+  [card {:keys [rows cols] :as data} render-img]
   (let [xs (map #(-> % first .getTime) rows)
         xmin (apply min xs)
         xmax (apply max xs)
@@ -119,7 +174,7 @@
         yrange (- ymax ymin)
         ys' (map #(/ (- % ymin) yrange) ys)]
     [:div
-      [:div {:style "color: rgb(214,214,214);" }
+      [:div {:style (str "color: " color-grey-2 ";") }
         [:div {:style "display: inline-block; position: relative; margin-left: 30px;" }
           [:div {:style "position: relative;"}
             [:div {:style "position: absolute; height: 100%; text-align: right; background-color: red;"}
@@ -128,13 +183,13 @@
             [:img {:style "display: block; left: 20px;" :src (render-img (render-sparkline-to-png xs' ys' 285 150))}]
           ]
           [:div
-            [:div {:style "height: 15px; margin-left: 10px; margin-right: 10px; border: 4px solid rgb(233,233,233); border-top: none; border-bottom: none;"} " "]
+            [:div {:style (str "height: 15px; margin-left: 10px; margin-right: 10px; border: 4px solid " color-grey-1 "; border-top: none; border-bottom: none;")} " "]
             [:div {:style "height: 15px; margin-left: 10px; margin-right: 10px;"}
               [:div {:style "float: left;"} (format-timestamp xmin)]
               [:div {:style "float: right;"} (format-timestamp xmax)]]
           ]]]
       [:div {:style "margin-top: 20px; margin-left: 30px;"}
-        (render-table {:cols cols :rows [(last rows) (first rows)]} nil)]]))
+        (render-table card [(last rows) (first rows)] cols render-img [0 1] nil)]]))

 (defn datetime-field?
   [field]
@@ -166,16 +221,17 @@
   (try
     [:div {:style (str section-style "margin: 16px;")}
       (if include-title [:div {:style "margin-bottom: 16px;"}
-        [:a {:style header-style :href (h (str (setting/get :-site-url) "/card/" (:id card) "?clone"))}
+        [:a {:style header-style :href (get-card-href card)}
           (-> card :name h)]])
       (case (detect-pulse-card-type card data)
-        :scalar    (render-scalar data)
-        :sparkline (render-sparkline data render-img)
-        :bar       (render-bar-chart data)
-        :table     (render-table data nil)
+        :scalar    (render-card-scalar    card data render-img)
+        :sparkline (render-card-sparkline card data render-img)
+        :bar       (render-card-bar       card data render-img)
+        :table     (render-card-table     card data render-img)
         [:div {:style (str font-style "color: #F9D45C; font-weight: 700;")}
           "We were unable to display this card." [:br] "Please view this card in Metabase."])]
   (catch Throwable e
+    (log/warn (str "Pulse card render error:" e))
     [:div {:style (str font-style "color: #EF8C8C; font-weight: 700;")} "An error occurred while displaying this card."])))

 (defn render-img-data-uri
@@ -203,7 +259,7 @@
   [pulse results]
   (let [images (atom [])
         render-img (fn [bytes] (reset! images (conj @images bytes)) (str "cid:IMAGE_" (-> @images count dec)))
-        header [:h1 {:style (str section-style "margin: 16px; color: rgb(57,67,64);")} (-> pulse :name h)]
+        header [:h1 {:style (str section-style "margin: 16px; color: " color-grey-4 ";")} (-> pulse :name h)]
         body (apply vector :div (mapv (partial render-pulse-section render-img) results))
         content (html [:html [:body [:div header body]]])]
     (apply vector {:type "text/html" :content content}


Add in links for membership schema

Add in links for membership schema


Skip the body altogether

Skip the body altogether


Don't put Datomic-related code into core.clj if not needed

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/alexander-yakushev/clj-vagrant-template.git/'


"lein run"-able gmm with variable number of clusters

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

--- examples/src/queries/gmm_variable_number_of_clusters.clj
+++ examples/src/queries/gmm_variable_number_of_clusters.clj
@@ -0,0 +1,79 @@
+(ns queries.gmm-variable-number-of-clusters
+  (:require [anglican.runtime :refer :all]
+            [anglican.emit :refer [defquery with-primitive-procedures]]
+            [clojure.core.matrix :as m]
+            [clojure.core.matrix.linear :as mlin]
+            [helpers.gmm :refer [normalize move-to-unit-box gridify]]))
+
+;; These are the hyperparameters for the model:
+;; mu0		mean for the Gaussian prior over the cluster means
+;; Sigma0	covariance for the Gaussian prior over the cluster means
+(def hyperparameters {:mu-0 [0 0]
+                      :Sigma-0 [[0.1 0] [0 0.1]]})
+
+;; This is a hack in order to sample from a discrete distribution in such a way that it doesn't trigger adaptation of the proposal. This will not change the inference behaviour in particle-based algorithms since it is equivalent to having a bootstrap proposal
+(defn sample-discrete [probs]
+  (sample* (discrete probs)))
+(defn sort-means-vars [means-vars]
+  (sort-by (comp mlin/norm first) means-vars))
+(def lo 0.0008)
+(def hi 0.0025)
+
+(with-primitive-procedures [normalize m/mmul m/identity-matrix sample-discrete sort-means-vars]
+  (defquery gmm-variable-number-of-clusters [data hyperparameters]
+    (let [num-clusters (sample "num-clusters" (uniform-discrete 1 6))
+          cluster-probs (normalize (repeat num-clusters 1))
+          means-vars (repeatedly num-clusters #(list (sample "mean" (mvn (:mu-0 hyperparameters) (:Sigma-0 hyperparameters)))
+                                                     (+ lo (* (/ (sample "var" (uniform-discrete 0 21)) 20.0)
+                                                              (- hi lo)))))
+          sorted-means-vars (sort-means-vars means-vars)
+          means (map first sorted-means-vars)
+          vars (map second sorted-means-vars)
+          clusters (map #(let [cluster (sample-discrete cluster-probs)
+                               mean (nth means cluster)
+                               var (nth vars cluster)]
+                           (observe (mvn mean (mmul var (identity-matrix 2))) %)
+                           cluster)
+                        data)]
+      {:num-clusters num-clusters
+       :clusters clusters
+       :cluster-probs cluster-probs
+       :means means
+       :vars vars})))
+
+(def num-data-points 100)
+(def grid-dimensions [100 100])
+
+;; Takes in samples from the prior, sorts means and vars according to means' norm
+(defn COMPILE-combine-samples-fn [samples]
+  (let [mean-samples (filter #(= "mean" (:sample-address %)) samples)
+        var-samples (filter #(= "var" (:sample-address %)) samples)
+        var-mean-zip (map vector var-samples mean-samples)
+        sorted-var-mean-zip (sort-by (comp mlin/norm :value second) var-mean-zip)
+        sorted-var-samples (map first sorted-var-mean-zip)
+        sorted-mean-samples (map second sorted-var-mean-zip)
+        sorted-samples (loop [res []
+                              smps samples
+                              var-smps sorted-var-samples
+                              mean-smps sorted-mean-samples]
+                         (if (empty? smps)
+                           res
+                           (let [smp (first smps)]
+                             (case (:sample-address smp)
+                               "mean" (recur (conj res (assoc smp :value (:value (first mean-smps))))
+                                             (rest smps)
+                                             var-smps
+                                             (rest mean-smps))
+                               "var" (recur (conj res (assoc smp :value (:value (first var-smps))))
+                                            (rest smps)
+                                            (rest var-smps)
+                                            mean-smps)
+                               (recur (conj res smp)
+                                      (rest smps)
+                                      var-smps
+                                      mean-smps)))))]
+    sorted-samples))
+
+;; Takes in observes from the prior, puts the on the grid.
+(defn COMPILE-combine-observes-fn [observes]
+  (gridify (move-to-unit-box (mapv (comp vec :value) observes)) grid-dimensions))


Testing mult2 routine

Testing mult2 routine

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