Initial checkin

This commit is contained in:
niten 2022-06-30 13:41:49 -07:00
commit 267efb83c8
6 changed files with 811 additions and 0 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
.DS_Store
.idea
*.log
tmp/
.cpcache/
.nrepl-port
target/
result

466
deps-lock.json Normal file
View File

@ -0,0 +1,466 @@
{
"lock-version": 3,
"git-deps": [
{
"lib": "io.github.cognitect-labs/test-runner",
"url": "https://github.com/cognitect-labs/test-runner.git",
"rev": "dfb30dd6605cb6c0efc275e1df1736f6e90d4d73",
"git-dir": "https/github.com/cognitect-labs/test-runner",
"hash": "sha256-PUNd+dHJNPTKno59YI27wpehyULYPvSyCQDjVIadKJ4="
},
{
"lib": "org.fudo/fudo-clojure",
"url": "https://git.fudo.org/fudo-public/fudo-clojure.git",
"rev": "c6a1ebef2e5b64d432a46ac48639c674e62b7cee",
"git-dir": "https/git.fudo.org/fudo-public/fudo-clojure",
"hash": "sha256-x89zORUUSq02Aqar0HCMb8xn7MrPbpOS7qrGK0Ubdp0="
}
],
"mvn-deps": [
{
"mvn-path": "camel-snake-kebab/camel-snake-kebab/0.4.2/camel-snake-kebab-0.4.2.jar",
"mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-p7hxVjg5GmkjD1D8Nh6W+zt/vAWXj5zMdO+veamBdrs="
},
{
"mvn-path": "camel-snake-kebab/camel-snake-kebab/0.4.2/camel-snake-kebab-0.4.2.pom",
"mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-q0kp6YUZCevRFA1J6OSnV3922+u4eHSlO/wa65suEyc="
},
{
"mvn-path": "clj-http/clj-http/3.12.3/clj-http-3.12.3.jar",
"mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-OJ0pdhKo6KzGbF0NZKbJO99lDe1iXG9q4Wk7kzaKkaU="
},
{
"mvn-path": "clj-http/clj-http/3.12.3/clj-http-3.12.3.pom",
"mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-Jx0VRYS9iV/S4w9jEVAE8ce4xySq6tLLKpl8XFWEBfA="
},
{
"mvn-path": "clj-tuple/clj-tuple/0.2.2/clj-tuple-0.2.2.jar",
"mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-WNv3Pai8403EmN5sNH+HLvmPMBo6KdyVeX1k+A5ra0c="
},
{
"mvn-path": "clj-tuple/clj-tuple/0.2.2/clj-tuple-0.2.2.pom",
"mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-ahZELYfCkwwDImtKo9KYkVfVi5TtPnyNZ2aLDrZYOJs="
},
{
"mvn-path": "commons-codec/commons-codec/1.15/commons-codec-1.15.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-s+n21jp5AQm/DQVmEfvtHPaQVYJt7+uYlKcTadJG7WM="
},
{
"mvn-path": "commons-codec/commons-codec/1.15/commons-codec-1.15.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-yG7hmKNaNxVIeGD0Gcv2Qufk2ehxR3eUfb5qTjogq1g="
},
{
"mvn-path": "commons-io/commons-io/2.8.0/commons-io-2.8.0.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-AvKR5dEkPcFDSW48u7QKHO1Hqljy1jPT44eAzQaNUHQ="
},
{
"mvn-path": "commons-io/commons-io/2.8.0/commons-io-2.8.0.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-18hkGjfW5282+56B/BQg4moJ1j+jLwD3R2TeBnyoNH0="
},
{
"mvn-path": "commons-logging/commons-logging/1.2/commons-logging-1.2.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-2t3qHqC+D1aXirMAa4rJKDSv7vvZt+TmMW/KV98PpjY="
},
{
"mvn-path": "commons-logging/commons-logging/1.2/commons-logging-1.2.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-yRq1qlcNhvb9B8wVjsa8LFAIBAKXLukXn+JBAHOfuyA="
},
{
"mvn-path": "org/apache/apache/13/apache-13.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-/1E9sDYf1BI3vvR4SWi8FarkeNTsCpSW+BEHLMrzhB0="
},
{
"mvn-path": "org/apache/apache/18/apache-18.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-eDEwcoX9R1u8NrIK4454gvEcMVOx1ZMPhS1E7ajzPBc="
},
{
"mvn-path": "org/apache/apache/21/apache-21.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-rxDBCNoBTxfK+se1KytLWjocGCZfoq+XoyXZFDU3s4A="
},
{
"mvn-path": "org/apache/apache/23/apache-23.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-vBBiTgYj82V3+sVjnKKTbTJA7RUvttjVM6tNJwVDSRw="
},
{
"mvn-path": "org/apache/commons/commons-parent/34/commons-parent-34.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-Oi5p0G1kHR87KTEm3J4uTqZWO/jDbIfgq2+kKS0Et5w="
},
{
"mvn-path": "org/apache/commons/commons-parent/52/commons-parent-52.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-ddvo806Y5MP/QtquSi+etMvNO18QR9VEYKzpBtu0UC4="
},
{
"mvn-path": "org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-UOmBqOVnoW69rRBGBbFWVAqGNFn6EnuLpkfzEN/IPvg="
},
{
"mvn-path": "org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-NPJO+Ya4nVG4CgkDh6o9DIJNQPCHrlzPrUf/PCYsLkc="
},
{
"mvn-path": "org/apache/httpcomponents/httpclient-cache/4.5.13/httpclient-cache-4.5.13.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-Zs797nR1mFJWr2gL86581dfULo/euTmmJ3ki4b3u1Do="
},
{
"mvn-path": "org/apache/httpcomponents/httpclient-cache/4.5.13/httpclient-cache-4.5.13.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-o1h75UcWw7gKMonBHfhlqWK8cr5HiRReQgxpSL9FpKQ="
},
{
"mvn-path": "org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-b+kCalZsalABYIzz/DIZZkH2weXhmG0QN8zb1fMe90M="
},
{
"mvn-path": "org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-eOua2nSSn81j0HrcT0kjaEGkXMKdX4F79FgB9RP9fmw="
},
{
"mvn-path": "org/apache/httpcomponents/httpcomponents-asyncclient/4.1.4/httpcomponents-asyncclient-4.1.4.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-6WXrNprx2LWmi31LeGHVOlJhaugD4TFi6N+EImFwAYA="
},
{
"mvn-path": "org/apache/httpcomponents/httpcomponents-client/4.5.13/httpcomponents-client-4.5.13.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-nLpZTAjbcnHQwg6YRdYiuznmlYORC0Xn1d+C9gWNTdk="
},
{
"mvn-path": "org/apache/httpcomponents/httpcomponents-core/4.4.10/httpcomponents-core-4.4.10.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-YelCfUvjJsMHp/FrqCjRyzsUcTybBPyLqZKljzdsMTY="
},
{
"mvn-path": "org/apache/httpcomponents/httpcomponents-core/4.4.14/httpcomponents-core-4.4.14.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-IJ7ZMctXmYJS3+AnyqnAOtpiBhNkIylnkTEWX4scutE="
},
{
"mvn-path": "org/apache/httpcomponents/httpcomponents-parent/10/httpcomponents-parent-10.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-yq+WfZSvshdT82CCxghiBr0fSIJf9ZaTLM66crZdOfo="
},
{
"mvn-path": "org/apache/httpcomponents/httpcomponents-parent/11/httpcomponents-parent-11.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-qQH4exFcVQcMfuQ+//Y+IOewLTCvJEOuKSvx9OUy06o="
},
{
"mvn-path": "org/apache/httpcomponents/httpcore-nio/4.4.10/httpcore-nio-4.4.10.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-3r7n6VcsAqFs4Mqk9WWp7OsSkNM816HjKXCHvUZ9r/Q="
},
{
"mvn-path": "org/apache/httpcomponents/httpcore-nio/4.4.10/httpcore-nio-4.4.10.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-pMmVtzjRBLdcyLEWTbYAUzFWwEfsy0yO5dknshoX7HM="
},
{
"mvn-path": "org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-+VYgnkUMsdDFF3bfvSPlPp3Y25oSmO1itwvwlEumOyg="
},
{
"mvn-path": "org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-VXFjmKl48QID+eJciu/AWA2vfwkHxu0K6tgexftrf9g="
},
{
"mvn-path": "org/apache/httpcomponents/httpmime/4.5.13/httpmime-4.5.13.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-BudU2ZJFuY3MKGDctD0g5zfWUNor8gd6EF9orMvVxcw="
},
{
"mvn-path": "org/apache/httpcomponents/httpmime/4.5.13/httpmime-4.5.13.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-k0GN8hCu7VBQJUjbzysXwPHZFEMDDnL+++7RZSscKN0="
},
{
"mvn-path": "org/apache/httpcomponents/project/7/project-7.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-PW66QoVVpVjeBGtddurMH1pUtPXyC4TWNu16/xiqSMM="
},
{
"mvn-path": "org/clojure/clojure/1.10.3/clojure-1.10.3.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-fxJHLa7Y9rUXSYqqKrE6ViR1w+31FHjkWBzHYemJeaM="
},
{
"mvn-path": "org/clojure/clojure/1.10.3/clojure-1.10.3.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-GJwAxDNAdJai+7DsyzeQjJSVXZHq0b5IFWdE7MGBbZQ="
},
{
"mvn-path": "org/clojure/clojure/1.11.0/clojure-1.11.0.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-PiH6daB+yd278bK1A1bPGAcQ0DmN6qT0TpHNYwRVWUc="
},
{
"mvn-path": "org/clojure/clojure/1.11.0/clojure-1.11.0.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-SQjMS0yeYsmoFJb5PLWsb2lBd8xkXc87jOXkkavOHro="
},
{
"mvn-path": "org/clojure/clojure/1.11.1/clojure-1.11.1.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-I4G26UI6tGUVFFWUSQPROlYkPWAGuRlK/Bv0+HEMtN4="
},
{
"mvn-path": "org/clojure/clojure/1.11.1/clojure-1.11.1.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-IMRaGr7b2L4grvk2BQrjGgjBZ0CzL4dAuIOM3pb/y4o="
},
{
"mvn-path": "org/clojure/core.async/1.5.648/core.async-1.5.648.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-Tbqwb7/HyUrn4vZoNBpl8nF19tCuigELisqwOdnNMyw="
},
{
"mvn-path": "org/clojure/core.async/1.5.648/core.async-1.5.648.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-kxoMFZ+/PdzwK2321gPQVcTbfGgWXcbOt4KHEzq4Iaw="
},
{
"mvn-path": "org/clojure/core.cache/1.0.225/core.cache-1.0.225.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-wVOqlH7aXNvYqTiCyPur1QN9StcxGAK0vNgBVGn2pbE="
},
{
"mvn-path": "org/clojure/core.cache/1.0.225/core.cache-1.0.225.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-OeNB9nv+85PkeDkNSYjxGad5ykSQZssNM/gLQv8E9D0="
},
{
"mvn-path": "org/clojure/core.memoize/1.0.253/core.memoize-1.0.253.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-SpEFhRgqsybB0KINNDFb4VY7WlhDfUHAId1/6ZEeHtY="
},
{
"mvn-path": "org/clojure/core.memoize/1.0.253/core.memoize-1.0.253.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-hML6t6Mso8HkDEGm7Mm9U26UezBYDne41dwjKjSSXqw="
},
{
"mvn-path": "org/clojure/core.specs.alpha/0.2.56/core.specs.alpha-0.2.56.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-/PRCveArBKhj8vzFjuaiowxM8Mlw99q4VjTwq3ERZrY="
},
{
"mvn-path": "org/clojure/core.specs.alpha/0.2.56/core.specs.alpha-0.2.56.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-AarxdIP/HHSCySoHKV1+e8bjszIt9EsptXONAg/wB0A="
},
{
"mvn-path": "org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-Bu6owHC75FwVhWfkQ0OWgbyMRukSNBT4G/oyukLWy8g="
},
{
"mvn-path": "org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-F3i70Ti9GFkLgFS+nZGdG+toCfhbduXGKFtn1Ad9MA4="
},
{
"mvn-path": "org/clojure/data.json/2.4.0/data.json-2.4.0.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-7D8vmU4e7dQgMTxFK6VRjF9cl75RUt/tVlC8ZhFIat8="
},
{
"mvn-path": "org/clojure/data.json/2.4.0/data.json-2.4.0.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-pC6nDxe1F2Zq2EkqG/qRfeXe+se0fFFvbQ1NicJ4DPQ="
},
{
"mvn-path": "org/clojure/data.priority-map/1.1.0/data.priority-map-1.1.0.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-/lGvRHL6Dxv9ZvOHHeVQdkAv9mFadLyxezfEAqDqb0w="
},
{
"mvn-path": "org/clojure/data.priority-map/1.1.0/data.priority-map-1.1.0.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-RlIA+U9W2IaOD9eqC+zGL/sCz69CCkmtEXkQ5jr13/4="
},
{
"mvn-path": "org/clojure/java.classpath/1.0.0/java.classpath-1.0.0.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-wU4OEDBKXlz9LMdC+976wfUpPuxgcML/6JA/tcf+fW8="
},
{
"mvn-path": "org/clojure/java.classpath/1.0.0/java.classpath-1.0.0.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-C+AThRRX/CTENM5FU0ZD8iblwQgASGJT/Tc/LglUXig="
},
{
"mvn-path": "org/clojure/pom.contrib/0.2.2/pom.contrib-0.2.2.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-4OoifEnFw+MHVM0m/MV75+Telz/kOqXMZmdAHsXBAyM="
},
{
"mvn-path": "org/clojure/pom.contrib/0.3.0/pom.contrib-0.3.0.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-fxgrOypUPgV0YL+T/8XpzvasUn3xoTdqfZki6+ee8Rk="
},
{
"mvn-path": "org/clojure/pom.contrib/1.0.0/pom.contrib-1.0.0.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-EBH6rlyeSWhY5MZQujNxOr1Gml1S4Arrf1sBoryvR+k="
},
{
"mvn-path": "org/clojure/pom.contrib/1.1.0/pom.contrib-1.1.0.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-EOzku1+YKQENwWVh9C67g7ry9HYFtR+RBbkvPKoIlxU="
},
{
"mvn-path": "org/clojure/spec.alpha/0.2.194/spec.alpha-0.2.194.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-z2iZ+YUpjGSxPqEplGrZAo3uja3w6rmuGORVAn04JJw="
},
{
"mvn-path": "org/clojure/spec.alpha/0.2.194/spec.alpha-0.2.194.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-WhHw4eizwFLmUcSYxpRbRNs1Nb8sGHGf3PZd8fiLE+Y="
},
{
"mvn-path": "org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-Z+yJjrVcZqlXpVJ53YXRN2u5lL2HZosrDeHrO5foquA="
},
{
"mvn-path": "org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-bY3hTDrIdXYMX/kJVi/5hzB3AxxquTnxyxOeFp/pB1g="
},
{
"mvn-path": "org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-kQz/AjiTHtiIYstmWmd+ldk+hIDyIzIAiG0zHX7QDl4="
},
{
"mvn-path": "org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-EOGi60Q6PFfsGd7e8ylC63SbrmnyFZiI/lYLpnuwj0c="
},
{
"mvn-path": "org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-E2i2vDvd98OY1XhNEFSPRMTtLXwB6hBawO/enPXg3yE="
},
{
"mvn-path": "org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-NyBxL7knYaNclNDuQV1r8VhB70afBzZGd2h1553JtwY="
},
{
"mvn-path": "org/clojure/tools.cli/1.0.206/tools.cli-1.0.206.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-a5fSaRkZueqUSomP7HmKkOy4GhdzKRbtvHOm9a/R9hY="
},
{
"mvn-path": "org/clojure/tools.cli/1.0.206/tools.cli-1.0.206.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-/QDNC4q1yffBaViwVlAtuvcqR6TLiG6AArWw27s49J4="
},
{
"mvn-path": "org/clojure/tools.namespace/1.3.0/tools.namespace-1.3.0.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-EnUzqx4eenAMgjitfVjUtCxBjW2PNMMEcRUDvIguOnA="
},
{
"mvn-path": "org/clojure/tools.namespace/1.3.0/tools.namespace-1.3.0.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-e5Sl5sIS2bDFQhGM6SYm5ujcPu1SZ07kYuON1lWTuZQ="
},
{
"mvn-path": "org/clojure/tools.reader/1.3.6/tools.reader-1.3.6.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-EdGzHyxlwzVbKSu5tEuPyv2lS0TaY+NKuXt5qKs7uOA="
},
{
"mvn-path": "org/clojure/tools.reader/1.3.6/tools.reader-1.3.6.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-rvXugot8sUocWPRbn4oQ/zQMV2mSXqDvXDXR5J2SC+o="
},
{
"mvn-path": "org/eclipse/paho/java-parent/1.2.5/java-parent-1.2.5.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-dam4wXrhuGfLMubkVU1XS0f7nr3h6wGwP1fPfzDVAuM="
},
{
"mvn-path": "org/eclipse/paho/org.eclipse.paho.client.mqttv3/1.2.5/org.eclipse.paho.client.mqttv3-1.2.5.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-WZFCh62sUGoo1egXLu0mKiJgXz301Ca52S9B2uJEgYU="
},
{
"mvn-path": "org/eclipse/paho/org.eclipse.paho.client.mqttv3/1.2.5/org.eclipse.paho.client.mqttv3-1.2.5.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-a5Vo3szHkbzJX0gGuj84g9qTbMlAnky9tJaWBtsKA5A="
},
{
"mvn-path": "org/ow2/asm/asm/9.2/asm-9.2.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-udT+TXGTjfOIOfDspCqqpkz4sxPWeNoDbwyzyhmbR/U="
},
{
"mvn-path": "org/ow2/asm/asm/9.2/asm-9.2.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-37EqGyJL8Bvh/WBAIEZviUJBvLZF3M45Xt2M1vilDfQ="
},
{
"mvn-path": "org/ow2/ow2/1.5/ow2-1.5.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-D4obEW52C4/mOJxRuE5LB6cPwRCC1Pk25FO1g91QtDs="
},
{
"mvn-path": "potemkin/potemkin/0.4.5/potemkin-0.4.5.jar",
"mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-KzZsg02Hy26mMbpoaXvDdNDRr4H23rQsKECUTaMgvZk="
},
{
"mvn-path": "potemkin/potemkin/0.4.5/potemkin-0.4.5.pom",
"mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-3tL5YlDzDlqPmI60YeMvKzDzbBy0Qz+6qHu82kJRTDo="
},
{
"mvn-path": "riddley/riddley/0.1.12/riddley-0.1.12.jar",
"mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-OY9h+kgluPhskWrlgMfhM7fEd9C3Kn07KY04EDJ0C64="
},
{
"mvn-path": "riddley/riddley/0.1.12/riddley-0.1.12.pom",
"mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-At+3ryDvgcJTZQVfYCjoscwpBdCyaLuJzEKM2nIwo2U="
},
{
"mvn-path": "slingshot/slingshot/0.12.2/slingshot-0.12.2.jar",
"mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-porCK/LqPNVM4023D9aYRNYx71SfZFDCeMMOb3nfY/M="
},
{
"mvn-path": "slingshot/slingshot/0.12.2/slingshot-0.12.2.pom",
"mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-SrxOK5ppxzvTc+gy0/AOWQZ4Q/+DUe/V7rsfOCTbnFE="
}
]
}

31
deps.edn Normal file
View File

@ -0,0 +1,31 @@
{
:paths ["src"]
:deps {
org.clojure/clojure { :mvn/version "1.11.1" }
org.clojure/core.async { :mvn/version "1.5.648" }
org.clojure/tools.cli { :mvn/version "1.0.206" }
org.fudo/fudo-clojure {
:git/url "https://git.fudo.org/fudo-public/fudo-clojure.git"
:sha "c6a1ebef2e5b64d432a46ac48639c674e62b7cee"
}
org.eclipse.paho/org.eclipse.paho.client.mqttv3 { :mvn/version "1.2.5" }
camel-snake-kebab/camel-snake-kebab { :mvn/version "0.4.2" }
}
:aliases {
:test {
:extra-paths ["test"]
:extra-deps {
io.github.cognitect-labs/test-runner
{
:git/url "https://github.com/cognitect-labs/test-runner.git"
:sha "dfb30dd6605cb6c0efc275e1df1736f6e90d4d73"
}
}
:main-opts ["-m" "cognitect.test-runner"]
:exec-fn cognitect.test-runner.api/test
}
:build { :default-ns build }
}
}

117
flake.lock Normal file
View File

@ -0,0 +1,117 @@
{
"nodes": {
"clj-nix": {
"inputs": {
"devshell": "devshell",
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1655801580,
"narHash": "sha256-4XUFDP1ES1KNWwDukQEixCe4uV7Z951kgaVAFhXI2ew=",
"owner": "jlesquembre",
"repo": "clj-nix",
"rev": "579141e009200fcd28d251731e9ac5ba46a1ec2a",
"type": "github"
},
"original": {
"owner": "jlesquembre",
"repo": "clj-nix",
"type": "github"
}
},
"devshell": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"clj-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1644227066,
"narHash": "sha256-FHcFZtpZEWnUh62xlyY3jfXAXHzJNEDLDzLsJxn+ve0=",
"owner": "numtide",
"repo": "devshell",
"rev": "7033f64dd9ef8d9d8644c5030c73913351d2b660",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1642700792,
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1656265786,
"narHash": "sha256-A9RkoGrxzsmMm0vily18p92Rasb+MbdDMaSnzmywXKw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "cd90e773eae83ba7733d2377b6cdf84d45558780",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-22.05",
"type": "indirect"
}
},
"root": {
"inputs": {
"clj-nix": "clj-nix",
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"utils": {
"locked": {
"lastModified": 1656065134,
"narHash": "sha256-oc6E6ByIw3oJaIyc67maaFcnjYOz1mMcOtHxbEf9NwQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "bee6a7250dd1b01844a2de7e02e4df7d8a0a206c",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

36
flake.nix Normal file
View File

@ -0,0 +1,36 @@
{
description = "WallFly presence monitor..";
inputs = {
nixpkgs.url = "nixpkgs/nixos-22.05";
utils.url = "github:numtide/flake-utils";
clj-nix = {
url = "github:jlesquembre/clj-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, utils, clj-nix, ... }:
utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}";
cljpkgs = clj-nix.packages."${system}";
update-deps = pkgs.writeShellScriptBin "update-deps.sh" ''
${clj-nix.packages."${system}".deps-lock}/bin/deps-lock
'';
in {
packages = {
wallfly = cljpkgs.mkCljBin {
projectSrc = ./.;
name = "org.fudo/wallfly";
main-ns = "wallfly.core";
jdkRunner = pkgs.jdk17_headless;
};
};
defaultPackage = self.packages."${system}".wallfly;
devShell =
pkgs.mkShell { buildInputs = with pkgs; [ clojure update-deps ]; };
});
}

152
src/wallfly/core.clj Normal file
View File

@ -0,0 +1,152 @@
(ns wallfly.core
(:require [clojure.java.shell :as shell]
[clojure.core.async :refer [chan >!! <!! >! <! go-loop mult tap timeout alt!]]
[clojure.string :as str :refer [trim-newline]]
[clojure.data.json :as json]
[clojure.tools.cli :refer [parse-opts]]
[clojure.pprint :refer [pprint]]
[fudo-clojure.result :refer [success failure unwrap map-success success? error-message]]
[camel-snake-kebab.core :refer [->SCREAMING_SNAKE_CASE]])
(:import [org.eclipse.paho.client.mqttv3
MqttClient
MqttConnectOptions
MqttMessage]
org.eclipse.paho.client.mqttv3.persist.MemoryPersistence))
(defn- create-mqtt-client [broker-uri client-id mqtt-username passwd]
(let [opts (doto (MqttConnectOptions.)
(.setCleanSession true)
(.setAutomaticReconnect true)
(.setPassword (char-array passwd))
(.setUserName mqtt-username))]
(doto (MqttClient. broker-uri client-id (MemoryPersistence.))
(.connect opts))))
(defn- make-tap [c]
(let [out (chan)]
(tap c out)
out))
(defn- shell-exec [& args]
(let [{:keys [exit out err]} (apply shell/sh args)]
(if (= exit 0)
(success (trim-newline out))
(failure err { :error err :status-code exit }))))
(defn- get-idle-time []
(map-success (shell-exec "xprintidle")
(fn [idle-str] (quot (Integer/parseInt idle-str) 1000))))
(defn- get-hostname [] (unwrap (shell-exec "hostname")))
(defn- get-fqdn [] (unwrap (shell-exec "hostname" "-f")))
(defn- get-username [] (System/getenv "USER"))
(defn- create-message [msg retained]
(doto (MqttMessage. (.getBytes msg))
(.setQos 1)
(.setRetained retained)))
(defn- send-message [client topic msg & {:keys [retained] :or {retained false}}]
(.publish client topic (create-message msg retained)))
;; Given a channel, listen for idle timestamps and send messages accordingly
(defn- create-reporter [client time-to-idle location user host host-device]
(let [base-topic (format "homeassistant/binary_sensor/wallfly_%s_%s"
user host)
presence-topic (format "%s/state" base-topic)
emit-presence (fn [present] (send-message client presence-topic (if present "ON" "OFF")))]
(let [cfg-topic (format "%s/config" base-topic)
payload {:name (format "%s present" user)
:device_class :occupancy
:entity_category :diagnostic
:unique_id (format "wallfly_%s_%s" user host)
:state_topic presence-topic
:icon "mdi:account-check"
:device {:identifiers [host-device]
:name (format "%s WallFly" host)
:model "WallFly"
:manufacturer "Fudo"
:suggested_area location}}]
(println (format "sending to %s: %s" cfg-topic (with-out-str (pprint payload))))
(send-message client cfg-topic (json/write-str payload) :retained true))
(fn [idle-time]
;; (emit-idle idle-time)
(emit-presence (< idle-time time-to-idle)))))
(defn- execute! [delay-seconds report]
(let [stop-chan (chan)
delay-time (* 1000 delay-seconds)]
(go-loop [idle-measure (get-idle-time)]
(if (nil? idle-measure)
nil
(do (if (success? idle-measure)
(report (unwrap idle-measure))
(println (str "error reading idle time: " (error-message idle-measure))))
(recur (alt! (timeout delay-time) (get-idle-time)
stop-chan nil)))))))
(def cli-opts
[["-l" "--location LOCATION" "Location (in house) of the host running this job."]
["-b" "--mqtt-broker-uri URI" "URI of the MQTT broker."]
["-u" "--mqtt-username USERNAME" "Username to use when connecting to MQTT."]
["-c" "--client-id CLIENT-ID" "Client ID of this job."]
["-p" "--password-file PASSWORD-FILE" "Path to a file containing the password for this client."]
["-t" "--idle-time SECONDS" "Number of seconds before considering this host idle."]
["-d" "--delay-time SECONDS" "Time to wait before polling for idle time."]])
(defn- exit! [status msg]
(println msg)
(System/exit status))
(defn- get-key [opts k]
(if-let [opt (get opts k)]
[k opt]
[k (System/getenv (format "WALLFLY_%s"
(-> k name ->SCREAMING_SNAKE_CASE)))]))
(defn- get-args [keys args]
(let [{:keys [options errors summary]} (parse-opts args cli-opts)]
(when (:help options) (exit! 0 summary))
(when (seq errors) (exit! 1 (str/join \newline errors)))
(let [resolved (into {} (map (partial get-key options) keys))
missing (filter (fn [k] (not (get resolved k false))) keys)]
(if (seq missing)
(exit! 2 ((str "missing arguments: " (str/join " " (map name missing)))))
resolved))))
(let [chars (map char (apply concat (map (fn [[s e]] (range (int s) (int e))) [[\0 \9] [\a \z] [\A \Z]])))]
(defn- rand-str [n]
(apply str (take n (repeatedly #(nth chars (rand (count chars))))))))
(defn -main [args]
(let [required-keys [:location
:mqtt-broker-uri
:client-id
:password-file
:time-to-idle
:hostname
:delay-time
:mqtt-username]
{:keys [location
mqtt-broker-uri
password-file
time-to-idle
delay-time
mqtt-username]} (get-args required-keys args)
catch-shutdown (chan)
password (-> password-file (slurp) (str/trim-newline))
username (get-username)
hostname (get-hostname)
host-device (format "wallfly-%s" (get-fqdn))
client-id (format "wallfly-%s" (rand-str 10))
client (create-mqtt-client mqtt-broker-uri client-id mqtt-username password)
reporter (create-reporter client time-to-idle location username hostname host-device)
stop-chan (execute! delay-time reporter)]
(.addShutdownHook (Runtime/getRuntime)
(Thread. (fn [] (>!! catch-shutdown true))))
(<!! catch-shutdown)
(>!! stop-chan true)
(System/exit 0)))