├── opennlp
└── sentence-detection
│ ├── models
│ └── .keep
│ ├── .gitignore
│ ├── test
│ └── json
│ │ └── test
│ │ └── core.clj
│ ├── project.clj
│ ├── README
│ └── src
│ └── nlp
│ └── core.clj
├── cascalog
├── data
│ ├── foo.out
│ ├── state-abbreviation.json
│ ├── capital-abbreviation.csv
│ └── state-abbreviation.csv
├── doc
│ └── intro.md
├── .gitignore
├── test
│ └── casca
│ │ └── core_test.clj
├── project.clj
├── src
│ └── cascalog_examples
│ │ ├── read_file.clj
│ │ └── us_state_queries.clj
└── README
├── README.md
├── apache-lucene
├── search
│ ├── .lein-deps-sum
│ ├── test
│ │ └── lucene
│ │ │ └── test
│ │ │ └── core.clj
│ ├── README
│ ├── project.clj
│ └── src
│ │ └── lucene
│ │ └── core.clj
├── tokenize
│ ├── .lein-deps-sum
│ ├── test
│ │ └── lucene
│ │ │ └── test
│ │ │ └── core.clj
│ ├── project.clj
│ ├── README
│ └── src
│ │ └── lucene
│ │ └── core.clj
└── .gitignore
├── apache-spark
├── README.md
└── flambo-gaming-stack-exchange
│ ├── doc
│ └── intro.md
│ ├── .gitignore
│ ├── test
│ └── flambo_gaming_stack_exchange
│ │ └── core_test.clj
│ ├── project.clj
│ ├── README.md
│ ├── src
│ └── flambo_gaming_stack_exchange
│ │ ├── etl_users.clj
│ │ ├── etl_posts.clj
│ │ └── core.clj
│ └── LICENSE
├── weka
├── README.md
├── k-means
│ ├── doc
│ │ └── intro.md
│ ├── .gitignore
│ ├── README.md
│ ├── project.clj
│ └── src
│ │ └── k_means
│ │ └── core.clj
├── filter-and-rename-columns-in-dataset
│ ├── README.md
│ ├── doc
│ │ └── intro.md
│ ├── .gitignore
│ ├── project.clj
│ └── src
│ │ └── filter_and_rename_columns_in_dataset
│ │ └── core.clj
└── data
│ └── iris.arff
├── image-thumbnail
├── thumbnail.jpg
├── Hot_Dog_Dog.jpg
├── .gitignore
├── test
│ └── image_thumbnail
│ │ └── test
│ │ └── core.clj
├── project.clj
├── src
│ └── image_thumbnail
│ │ └── core.clj
└── README
├── cheshire
├── .gitignore
├── test
│ └── json
│ │ └── test
│ │ └── core.clj
├── project.clj
├── README
└── src
│ └── json
│ └── core.clj
├── clj-diff
├── .gitignore
├── test
│ └── json
│ │ └── test
│ │ └── core.clj
├── project.clj
├── README
└── src
│ └── diff
│ └── core.clj
├── clj-time
├── .gitignore
├── test
│ └── json
│ │ └── test
│ │ └── core.clj
├── project.clj
├── README
└── src
│ └── time
│ └── core.clj
├── incanter
├── graphs
│ ├── .lein-repl-history
│ ├── .gitignore
│ ├── iris-petal-scatter.png
│ ├── test
│ │ └── incanterexample
│ │ │ └── test
│ │ │ └── core.clj
│ ├── README
│ ├── project.clj
│ └── src
│ │ └── incanterexample
│ │ └── core.clj
├── working-with-datasets
│ ├── .gitignore
│ ├── test
│ │ └── incanterexample
│ │ │ └── test
│ │ │ └── core.clj
│ ├── README
│ ├── project.clj
│ └── src
│ │ └── incanterexample
│ │ └── core.clj
└── README.md
├── redis
├── docker-compose.yml
├── .gitignore
├── project.clj
├── src
│ └── redis
│ │ └── core.clj
├── README.md
└── LICENSE
├── spelling-corrector
├── .gitignore
├── project.clj
├── test
│ └── json
│ │ └── test
│ │ └── core.clj
├── README
└── src
│ └── spell
│ └── core.clj
├── twitter4j
├── twitter
│ ├── .gitignore
│ ├── test
│ │ └── twitter
│ │ │ └── test
│ │ │ └── core.clj
│ ├── README
│ ├── project.clj
│ └── src
│ │ └── twitter
│ │ └── core.clj
└── streaming-api
│ ├── .gitignore
│ ├── test
│ └── streaming_api
│ │ └── test
│ │ └── core.clj
│ ├── README
│ ├── project.clj
│ └── src
│ └── streaming_api
│ └── core.clj
├── apache-mahout
└── recommender
│ ├── .gitignore
│ ├── test
│ └── recommender
│ │ └── test
│ │ └── core.clj
│ ├── README
│ ├── resources
│ └── intro.csv
│ ├── project.clj
│ └── src
│ └── recommender
│ └── core.clj
├── string-utils
├── doc
│ └── intro.md
├── .gitignore
├── test
│ └── string_utils
│ │ └── core_test.clj
├── README.md
├── project.clj
├── src
│ └── string_utils
│ │ └── core.clj
└── LICENSE
├── websockets
└── webbit-example
│ ├── .gitignore
│ ├── test
│ └── webbit_example
│ │ └── test
│ │ └── core.clj
│ ├── project.clj
│ ├── README
│ ├── src
│ └── webbit_example
│ │ └── core.clj
│ └── index.html
├── apache-tika
└── language-detection
│ ├── .gitignore
│ ├── test
│ └── tika
│ │ └── test
│ │ └── core.clj
│ ├── project.clj
│ ├── README
│ └── src
│ └── tika
│ └── core.clj
├── core-async
├── doc
│ └── intro.md
├── .gitignore
├── test
│ └── core_async_examples
│ │ └── core_test.clj
├── project.clj
├── README.md
├── CHANGELOG.md
├── src
│ └── core_async_examples
│ │ ├── core.clj
│ │ └── backpressure.clj
└── LICENSE
├── apache-commons-exec
├── doc
│ └── intro.md
├── .gitignore
├── test
│ └── apache_commons_exec
│ │ └── core_test.clj
├── project.clj
├── CHANGELOG.md
├── README.md
└── src
│ └── apache_commons_exec
│ └── core.clj
├── compojure
├── .gitignore
├── test
│ └── web_compojure
│ │ └── test
│ │ └── core.clj
├── README
├── project.clj
└── src
│ └── web_compojure
│ └── core.clj
├── apache-kafka
└── hello-world-kafka
│ ├── .gitignore
│ ├── project.clj
│ ├── README.md
│ ├── src
│ └── hello_world_kafka
│ │ └── core.clj
│ └── LICENSE
├── jsoup
└── extract-links
│ ├── .gitignore
│ ├── test
│ └── json
│ │ └── test
│ │ └── core.clj
│ ├── README
│ ├── project.clj
│ └── src
│ └── nlp
│ └── core.clj
├── clerk
├── src
│ └── clerk
│ │ └── core.clj
├── .gitignore
├── test
│ └── clerk
│ │ └── core_test.clj
├── project.clj
├── dev
│ └── hello.clj
└── README.md
├── apache-commons-daemon
├── .gitignore
├── project.clj
├── README.md
├── src
│ └── apache_commons_daemon
│ │ └── core.clj
└── LICENSE
├── datomic
├── .gitignore
├── project.clj
├── README.md
└── src
│ └── datomic
│ └── core.clj
└── .gitignore
/opennlp/sentence-detection/models/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/cascalog/data/foo.out:
--------------------------------------------------------------------------------
1 | I am
2 | a foo
3 | bar
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Misc clojure examples
2 |
3 | Uses leiningen to build
4 |
--------------------------------------------------------------------------------
/apache-lucene/search/.lein-deps-sum:
--------------------------------------------------------------------------------
1 | d2d811cf203483a0941fb8e3391cac9a92aac80b
--------------------------------------------------------------------------------
/apache-lucene/tokenize/.lein-deps-sum:
--------------------------------------------------------------------------------
1 | 419dae85a983a2473f1e4f73ce80d78f5c544d9f
--------------------------------------------------------------------------------
/apache-spark/README.md:
--------------------------------------------------------------------------------
1 | # Spark
2 |
3 | Example of working with Apache Spark
4 |
--------------------------------------------------------------------------------
/weka/README.md:
--------------------------------------------------------------------------------
1 | Examples largely from http://www.packtpub.com/clojure-data-analysis-cookbook/book
2 |
--------------------------------------------------------------------------------
/image-thumbnail/thumbnail.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wtfleming/clojure-examples/HEAD/image-thumbnail/thumbnail.jpg
--------------------------------------------------------------------------------
/image-thumbnail/Hot_Dog_Dog.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wtfleming/clojure-examples/HEAD/image-thumbnail/Hot_Dog_Dog.jpg
--------------------------------------------------------------------------------
/cheshire/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 |
--------------------------------------------------------------------------------
/clj-diff/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 |
--------------------------------------------------------------------------------
/clj-time/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 |
--------------------------------------------------------------------------------
/incanter/graphs/.lein-repl-history:
--------------------------------------------------------------------------------
1 | (Math/log 0.5)
2 | (math/log 0.5)
3 | (math/log 4)
4 | (Math/log 4)
5 | (Math/log 10)
6 | exit
7 |
--------------------------------------------------------------------------------
/apache-lucene/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 |
--------------------------------------------------------------------------------
/image-thumbnail/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 |
--------------------------------------------------------------------------------
/incanter/graphs/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 |
--------------------------------------------------------------------------------
/incanter/graphs/iris-petal-scatter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wtfleming/clojure-examples/HEAD/incanter/graphs/iris-petal-scatter.png
--------------------------------------------------------------------------------
/redis/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.9"
2 | services:
3 | redis:
4 | image: "redis:alpine"
5 | ports:
6 | - "6379:6379"
7 |
--------------------------------------------------------------------------------
/spelling-corrector/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 |
--------------------------------------------------------------------------------
/twitter4j/twitter/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 |
--------------------------------------------------------------------------------
/apache-mahout/recommender/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 |
--------------------------------------------------------------------------------
/string-utils/doc/intro.md:
--------------------------------------------------------------------------------
1 | # Introduction to string-utils
2 |
3 | TODO: write [great documentation](http://jacobian.org/writing/what-to-write/)
4 |
--------------------------------------------------------------------------------
/twitter4j/streaming-api/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 |
--------------------------------------------------------------------------------
/websockets/webbit-example/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 |
--------------------------------------------------------------------------------
/apache-tika/language-detection/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 |
--------------------------------------------------------------------------------
/core-async/doc/intro.md:
--------------------------------------------------------------------------------
1 | # Introduction to core-async-examples
2 |
3 | TODO: write [great documentation](http://jacobian.org/writing/what-to-write/)
4 |
--------------------------------------------------------------------------------
/incanter/working-with-datasets/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 |
--------------------------------------------------------------------------------
/string-utils/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /classes
3 | /checkouts
4 | pom.xml
5 | pom.xml.asc
6 | *.jar
7 | *.class
8 | /.lein-*
9 | /.nrepl-port
10 |
--------------------------------------------------------------------------------
/cascalog/doc/intro.md:
--------------------------------------------------------------------------------
1 | # Introduction to casca
2 |
3 | TODO: write [great documentation](http://jacobian.org/writing/great-documentation/what-to-write/)
4 |
--------------------------------------------------------------------------------
/apache-commons-exec/doc/intro.md:
--------------------------------------------------------------------------------
1 | # Introduction to apache-commons-exec
2 |
3 | TODO: write [great documentation](http://jacobian.org/writing/what-to-write/)
4 |
--------------------------------------------------------------------------------
/weka/k-means/doc/intro.md:
--------------------------------------------------------------------------------
1 | # Introduction to k-means
2 |
3 | TODO: write [great documentation](http://jacobian.org/writing/great-documentation/what-to-write/)
4 |
--------------------------------------------------------------------------------
/compojure/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 | libpeerconnection.log
10 |
--------------------------------------------------------------------------------
/apache-kafka/hello-world-kafka/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /classes
3 | /checkouts
4 | pom.xml
5 | pom.xml.asc
6 | *.jar
7 | *.class
8 | /.lein-*
9 | /.nrepl-port
10 |
--------------------------------------------------------------------------------
/jsoup/extract-links/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 | /models/*.bin
10 |
--------------------------------------------------------------------------------
/opennlp/sentence-detection/.gitignore:
--------------------------------------------------------------------------------
1 | /pom.xml
2 | *jar
3 | /lib
4 | /classes
5 | /native
6 | /.lein-failures
7 | /checkouts
8 | /.lein-deps-sum
9 | /models/*.bin
10 |
--------------------------------------------------------------------------------
/incanter/README.md:
--------------------------------------------------------------------------------
1 | Examples of using https://github.com/incanter/incanter
2 |
3 | Incanter is a Clojure-based, R-like statistical computing and graphics environment for the JVM.
4 |
--------------------------------------------------------------------------------
/apache-spark/flambo-gaming-stack-exchange/doc/intro.md:
--------------------------------------------------------------------------------
1 | # Introduction to flambo-gaming-stack-exchange
2 |
3 | TODO: write [great documentation](http://jacobian.org/writing/what-to-write/)
4 |
--------------------------------------------------------------------------------
/clerk/src/clerk/core.clj:
--------------------------------------------------------------------------------
1 | (ns clerk.core
2 | (:require [nextjournal.clerk :as clerk]))
3 |
4 |
5 | (comment
6 | (clerk/serve! {:browse? true :watch-paths ["dev" "src"]})
7 |
8 | )
9 |
--------------------------------------------------------------------------------
/spelling-corrector/project.clj:
--------------------------------------------------------------------------------
1 | (defproject json "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [[org.clojure/clojure "1.5.1"]]
4 | :main spell.core)
5 |
--------------------------------------------------------------------------------
/cheshire/test/json/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns json.test.core
2 | (:use [json.core])
3 | (:use [clojure.test]))
4 |
5 | ;(deftest replace-me ;; FIXME: write
6 | ; (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/clj-diff/test/json/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns json.test.core
2 | (:use [json.core])
3 | (:use [clojure.test]))
4 |
5 | ;(deftest replace-me ;; FIXME: write
6 | ; (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/clj-time/test/json/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns json.test.core
2 | (:use [json.core])
3 | (:use [clojure.test]))
4 |
5 | ;(deftest replace-me ;; FIXME: write
6 | ; (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/redis/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /classes
3 | /checkouts
4 | profiles.clj
5 | pom.xml
6 | pom.xml.asc
7 | *.jar
8 | *.class
9 | /.lein-*
10 | /.nrepl-port
11 | /.prepl-port
12 | .hgignore
13 | .hg/
14 |
--------------------------------------------------------------------------------
/apache-commons-daemon/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /classes
3 | /checkouts
4 | pom.xml
5 | pom.xml.asc
6 | *.jar
7 | *.class
8 | /.lein-*
9 | /.nrepl-port
10 | .hgignore
11 | .hg/
12 | out.txt
13 | *.pid
14 |
--------------------------------------------------------------------------------
/cascalog/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /lib
3 | /classes
4 | /checkouts
5 | pom.xml
6 | pom.xml.asc
7 | *.jar
8 | *.class
9 | .lein-deps-sum
10 | .lein-failures
11 | .lein-plugins
12 | .lein-repl-history
13 |
--------------------------------------------------------------------------------
/core-async/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /classes
3 | /checkouts
4 | profiles.clj
5 | pom.xml
6 | pom.xml.asc
7 | *.jar
8 | *.class
9 | /.lein-*
10 | /.nrepl-port
11 | /.prepl-port
12 | .hgignore
13 | .hg/
14 |
--------------------------------------------------------------------------------
/datomic/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /classes
3 | /checkouts
4 | profiles.clj
5 | pom.xml
6 | pom.xml.asc
7 | *.jar
8 | *.class
9 | /.lein-*
10 | /.nrepl-port
11 | /.prepl-port
12 | .hgignore
13 | .hg/
14 |
--------------------------------------------------------------------------------
/apache-spark/flambo-gaming-stack-exchange/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /classes
3 | /checkouts
4 | pom.xml
5 | pom.xml.asc
6 | *.jar
7 | *.class
8 | /.lein-*
9 | /.nrepl-port
10 | .hgignore
11 | .hg/
12 | logs/
13 |
--------------------------------------------------------------------------------
/jsoup/extract-links/test/json/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns json.test.core
2 | (:use [json.core])
3 | (:use [clojure.test]))
4 |
5 | ;(deftest replace-me ;; FIXME: write
6 | ; (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/spelling-corrector/test/json/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns json.test.core
2 | (:use [json.core])
3 | (:use [clojure.test]))
4 |
5 | ;(deftest replace-me ;; FIXME: write
6 | ; (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/weka/k-means/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /lib
3 | /classes
4 | /checkouts
5 | pom.xml
6 | pom.xml.asc
7 | *.jar
8 | *.class
9 | .lein-deps-sum
10 | .lein-failures
11 | .lein-plugins
12 | .lein-repl-history
13 |
--------------------------------------------------------------------------------
/apache-commons-exec/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /classes
3 | /checkouts
4 | profiles.clj
5 | pom.xml
6 | pom.xml.asc
7 | *.jar
8 | *.class
9 | /.lein-*
10 | /.nrepl-port
11 | /.prepl-port
12 | .hgignore
13 | .hg/
14 |
--------------------------------------------------------------------------------
/apache-lucene/search/test/lucene/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns lucene.test.core
2 | (:use [lucene.core])
3 | (:use [clojure.test]))
4 |
5 | ;(deftest replace-me ;; FIXME: write
6 | ; (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/cascalog/test/casca/core_test.clj:
--------------------------------------------------------------------------------
1 | (ns casca.core-test
2 | (:require [clojure.test :refer :all]
3 | [casca.core :refer :all]))
4 |
5 | (deftest a-test
6 | (testing "FIXME, I fail."
7 | (is (= 0 1))))
8 |
--------------------------------------------------------------------------------
/cheshire/project.clj:
--------------------------------------------------------------------------------
1 | (defproject json "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [[org.clojure/clojure "1.10.3"]
4 | [cheshire "5.10.0"]]
5 | :main json.core)
6 |
--------------------------------------------------------------------------------
/clerk/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /classes
3 | /checkouts
4 | profiles.clj
5 | pom.xml
6 | pom.xml.asc
7 | *.jar
8 | *.class
9 | /.lein-*
10 | /.nrepl-port
11 | /.prepl-port
12 | .hgignore
13 | .hg/
14 |
15 | .cache
--------------------------------------------------------------------------------
/clerk/test/clerk/core_test.clj:
--------------------------------------------------------------------------------
1 | (ns clerk.core-test
2 | (:require [clojure.test :refer :all]
3 | [clerk.core :refer :all]))
4 |
5 | (deftest a-test
6 | (testing "FIXME, I fail."
7 | (is (= 0 1))))
8 |
--------------------------------------------------------------------------------
/clj-time/project.clj:
--------------------------------------------------------------------------------
1 | (defproject json "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [[org.clojure/clojure "1.10.3"]
4 | [clj-time "0.15.2"]]
5 | :main time.core)
6 |
--------------------------------------------------------------------------------
/opennlp/sentence-detection/test/json/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns json.test.core
2 | (:use [json.core])
3 | (:use [clojure.test]))
4 |
5 | ;(deftest replace-me ;; FIXME: write
6 | ; (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/twitter4j/twitter/test/twitter/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns twitter.test.core
2 | (:use [twitter.core])
3 | (:use [clojure.test]))
4 |
5 | ;(deftest replace-me ;; FIXME: write
6 | ; (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/weka/filter-and-rename-columns-in-dataset/README.md:
--------------------------------------------------------------------------------
1 | # filter-and-rename-columns-in-dataset
2 |
3 | Examples from
4 | http://www.packtpub.com/clojure-data-analysis-cookbook/book
5 |
6 | ## Usage
7 |
8 | $ lein run
9 |
--------------------------------------------------------------------------------
/weka/filter-and-rename-columns-in-dataset/doc/intro.md:
--------------------------------------------------------------------------------
1 | # Introduction to filter-and-rename-columns-in-dataset
2 |
3 | TODO: write [great documentation](http://jacobian.org/writing/great-documentation/what-to-write/)
4 |
--------------------------------------------------------------------------------
/apache-lucene/tokenize/test/lucene/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns lucene.test.core
2 | (:use [lucene.core])
3 | (:use [clojure.test]))
4 |
5 | ;(deftest replace-me ;; FIXME: write
6 | ; (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/apache-tika/language-detection/test/tika/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns tika.test.core
2 | (:use [tika.core])
3 | (:use [clojure.test]))
4 |
5 | (deftest replace-me ;; FIXME: write
6 | (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/clj-diff/project.clj:
--------------------------------------------------------------------------------
1 | (defproject json "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [[org.clojure/clojure "1.10.3"]
4 | [clj-diff "1.0.0-SNAPSHOT"]]
5 | :main diff.core)
6 |
--------------------------------------------------------------------------------
/compojure/test/web_compojure/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns web-compojure.test.core
2 | (:use [web-compojure.core])
3 | (:use [clojure.test]))
4 |
5 | ;(deftest replace-me ;; FIXME: write
6 | ; (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/incanter/graphs/test/incanterexample/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns incanterexample.test.core
2 | (:use [twitter.core])
3 | (:use [clojure.test]))
4 |
5 | ;(deftest replace-me ;; FIXME: write
6 | ; (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/jsoup/extract-links/README:
--------------------------------------------------------------------------------
1 | # jsoup examples
2 |
3 |
4 | ## Usage
5 |
6 | FIXME: write
7 |
8 | ## License
9 |
10 | Copyright (C) 2012 FIXME
11 |
12 | Distributed under the Eclipse Public License, the same as Clojure.
13 |
--------------------------------------------------------------------------------
/apache-mahout/recommender/test/recommender/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns recommender.test.core
2 | (:use [recommender.core])
3 | (:use [clojure.test]))
4 |
5 | ;(deftest replace-me ;; FIXME: write
6 | ; (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/image-thumbnail/test/image_thumbnail/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns image-thumbnail.test.core
2 | (:use [image-thumbnail.core])
3 | (:use [clojure.test]))
4 |
5 | (deftest replace-me ;; FIXME: write
6 | (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/weka/filter-and-rename-columns-in-dataset/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /lib
3 | /classes
4 | /checkouts
5 | pom.xml
6 | pom.xml.asc
7 | *.jar
8 | *.class
9 | .lein-deps-sum
10 | .lein-failures
11 | .lein-plugins
12 | .lein-repl-history
13 |
--------------------------------------------------------------------------------
/jsoup/extract-links/project.clj:
--------------------------------------------------------------------------------
1 | (defproject extract-links "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [[org.clojure/clojure "1.6.0"]
4 | [org.jsoup/jsoup "1.8.1"]]
5 | :main nlp.core)
6 |
--------------------------------------------------------------------------------
/string-utils/test/string_utils/core_test.clj:
--------------------------------------------------------------------------------
1 | (ns string-utils.core-test
2 | (:require [clojure.test :refer :all]
3 | [string-utils.core :refer :all]))
4 |
5 | (deftest a-test
6 | (testing "FIXME, I fail."
7 | (is (= 0 1))))
8 |
--------------------------------------------------------------------------------
/twitter4j/streaming-api/test/streaming_api/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns streaming-api.test.core
2 | (:use [streaming-api.core])
3 | (:use [clojure.test]))
4 |
5 | (deftest replace-me ;; FIXME: write
6 | (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/apache-tika/language-detection/project.clj:
--------------------------------------------------------------------------------
1 | (defproject tika "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [
4 | [org.clojure/clojure "1.6.0"]
5 | [org.apache.tika/tika-core "1.6"]]
6 | :main tika.core)
7 |
--------------------------------------------------------------------------------
/incanter/working-with-datasets/test/incanterexample/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns incanterexample.test.core
2 | (:use [twitter.core])
3 | (:use [clojure.test]))
4 |
5 | ;(deftest replace-me ;; FIXME: write
6 | ; (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/websockets/webbit-example/test/webbit_example/test/core.clj:
--------------------------------------------------------------------------------
1 | (ns webbit-example.test.core
2 | (:use [webbit-example.core])
3 | (:use [clojure.test]))
4 |
5 | (deftest replace-me ;; FIXME: write
6 | (is false "No tests have been written."))
7 |
--------------------------------------------------------------------------------
/apache-lucene/search/README:
--------------------------------------------------------------------------------
1 | # lucene
2 |
3 | FIXME: write description
4 |
5 | ## Usage
6 |
7 | FIXME: write
8 |
9 | ## License
10 |
11 | Copyright (C) 2012 FIXME
12 |
13 | Distributed under the Eclipse Public License, the same as Clojure.
14 |
--------------------------------------------------------------------------------
/apache-lucene/tokenize/project.clj:
--------------------------------------------------------------------------------
1 | (defproject lucene "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [
4 | [org.clojure/clojure "1.6.0"]
5 | [org.apache.lucene/lucene-core "3.6.0"]]
6 | :main lucene.core)
7 |
--------------------------------------------------------------------------------
/incanter/graphs/README:
--------------------------------------------------------------------------------
1 | # twitter
2 |
3 | FIXME: write description
4 |
5 | ## Usage
6 |
7 | FIXME: write
8 |
9 | ## License
10 |
11 | Copyright (C) 2012 FIXME
12 |
13 | Distributed under the Eclipse Public License, the same as Clojure.
14 |
--------------------------------------------------------------------------------
/twitter4j/twitter/README:
--------------------------------------------------------------------------------
1 | # twitter
2 |
3 | FIXME: write description
4 |
5 | ## Usage
6 |
7 | FIXME: write
8 |
9 | ## License
10 |
11 | Copyright (C) 2012 FIXME
12 |
13 | Distributed under the Eclipse Public License, the same as Clojure.
14 |
--------------------------------------------------------------------------------
/apache-lucene/tokenize/README:
--------------------------------------------------------------------------------
1 | # lucene
2 |
3 | FIXME: write description
4 |
5 | ## Usage
6 |
7 | FIXME: write
8 |
9 | ## License
10 |
11 | Copyright (C) 2012 FIXME
12 |
13 | Distributed under the Eclipse Public License, the same as Clojure.
14 |
--------------------------------------------------------------------------------
/apache-mahout/recommender/README:
--------------------------------------------------------------------------------
1 | # recommender
2 |
3 | FIXME: write description
4 |
5 | ## Usage
6 |
7 | FIXME: write
8 |
9 | ## License
10 |
11 | Copyright (C) 2012 FIXME
12 |
13 | Distributed under the Eclipse Public License, the same as Clojure.
14 |
--------------------------------------------------------------------------------
/apache-tika/language-detection/README:
--------------------------------------------------------------------------------
1 | # tika
2 |
3 | FIXME: write description
4 |
5 | ## Usage
6 |
7 | FIXME: write
8 |
9 | ## License
10 |
11 | Copyright (C) 2012 FIXME
12 |
13 | Distributed under the Eclipse Public License, the same as Clojure.
14 |
--------------------------------------------------------------------------------
/clj-time/README:
--------------------------------------------------------------------------------
1 | # clj-time
2 |
3 | Example of working with the clj-time library
4 |
5 |
6 | ## Usage
7 |
8 | lein run
9 |
10 | ## License
11 |
12 | Copyright (C) 2021
13 |
14 | Distributed under the Eclipse Public License, the same as Clojure.
15 |
--------------------------------------------------------------------------------
/core-async/test/core_async_examples/core_test.clj:
--------------------------------------------------------------------------------
1 | (ns core-async-examples.core-test
2 | (:require [clojure.test :refer :all]
3 | [core-async-examples.core :refer :all]))
4 |
5 | (deftest a-test
6 | (testing "FIXME, I fail."
7 | (is (= 0 1))))
8 |
--------------------------------------------------------------------------------
/image-thumbnail/project.clj:
--------------------------------------------------------------------------------
1 | (defproject image-thumbnail "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [
4 | [org.clojure/clojure "1.5.1"]
5 | [net.coobird/thumbnailator "0.4.2"]]
6 |
7 | :main image-thumbnail.core)
8 |
--------------------------------------------------------------------------------
/twitter4j/streaming-api/README:
--------------------------------------------------------------------------------
1 | # streaming-api
2 |
3 | FIXME: write description
4 |
5 | ## Usage
6 |
7 | FIXME: write
8 |
9 | ## License
10 |
11 | Copyright (C) 2012 FIXME
12 |
13 | Distributed under the Eclipse Public License, the same as Clojure.
14 |
--------------------------------------------------------------------------------
/cheshire/README:
--------------------------------------------------------------------------------
1 |
2 |
3 | Examples of using the Cheshire library to work with json.
4 |
5 | ## Usage
6 |
7 | FIXME: write
8 |
9 | ## License
10 |
11 | Copyright (C) 2012 FIXME
12 |
13 | Distributed under the Eclipse Public License, the same as Clojure.
14 |
--------------------------------------------------------------------------------
/incanter/working-with-datasets/README:
--------------------------------------------------------------------------------
1 | # twitter
2 |
3 | FIXME: write description
4 |
5 | ## Usage
6 |
7 | FIXME: write
8 |
9 | ## License
10 |
11 | Copyright (C) 2012 FIXME
12 |
13 | Distributed under the Eclipse Public License, the same as Clojure.
14 |
--------------------------------------------------------------------------------
/apache-commons-exec/test/apache_commons_exec/core_test.clj:
--------------------------------------------------------------------------------
1 | (ns apache-commons-exec.core-test
2 | (:require [clojure.test :refer :all]
3 | [apache-commons-exec.core :refer :all]))
4 |
5 | (deftest a-test
6 | (testing "FIXME, I fail."
7 | (is (= 0 1))))
8 |
--------------------------------------------------------------------------------
/opennlp/sentence-detection/project.clj:
--------------------------------------------------------------------------------
1 | (defproject sentence-detection "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [[org.clojure/clojure "1.10.3"]
4 | [org.apache.opennlp/opennlp-tools "1.9.3"]]
5 | :main nlp.core)
6 |
--------------------------------------------------------------------------------
/twitter4j/twitter/project.clj:
--------------------------------------------------------------------------------
1 | (defproject twitter "1.0.0-SNAPSHOT"
2 | :description "Examples of using twitter4j to call the twitter API"
3 | :dependencies [
4 | [org.clojure/clojure "1.6.0"]
5 | [org.twitter4j/twitter4j-core "4.0.2"]]
6 | :main twitter.core)
7 |
--------------------------------------------------------------------------------
/compojure/README:
--------------------------------------------------------------------------------
1 | # web-compojure
2 |
3 |
4 | ## Usage
5 | Run with either
6 | lein ring server
7 | lein ring server-headless
8 |
9 |
10 |
11 | ## License
12 |
13 | Copyright (C) 2021 FIXME
14 |
15 | Distributed under the Eclipse Public License, the same as Clojure.
16 |
--------------------------------------------------------------------------------
/weka/k-means/README.md:
--------------------------------------------------------------------------------
1 | # k-means
2 |
3 | A Clojure library designed to ... well, that part is up to you.
4 |
5 | ## Usage
6 |
7 | FIXME
8 |
9 | ## License
10 |
11 | Copyright © 2014 FIXME
12 |
13 | Distributed under the Eclipse Public License, the same as Clojure.
14 |
--------------------------------------------------------------------------------
/twitter4j/streaming-api/project.clj:
--------------------------------------------------------------------------------
1 | (defproject streaming-api "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [
4 | [org.clojure/clojure "1.5.1"]
5 | [org.twitter4j/twitter4j-core "2.2.5"]
6 | [org.twitter4j/twitter4j-stream "2.2.5"]]
7 | :main streaming-api.core)
8 |
--------------------------------------------------------------------------------
/incanter/graphs/project.clj:
--------------------------------------------------------------------------------
1 | (defproject incanterexample "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [
4 | [org.clojure/clojure "1.5.1"]
5 | [incanter "1.5.4"]
6 | [org.clojure/data.json "0.2.1"]
7 | [org.clojure/data.csv "0.1.2"]]
8 | :main incanterexample.core)
9 |
--------------------------------------------------------------------------------
/websockets/webbit-example/project.clj:
--------------------------------------------------------------------------------
1 | (defproject webbit-example "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [[org.clojure/clojure "1.5.1"]
4 | [org.webbitserver/webbit "0.4.15"]
5 | [cheshire "5.3.1"]]
6 | :main webbit-example.core)
7 |
8 |
9 |
--------------------------------------------------------------------------------
/apache-spark/flambo-gaming-stack-exchange/test/flambo_gaming_stack_exchange/core_test.clj:
--------------------------------------------------------------------------------
1 | (ns flambo-gaming-stack-exchange.core-test
2 | (:require [clojure.test :refer :all]
3 | [flambo-gaming-stack-exchange.core :refer :all]))
4 |
5 | (deftest a-test
6 | (testing "FIXME, I fail."
7 | (is (= 0 1))))
8 |
--------------------------------------------------------------------------------
/string-utils/README.md:
--------------------------------------------------------------------------------
1 | # string-utils
2 |
3 | A Clojure library designed to ... well, that part is up to you.
4 |
5 | ## Usage
6 |
7 | FIXME
8 |
9 | ## License
10 |
11 | Copyright © 2014 FIXME
12 |
13 | Distributed under the Eclipse Public License either version 1.0 or (at
14 | your option) any later version.
15 |
--------------------------------------------------------------------------------
/incanter/working-with-datasets/project.clj:
--------------------------------------------------------------------------------
1 | (defproject incanterexample "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [
4 | [org.clojure/clojure "1.5.1"]
5 | [incanter "1.5.4"]
6 | [org.clojure/data.json "0.2.1"]
7 | [org.clojure/data.csv "0.1.2"]]
8 | :main incanterexample.core)
9 |
--------------------------------------------------------------------------------
/apache-lucene/search/project.clj:
--------------------------------------------------------------------------------
1 | (defproject lucene "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [
4 | [org.clojure/clojure "1.6.0"]
5 | [org.apache.lucene/lucene-core "4.10.1"]
6 | [org.apache.lucene/lucene-queryparser "4.10.1"]
7 | [org.apache.lucene/lucene-analyzers-common "4.10.1"]]
8 | :main lucene.core)
9 |
--------------------------------------------------------------------------------
/apache-mahout/recommender/resources/intro.csv:
--------------------------------------------------------------------------------
1 | 1,101,5.0
2 | 1,102,3.0
3 | 1,103,2.5
4 |
5 | 2,101,2.0
6 | 2,102,2.5
7 | 2,103,5.0
8 | 2,104,2.0
9 |
10 | 3,101,2.5
11 | 3,104,4.0
12 | 3,105,4.5
13 | 3,107,5.0
14 |
15 | 4,101,5.0
16 | 4,103,3.0
17 | 4,104,4.5
18 | 4,106,4.0
19 |
20 | 5,101,4.0
21 | 5,102,3.0
22 | 5,103,2.0
23 | 5,104,4.0
24 | 5,105,3.5
25 | 5,106,4.0
--------------------------------------------------------------------------------
/apache-mahout/recommender/project.clj:
--------------------------------------------------------------------------------
1 | (defproject recommender "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [[org.clojure/clojure "1.5.1"]
4 | [org.apache.mahout/mahout-core "0.5"]
5 | [org.apache.mahout/mahout-math "0.5"]
6 | [org.apache.mahout/mahout-utils "0.5"]]
7 | :main recommender.core)
8 |
--------------------------------------------------------------------------------
/cascalog/data/state-abbreviation.json:
--------------------------------------------------------------------------------
1 | {"full":"Alabama","abbr":"AL"}
2 | {"full":"Alaska","abbr":"AK"}
3 | {"full":"Arizona","abbr":"AZ"}
4 | {"full":"Arkansas","abbr":"AR"}
5 | {"full":"California","abbr":"CA"}
6 | {"full":"Colorado","abbr":"CO"}
7 | {"full":"Connecticut","abbr":"CT"}
8 | {"full":"Delaware","abbr":"DE"}
9 | {"full":"District of Columbia","abbr":"DC"}
10 |
--------------------------------------------------------------------------------
/string-utils/project.clj:
--------------------------------------------------------------------------------
1 | (defproject string-utils "0.1.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :url "http://example.com/FIXME"
4 | :license {:name "Eclipse Public License"
5 | :url "http://www.eclipse.org/legal/epl-v10.html"}
6 | :dependencies [[org.clojure/clojure "1.10.3"]
7 | [inflections "0.13.2"]]
8 | :main string-utils.core)
9 |
--------------------------------------------------------------------------------
/weka/k-means/project.clj:
--------------------------------------------------------------------------------
1 | (defproject k-means "0.1.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :url "http://example.com/FIXME"
4 | :license {:name "Eclipse Public License"
5 | :url "http://www.eclipse.org/legal/epl-v10.html"}
6 | :dependencies [[org.clojure/clojure "1.6.0"]
7 | [nz.ac.waikato.cms.weka/weka-dev "3.7.12"]]
8 | :main k-means.core)
9 |
--------------------------------------------------------------------------------
/opennlp/sentence-detection/README:
--------------------------------------------------------------------------------
1 | # OpenNLP examples
2 |
3 | To run you will need to download the models English sentence detection model opennlp-en-ud-ewt-sentence-1.0-1.9.3.bin from http://opennlp.apache.org/models.html
4 |
5 |
6 | ## Usage
7 |
8 | lein run
9 |
10 | ## License
11 |
12 | Copyright (C) 2021 FIXME
13 |
14 | Distributed under the Eclipse Public License, the same as Clojure.
15 |
--------------------------------------------------------------------------------
/spelling-corrector/README:
--------------------------------------------------------------------------------
1 | # Spelling corrector
2 |
3 | Spelling corrector influenced by http://norvig.com/spell-correct.html
4 | Code adapted from http://www.packtpub.com/clojure-data-analysis-cookbook/book
5 |
6 | ## Usage
7 |
8 | $ lein run
9 | FIXME: write
10 |
11 | ## License
12 |
13 | Copyright (C) 2012 FIXME
14 |
15 | Distributed under the Eclipse Public License, the same as Clojure.
16 |
--------------------------------------------------------------------------------
/redis/project.clj:
--------------------------------------------------------------------------------
1 | (defproject redis "0.1.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :url "http://example.com/FIXME"
4 | :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
5 | :url "https://www.eclipse.org/legal/epl-2.0/"}
6 | :dependencies [[com.taoensso/carmine "3.1.0"]
7 | [org.clojure/clojure "1.10.3"]]
8 | :repl-options {:init-ns redis.core})
9 |
--------------------------------------------------------------------------------
/compojure/project.clj:
--------------------------------------------------------------------------------
1 | (defproject web-compojure "1.0.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :dependencies [[org.clojure/clojure "1.10.3"]
4 | [compojure "1.6.2"]
5 | [hiccup "1.0.5"]
6 | [cheshire "5.10.0"]]
7 | :dev-dependencies [[ring/ring-devel "1.9.3"]]
8 | :plugins [[lein-ring "0.12.5"]]
9 | :ring {:handler web-compojure.core/app})
10 |
--------------------------------------------------------------------------------
/jsoup/extract-links/src/nlp/core.clj:
--------------------------------------------------------------------------------
1 | (ns nlp.core
2 | (:import (java.io FileInputStream))
3 | (:import (org.jsoup Jsoup)))
4 |
5 | (defn -main []
6 | (with-open [input (FileInputStream. "en.wikipedia.org.html")]
7 | (let [doc (Jsoup/parse input "UTF-8" "http://en.wikipedia.org/wiki/Main_Page")
8 | links (.select doc "a[href]")]
9 | (doseq [link links]
10 | (println (.attr link "abs:href"))))))
11 |
--------------------------------------------------------------------------------
/clerk/project.clj:
--------------------------------------------------------------------------------
1 | (defproject clerk "0.1.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :url "http://example.com/FIXME"
4 | :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
5 | :url "https://www.eclipse.org/legal/epl-2.0/"}
6 | :dependencies [[org.clojure/clojure "1.10.3"]
7 | [io.github.nextjournal/clerk "0.4.316"]
8 | ]
9 | :repl-options {:init-ns clerk.core})
10 |
--------------------------------------------------------------------------------
/core-async/project.clj:
--------------------------------------------------------------------------------
1 | (defproject core-async-examples "0.1.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :url "http://example.com/FIXME"
4 | :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
5 | :url "https://www.eclipse.org/legal/epl-2.0/"}
6 | :dependencies [[org.clojure/clojure "1.10.3"]
7 | [org.clojure/core.async "1.3.618"]]
8 | :repl-options {:init-ns core-async-examples.core})
9 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
3 | .nrepl-port
4 |
5 | # logs
6 | derby.log
7 |
8 | # lein
9 | .lein-repl-history
10 |
11 |
12 | target/
13 | .classpath
14 | .project
15 | .settings
16 |
17 | */bin
18 |
19 |
20 | *.class
21 |
22 | *.swp
23 |
24 | # Emacs
25 | *~
26 | \#*\#
27 | /.emacs.desktop
28 | /.emacs.desktop.lock
29 | .elc
30 | auto-save-list
31 | tramp
32 | .\#*
33 |
34 | # Org-mode
35 | .org-id-locations
36 | *_archive
37 |
38 | .clj-kondo
39 | .lsp
--------------------------------------------------------------------------------
/apache-commons-daemon/project.clj:
--------------------------------------------------------------------------------
1 | (defproject apache-commons-daemon "0.1.0-SNAPSHOT"
2 | :description "Example of running a daemon"
3 | :license {:name "Eclipse Public License"
4 | :url "http://www.eclipse.org/legal/epl-v10.html"}
5 | :dependencies [[org.clojure/clojure "1.10.3"]
6 | [commons-daemon/commons-daemon "1.2.2"]
7 | [com.stuartsierra/component "1.0.0"]]
8 | :main apache-commons-daemon.core
9 | :aot :all)
10 |
--------------------------------------------------------------------------------
/apache-commons-exec/project.clj:
--------------------------------------------------------------------------------
1 | (defproject apache-commons-exec "0.1.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :url "http://example.com/FIXME"
4 | :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
5 | :url "https://www.eclipse.org/legal/epl-2.0/"}
6 | :dependencies [[org.clojure/clojure "1.10.3"]
7 | [org.clojars.hozumi/clj-commons-exec "1.2.0"]]
8 | :repl-options {:init-ns apache-commons-exec.core})
9 |
--------------------------------------------------------------------------------
/weka/filter-and-rename-columns-in-dataset/project.clj:
--------------------------------------------------------------------------------
1 | (defproject filter-and-rename-columns-in-dataset "0.1.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :url "http://example.com/FIXME"
4 | :license {:name "Eclipse Public License"
5 | :url "http://www.eclipse.org/legal/epl-v10.html"}
6 | :dependencies [[org.clojure/clojure "1.5.1"]
7 | [nz.ac.waikato.cms.weka/weka-dev "3.7.7"]]
8 | :main filter-and-rename-columns-in-dataset.core)
9 |
--------------------------------------------------------------------------------
/clj-diff/README:
--------------------------------------------------------------------------------
1 | # clj-diff
2 |
3 | Examples of working with clj-diff.
4 |
5 | Provides diff and patch functions for Clojure sequences where (diff a b) -> x and (patch a x) -> b. Also provides edit-distance and levenshtein-distance functions for calculating the difference between two sequences.
6 |
7 |
8 | ## Usage
9 |
10 | lein run
11 |
12 | ## License
13 |
14 | Copyright (C) 2021 Will Fleming
15 |
16 | Distributed under the Eclipse Public License, the same as Clojure.
17 |
--------------------------------------------------------------------------------
/websockets/webbit-example/README:
--------------------------------------------------------------------------------
1 | # webbit-example
2 |
3 | Websocket example. Sends a message to the server, and we return it uppercased
4 |
5 | Originally based on http://blog.jayfields.com/2011/02/clojure-web-socket-introduction.html
6 |
7 |
8 | ## Usage
9 |
10 | lein run
11 | Go to http://localhost:8080
12 | Enter some text in the form
13 |
14 |
15 | ## License
16 |
17 | Copyright (C) 2012 FIXME
18 |
19 | Distributed under the Eclipse Public License, the same as Clojure.
20 |
--------------------------------------------------------------------------------
/cascalog/project.clj:
--------------------------------------------------------------------------------
1 | (defproject cascalog-examples "0.1.0-SNAPSHOT"
2 | :description "Cascalog example queries"
3 | :license {:name "Eclipse Public License"
4 | :url "http://www.eclipse.org/legal/epl-v10.html"}
5 | :dependencies [[org.clojure/clojure "1.5.1"]
6 | [org.clojure/data.csv "0.1.2"]
7 | [cascalog "2.1.1"]
8 | [cheshire "5.4.0"]]
9 | :profiles { :dev {:dependencies [[org.apache.hadoop/hadoop-core "1.0.4"]]}})
10 |
--------------------------------------------------------------------------------
/image-thumbnail/src/image_thumbnail/core.clj:
--------------------------------------------------------------------------------
1 | (ns image-thumbnail.core
2 | (:gen-class)
3 | (import [net.coobird.thumbnailator Thumbnails]))
4 |
5 |
6 | (defn -main []
7 | (let [image (Thumbnails/fromFilenames (java.util.ArrayList. ["Hot_Dog_Dog.jpg"]))
8 |
9 | ; will create a thumbnail 160x160
10 | thumb (.forceSize image 160 160)
11 |
12 | ; will preserve aspect ratio and create thumb 160x144
13 | ;thumb (.size image 160 144)
14 | ]
15 | (.toFile thumb "thumbnail.jpg")))
16 |
17 |
--------------------------------------------------------------------------------
/image-thumbnail/README:
--------------------------------------------------------------------------------
1 | # image-thumbnail
2 |
3 | Example of using https://github.com/coobird/thumbnailator to create a thumbnail of an image.
4 |
5 | Image from http://commons.wikimedia.org/wiki/File:Hot_Dog_Dog.jpg
6 | "This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported, 2.5 Generic, 2.0 Generic and 1.0 Generic license."
7 |
8 |
9 | ## Usage
10 |
11 | lein run
12 |
13 | ## License
14 |
15 | Copyright (C) 2021 Will Fleming
16 |
17 | Distributed under the Eclipse Public License, the same as Clojure.
18 |
--------------------------------------------------------------------------------
/clerk/dev/hello.clj:
--------------------------------------------------------------------------------
1 | ;; Hello Clerk
2 | ;;
3 | ;; See https://www.youtube.com/watch?v=3ANS2NTNgig
4 | (ns hello
5 | (:require [clojure.string :as str]
6 | [nextjournal.clerk :as clerk]))
7 |
8 | (+ 1 2)
9 |
10 | (def letter->words
11 | (->> (slurp "/usr/share/dict/words")
12 | str/split-lines
13 | (group-by (comp keyword str/lower-case str first))
14 | (into (sorted-map))))
15 |
16 | (clerk/table letter->words)
17 |
18 | (clerk/plotly {:data [{:x (keys letter->words)
19 | :y (map count (vals letter->words))}]})
20 |
--------------------------------------------------------------------------------
/apache-kafka/hello-world-kafka/project.clj:
--------------------------------------------------------------------------------
1 | (defproject hello-world-kafka "0.1.0"
2 | :description "Create a kafka producer and high level consumer"
3 | :license {:name "Eclipse Public License"
4 | :url "http://www.eclipse.org/legal/epl-v10.html"}
5 | :dependencies [[org.clojure/clojure "1.6.0"]
6 | [org.apache.kafka/kafka_2.9.2 "0.8.1.1" :exclusions [javax.jms/jms
7 | com.sun.jdmk/jmxtools
8 | com.sun.jmx/jmxri]]]
9 | :aot [hello-world-kafka.core]
10 | :main hello-world-kafka.core)
11 |
--------------------------------------------------------------------------------
/datomic/project.clj:
--------------------------------------------------------------------------------
1 | (defproject datomic "0.1.0-SNAPSHOT"
2 | :description "Examples of working with Datomic"
3 | :repositories [["cognitect-dev-tools" {:url "https://dev-tools.cognitect.com/maven/releases/"
4 | :username :env
5 | :password :env}]]
6 | :url "http://example.com/FIXME"
7 | :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
8 | :url "https://www.eclipse.org/legal/epl-2.0/"}
9 | :dependencies [[com.datomic/dev-local "0.9.232"]
10 | [org.clojure/clojure "1.10.3"]]
11 | :repl-options {:init-ns datomic.core})
12 |
--------------------------------------------------------------------------------
/apache-spark/flambo-gaming-stack-exchange/project.clj:
--------------------------------------------------------------------------------
1 | (defproject flambo-gaming-stack-exchange "0.1.0-SNAPSHOT"
2 | :description "Example of using Spark and Flambo"
3 | :license {:name "Eclipse Public License"
4 | :url "http://www.eclipse.org/legal/epl-v10.html"}
5 | :profiles {:uberjar {:aot :all}
6 | :provided {:dependencies
7 | [[org.apache.spark/spark-core_2.10 "1.3.1"]]}}
8 | :dependencies [[org.clojure/clojure "1.7.0"]
9 | [yieldbot/flambo "0.6.0"]
10 | [commons-codec/commons-codec "1.10"]
11 | [org.clojure/data.xml "0.0.8"]
12 | [org.apache.spark/spark-sql_2.10 "1.3.1"]])
13 |
--------------------------------------------------------------------------------
/core-async/README.md:
--------------------------------------------------------------------------------
1 | # core-async-examples
2 |
3 | Examples of using core.async
4 |
5 | ## Usage
6 |
7 |
8 | FIXME
9 |
10 | ## License
11 |
12 | This program and the accompanying materials are made available under the
13 | terms of the Eclipse Public License 2.0 which is available at
14 | http://www.eclipse.org/legal/epl-2.0.
15 |
16 | This Source Code may also be made available under the following Secondary
17 | Licenses when the conditions for such availability set forth in the Eclipse
18 | Public License, v. 2.0 are satisfied: GNU General Public License as published by
19 | the Free Software Foundation, either version 2 of the License, or (at your
20 | option) any later version, with the GNU Classpath Exception which is available
21 | at https://www.gnu.org/software/classpath/license.html.
22 |
--------------------------------------------------------------------------------
/redis/src/redis/core.clj:
--------------------------------------------------------------------------------
1 | (ns redis.core
2 | (:require [taoensso.carmine :as car :refer (wcar)]))
3 |
4 | (def server-connection {:pool {:max-total 10}
5 | :spec {:host "localhost"
6 | :port 6379
7 | ;; :password "password"
8 | :timeout 4000}})
9 |
10 |
11 | (defn ping []
12 | (wcar server-connection (car/ping))) ;; => PONG
13 |
14 | ;; You can also use a macro to make calls a bit simpler
15 | (defmacro wcar* [& body] `(car/wcar server-connection ~@body))
16 |
17 | (defn ping-with-macro []
18 | (wcar* (car/ping))) ;; => PONG
19 |
20 |
21 | ;; Returns ["PONG" "OK" "bar"]
22 | (defn example-commands []
23 | (wcar*
24 | (car/ping)
25 | (car/set "foo" "bar")
26 | (car/get "foo")))
27 |
--------------------------------------------------------------------------------
/cascalog/src/cascalog_examples/read_file.clj:
--------------------------------------------------------------------------------
1 | (ns cascalog_examples.read_file
2 | (:use cascalog.api)
3 | (:require [clojure.data.csv :as csv]))
4 |
5 | (def state-abbreviation-path "data/state-abbreviation.csv")
6 |
7 |
8 | (defn print-file
9 | "Use cascalog to print a file"
10 | [path-to-file]
11 | (let [file-tap (lfs-textline path-to-file)]
12 | (?<-
13 | (stdout)
14 | [?line]
15 | (file-tap :> ?line))))
16 |
17 |
18 |
19 | (defn csv-parser [line]
20 | (map #(.trim %) (first (csv/read-csv line))))
21 |
22 | (defn print-csv-file
23 | "Use cascalog to print a csv file"
24 | [path-to-file]
25 | (let [file-tap (lfs-textline path-to-file)]
26 | (?<-
27 | (stdout)
28 | [?abbreviation ?state]
29 | (file-tap :> ?line)
30 | (csv-parser ?line :> ?state ?abbreviation))))
31 |
--------------------------------------------------------------------------------
/clerk/README.md:
--------------------------------------------------------------------------------
1 | # clerk
2 |
3 | A Clojure library designed to ... well, that part is up to you.
4 |
5 | ## Usage
6 |
7 | FIXME
8 |
9 | ## License
10 |
11 | Copyright © 2022 FIXME
12 |
13 | This program and the accompanying materials are made available under the
14 | terms of the Eclipse Public License 2.0 which is available at
15 | http://www.eclipse.org/legal/epl-2.0.
16 |
17 | This Source Code may also be made available under the following Secondary
18 | Licenses when the conditions for such availability set forth in the Eclipse
19 | Public License, v. 2.0 are satisfied: GNU General Public License as published by
20 | the Free Software Foundation, either version 2 of the License, or (at your
21 | option) any later version, with the GNU Classpath Exception which is available
22 | at https://www.gnu.org/software/classpath/license.html.
23 |
--------------------------------------------------------------------------------
/compojure/src/web_compojure/core.clj:
--------------------------------------------------------------------------------
1 | (ns web-compojure.core
2 | (:use [compojure.core]
3 | [hiccup.core])
4 | (:require [compojure.route :as route]
5 | [compojure.handler :as handler]
6 | [cheshire.core :as json]))
7 |
8 | (defn json-response [data & [status]]
9 | {:status (or status 200)
10 | :headers {"Content-Type" "application/json"}
11 | :body (json/generate-string data)})
12 |
13 |
14 | (defroutes main-routes
15 | (GET "/" [] "
Hello World Wide Web!
")
16 | (GET "/hola" [] (html [:h1 "Hola World"]))
17 | (GET "/hola/:id" [id]
18 | (str "Hi " id "
"))
19 | (GET "/hola.json" [] (json-response {:message "hello world wide web!"}))
20 |
21 | (route/resources "/")
22 | (route/not-found "Page not found"))
23 |
24 | (def app
25 | (handler/site main-routes))
26 |
--------------------------------------------------------------------------------
/cascalog/data/capital-abbreviation.csv:
--------------------------------------------------------------------------------
1 | Montgomery,AL
2 | Juneau,AK
3 | Phoenix,AZ
4 | Little Rock,AR
5 | Sacramento,CA
6 | Denver,CO
7 | Hartford,CT
8 | Dover,DE
9 | Tallahassee,FL
10 | Atlanta,GA
11 | Honolulu,HI
12 | Boise,ID
13 | Springfield,IL
14 | Indianapolis,IN
15 | Des Moines,IA
16 | Topeka,KS
17 | Frankfort,KY
18 | Baton Rouge,LA
19 | Augusta,ME
20 | Annapolis,MD
21 | Boston,MA
22 | Lansing,MI
23 | Saint Paul,MN
24 | Jackson,MS
25 | Jefferson City,MO
26 | Helena,MT
27 | Lincoln,NE
28 | Carson City,NV
29 | Concord,NH
30 | Trenton,NJ
31 | Santa Fe,NM
32 | Albany,NY
33 | Raleigh,NC
34 | Bismarck,ND
35 | Columbus,OH
36 | Oklahoma City,OK
37 | Salem,OR
38 | Harrisburg,PA
39 | Providence,RI
40 | Columbia,SC
41 | Pierre,SD
42 | Nashville,TN
43 | Austin,TX
44 | Salt Lake City,UT
45 | Montpelier,VT
46 | Richmond,VA
47 | Olympia,WA
48 | Charleston,WV
49 | Madison,WI
50 | Cheyenne,WY
51 |
--------------------------------------------------------------------------------
/cascalog/data/state-abbreviation.csv:
--------------------------------------------------------------------------------
1 | Alabama,AL
2 | Alaska,AK
3 | Arizona,AZ
4 | Arkansas,AR
5 | California,CA
6 | Colorado,CO
7 | Connecticut,CT
8 | Delaware,DE
9 | District of Columbia,DC
10 | Florida,FL
11 | Georgia,GA
12 | Hawaii,HI
13 | Idaho,ID
14 | Illinois,IL
15 | Indiana,IN
16 | Iowa,IA
17 | Kansas,KS
18 | Kentucky,KY
19 | Louisiana,LA
20 | Maine,ME
21 | Montana,MT
22 | Nebraska,NE
23 | Nevada,NV
24 | New Hampshire,NH
25 | New Jersey,NJ
26 | New Mexico,NM
27 | New York,NY
28 | North Carolina,NC
29 | North Dakota,ND
30 | Ohio,OH
31 | Oklahoma,OK
32 | Oregon,OR
33 | Maryland,MD
34 | Massachusetts,MA
35 | Michigan,MI
36 | Minnesota,MN
37 | Mississippi,MS
38 | Missouri,MO
39 | Pennsylvania,PA
40 | Rhode Island,RI
41 | South Carolina,SC
42 | South Dakota,SD
43 | Tennessee,TN
44 | Texas,TX
45 | Utah,UT
46 | Vermont,VT
47 | Virginia,VA
48 | Washington,WA
49 | West Virginia,WV
50 | Wisconsin,WI
51 | Wyoming,WY
52 |
--------------------------------------------------------------------------------
/core-async/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 | All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
3 |
4 | ## [Unreleased]
5 | ### Changed
6 | - Add a new arity to `make-widget-async` to provide a different widget shape.
7 |
8 | ## [0.1.1] - 2021-07-15
9 | ### Changed
10 | - Documentation on how to make the widgets.
11 |
12 | ### Removed
13 | - `make-widget-sync` - we're all async, all the time.
14 |
15 | ### Fixed
16 | - Fixed widget maker to keep working when daylight savings switches over.
17 |
18 | ## 0.1.0 - 2021-07-15
19 | ### Added
20 | - Files from the new template.
21 | - Widget maker public API - `make-widget-sync`.
22 |
23 | [Unreleased]: https://sourcehost.site/your-name/core-async-examples/compare/0.1.1...HEAD
24 | [0.1.1]: https://sourcehost.site/your-name/core-async-examples/compare/0.1.0...0.1.1
25 |
--------------------------------------------------------------------------------
/websockets/webbit-example/src/webbit_example/core.clj:
--------------------------------------------------------------------------------
1 | (ns webbit-example.core
2 | (:require [cheshire.core :as json]
3 | [clojure.string :as s])
4 | (:import [org.webbitserver WebServer WebServers WebSocketHandler]
5 | [org.webbitserver.handler StaticFileHandler]))
6 |
7 |
8 | (defn on-message [connection json-message]
9 | (let [m (json/parse-string json-message true)
10 | {{message :message} :data} m]
11 | (.send connection (json/generate-string
12 | {:type "upcased" :message (s/upper-case message)}))))
13 |
14 | (defn -main []
15 | (doto (WebServers/createWebServer 8080)
16 | (.add "/websocket"
17 | (proxy [WebSocketHandler] []
18 | (onOpen [c] (prn "opened" c))
19 | (onClose [c] (prn "closed" c))
20 | (onMessage [c j] (on-message c j))))
21 | (.add (StaticFileHandler. "."))
22 | (.start)))
23 |
24 |
--------------------------------------------------------------------------------
/apache-commons-exec/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 | All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
3 |
4 | ## [Unreleased]
5 | ### Changed
6 | - Add a new arity to `make-widget-async` to provide a different widget shape.
7 |
8 | ## [0.1.1] - 2021-07-16
9 | ### Changed
10 | - Documentation on how to make the widgets.
11 |
12 | ### Removed
13 | - `make-widget-sync` - we're all async, all the time.
14 |
15 | ### Fixed
16 | - Fixed widget maker to keep working when daylight savings switches over.
17 |
18 | ## 0.1.0 - 2021-07-16
19 | ### Added
20 | - Files from the new template.
21 | - Widget maker public API - `make-widget-sync`.
22 |
23 | [Unreleased]: https://sourcehost.site/your-name/apache-commons-exec/compare/0.1.1...HEAD
24 | [0.1.1]: https://sourcehost.site/your-name/apache-commons-exec/compare/0.1.0...0.1.1
25 |
--------------------------------------------------------------------------------
/redis/README.md:
--------------------------------------------------------------------------------
1 | # redis
2 |
3 | Examples of using the [Carmine](https://github.com/ptaoussanis/carmine) library to work with Redis.
4 |
5 | ## Usage
6 |
7 | Either install Redis locally or run it with Docker
8 |
9 | ```
10 | docker-compose up
11 | ```
12 |
13 |
14 |
15 |
16 | ## License
17 |
18 | This program and the accompanying materials are made available under the
19 | terms of the Eclipse Public License 2.0 which is available at
20 | http://www.eclipse.org/legal/epl-2.0.
21 |
22 | This Source Code may also be made available under the following Secondary
23 | Licenses when the conditions for such availability set forth in the Eclipse
24 | Public License, v. 2.0 are satisfied: GNU General Public License as published by
25 | the Free Software Foundation, either version 2 of the License, or (at your
26 | option) any later version, with the GNU Classpath Exception which is available
27 | at https://www.gnu.org/software/classpath/license.html.
28 |
--------------------------------------------------------------------------------
/websockets/webbit-example/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | WebSocket Demo
4 |
5 |
6 |
7 |
8 |
10 |
12 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/apache-commons-exec/README.md:
--------------------------------------------------------------------------------
1 | # apache-commons-exec
2 |
3 | Examples of executing system commands via the `clj-commons-exec` library wrapper around [Apache Commons Exec](http://commons.apache.org/proper/commons-exec/)
4 |
5 | ## Usage
6 |
7 | Start a REPL in src/core.clj and run some of the functions.
8 |
9 | ## License
10 |
11 | Copyright © 2021 Will Fleming
12 |
13 | This program and the accompanying materials are made available under the
14 | terms of the Eclipse Public License 2.0 which is available at
15 | http://www.eclipse.org/legal/epl-2.0.
16 |
17 | This Source Code may also be made available under the following Secondary
18 | Licenses when the conditions for such availability set forth in the Eclipse
19 | Public License, v. 2.0 are satisfied: GNU General Public License as published by
20 | the Free Software Foundation, either version 2 of the License, or (at your
21 | option) any later version, with the GNU Classpath Exception which is available
22 | at https://www.gnu.org/software/classpath/license.html.
23 |
--------------------------------------------------------------------------------
/apache-commons-exec/src/apache_commons_exec/core.clj:
--------------------------------------------------------------------------------
1 | (ns apache-commons-exec.core
2 | (:require [clj-commons-exec :as exec]))
3 |
4 | (defn print-date!
5 | "Runs the date command and prints results to stdout"
6 | []
7 | (let [result-promise (exec/sh ["date"])]
8 | (prn @result-promise))) ;; {:exit 0, :out "Fri Jul 16 18:38:53 EDT 2021\n", :err nil}
9 |
10 | (defn pipe-commands!
11 | "Pipes the result of a command to another, then prints results to stdout"
12 | []
13 | (let [results-promises-seq (exec/sh-pipe ["cat"] ["wc" "-w"] {:in "hello world"})]
14 | (doseq [result-promise results-promises-seq]
15 | (prn @result-promise))))
16 | ;; {:exit 0, :out nil, :err nil}
17 | ;; {:exit 0, :out " 2\n", :err nil}
18 |
19 | (defn environment-variables!
20 | "Demonstrates overriding env variables"
21 | []
22 | (prn @(exec/sh ["printenv" "HOME"])) ;; {:exit 0, :out "/Users/will\n", :err nil}
23 | (prn @(exec/sh ["printenv" "HOME"] {:env {"HOME" "/Users/rich"}}))) ;; {:exit 0, :out "/Users/rich\n", :err nil}
24 |
--------------------------------------------------------------------------------
/apache-spark/flambo-gaming-stack-exchange/README.md:
--------------------------------------------------------------------------------
1 | # flambo-gaming-stack-exchange
2 |
3 | Example of querying a Stack Exchange data dump with Apache Spark in Clojure with Flambo
4 |
5 | Assumes Spark 1.3.1 is installed in ~/bin/spark and the Gaming Stack Exchange Data Dump from https://archive.org/details/stackexchange has been downloaded to ~/data/gaming-stackexchange
6 |
7 |
8 | ## Usage
9 |
10 | $ lein uberjar
11 |
12 | ETL Users
13 | $ ~/bin/spark/bin/spark-submit --class flambo_gaming_stack_exchange.etl_users target/flambo-gaming-stack-exchange-0.1.0-SNAPSHOT-standalone.jar
14 |
15 | ETL Posts
16 | $ ~/bin/spark/bin/spark-submit --class flambo_gaming_stack_exchange.etl_posts target/flambo-gaming-stack-exchange-0.1.0-SNAPSHOT-standalone.jar
17 |
18 | Run queries
19 | $ ~/bin/spark/bin/spark-submit --class flambo_gaming_stack_exchange.core target/flambo-gaming-stack-exchange-0.1.0-SNAPSHOT-standalone.jar
20 |
21 | ## License
22 |
23 | Copyright © 2015 William Fleming
24 |
25 | Distributed under the Eclipse Public License either version 1.0 or (at
26 | your option) any later version.
27 |
--------------------------------------------------------------------------------
/apache-kafka/hello-world-kafka/README.md:
--------------------------------------------------------------------------------
1 | # hello-world-kafka
2 |
3 | Example of creating a Kafka producer and high level consumer in Clojure. The producer will periodically send a random number to a topic on Kafka.
4 |
5 | Assumes both Kafka 0.8.1.1 and ZooKeeper are running on localhost.
6 |
7 | ## Usage
8 |
9 | ```
10 | lein trampoline run
11 | ```
12 |
13 | Using a topic called random_numbers and 2 consumer threads.
14 |
15 | ```
16 | lein trampoline run random_numbers 2
17 | ```
18 |
19 | You should see output something like this
20 |
21 | ```
22 | Sending to Kafka topic random_numbers: 753
23 | Received on thread 1: 753
24 | Sending to Kafka topic random_numbers: 971
25 | Received on thread 1: 971
26 | Sending to Kafka topic random_numbers: 56
27 | Received on thread 1: 56
28 | Sending to Kafka topic random_numbers: 536
29 | Received on thread 1: 536
30 | Sending to Kafka topic random_numbers: 589
31 | Received on thread 1: 589
32 | ```
33 |
34 |
35 | ## License
36 |
37 | Copyright © 2014 FIXME
38 |
39 | Distributed under the Eclipse Public License either version 1.0 or (at
40 | your option) any later version.
41 |
--------------------------------------------------------------------------------
/apache-tika/language-detection/src/tika/core.clj:
--------------------------------------------------------------------------------
1 | (ns tika.core
2 | (:gen-class)
3 | (:import [org.apache.tika.language LanguageIdentifier]))
4 |
5 |
6 | (defn identify-language [content]
7 | (let [li (LanguageIdentifier. content)]
8 |
9 | (println "------------------------------")
10 | (println content)
11 | (print "Language: ")
12 | (println (.getLanguage li))
13 | (print "Is reasonably certain: ")
14 | (println (.isReasonablyCertain li))
15 | ))
16 |
17 |
18 | (defn -main []
19 |
20 | ; Not that many supported languages by tika
21 | (println (LanguageIdentifier/getSupportedLanguages))
22 |
23 |
24 | (identify-language "I am happy to join with you today in what will go down in history as the greatest demonstration for freedom in the history of our nation.")
25 |
26 | (identify-language "Ich freue mich, mit Ihnen gemeinsam heute in dem, was wird in die Geschichte eingehen als die größte Demonstration für Freiheit in der Geschichte unserer Nation.")
27 |
28 | (identify-language "Estoy orgulloso de reunirme con ustedes hoy en lo que va a pasar a la historia como la mayor manifestación por la libertad en la historia de nuestra nación."))
29 |
--------------------------------------------------------------------------------
/datomic/README.md:
--------------------------------------------------------------------------------
1 | # datomic
2 |
3 | Examples of working with Datomic
4 |
5 | ## Usage
6 |
7 | Download Datomic dev-local following the instructions here https://docs.datomic.com/cloud/dev-local.html
8 |
9 | You will get an email with credentials, you will need to make them available to lein like so:
10 |
11 | ```
12 | export LEIN_DATOMIC_USERNAME=
13 | export LEIN_DATOMIC_PASSWORD=
14 | ```
15 |
16 | To verify it is configured correctly run
17 |
18 | ```
19 | $ lein repl
20 |
21 | datomic.core=> (System/getenv "LEIN_PASSWORD")
22 | "
23 | ```
24 |
25 |
26 | ## License
27 |
28 | This program and the accompanying materials are made available under the
29 | terms of the Eclipse Public License 2.0 which is available at
30 | http://www.eclipse.org/legal/epl-2.0.
31 |
32 | This Source Code may also be made available under the following Secondary
33 | Licenses when the conditions for such availability set forth in the Eclipse
34 | Public License, v. 2.0 are satisfied: GNU General Public License as published by
35 | the Free Software Foundation, either version 2 of the License, or (at your
36 | option) any later version, with the GNU Classpath Exception which is available
37 | at https://www.gnu.org/software/classpath/license.html.
38 |
--------------------------------------------------------------------------------
/string-utils/src/string_utils/core.clj:
--------------------------------------------------------------------------------
1 | (ns string-utils.core
2 | (:require [inflections.core :as i]))
3 |
4 |
5 | ; Pluralize ---------------------------------
6 | ; https://github.com/r0man/inflections-clj
7 | (defn pluralize []
8 | (println (i/pluralize 1 "dog")) ; "1 dog"
9 | (println (i/pluralize 3 "dog")) ; "3 dogs"
10 | (println (i/pluralize 1 "box" "boxen")) ; "1 box"
11 | (println (i/pluralize 4 "box" "boxen"))) ; "4 boxen"
12 |
13 |
14 | ; Tableify ---------------------------------
15 | (defn tableify
16 | "Create a string formatted as a 3 column table from a sequence"
17 | [row]
18 | (apply format "%-20s | %-20s | %-20s" row))
19 |
20 | (def header ["First name" "Last name" "Year of Birth"])
21 | (def people [["Ada" "Lovelace" 1815]
22 | ["Haskell" "Curry" 1900]
23 | ["Fred" "Brooks" 1931]])
24 |
25 | (defn output-table! []
26 | (->> people
27 | (concat [header])
28 | (map tableify)
29 | (map println)
30 | (dorun)))
31 |
32 | ; First name | Last name | Year of Birth
33 | ; Ada | Lovelace | 1815
34 | ; Haskell | Curry | 1900
35 | ; Fred | Brooks | 1931
36 |
--------------------------------------------------------------------------------
/core-async/src/core_async_examples/core.clj:
--------------------------------------------------------------------------------
1 | (ns core-async-examples.core
2 | (:require
3 | [clojure.core.async :refer [chan sliding-buffer go go-loop timeout >! ! out msg))))
28 |
29 | ;; Run this in a repl
30 | ;; (create-producer (create-consumer "a") (create-consumer "b"))
31 | ;; And you will see output like this:
32 | ;; consumer a received: 49
33 | ;; consumer b received: 49
34 | ;; consumer a received: 12
35 | ;; consumer b received: 12
36 | ;; consumer a received: 41
37 | ;; consumer b received: 41
38 | ;; consumer a received: 76
39 | ;; consumer b received: 76
40 | ;; consumer a received: 97
41 | ;; consumer b received: 97
42 |
43 |
--------------------------------------------------------------------------------
/apache-lucene/tokenize/src/lucene/core.clj:
--------------------------------------------------------------------------------
1 | (ns lucene.core
2 | (:gen-class)
3 | (import [org.apache.lucene.analysis TokenStream]
4 | [org.apache.lucene.analysis.tokenattributes CharTermAttribute]
5 | [org.apache.lucene.analysis.standard StandardAnalyzer]
6 | [org.apache.lucene.util Version]))
7 |
8 |
9 | (def LUCENE_VERSION (Version/LUCENE_36))
10 | (def STOP_WORDS StandardAnalyzer/STOP_WORDS_SET)
11 | (def TEXT_TO_TOKENIZE "The Quick quick brown fox jumps over the lazy dog.")
12 |
13 |
14 | (defn tokenizer-seq
15 | "Build a lazy-seq out of a tokenizer with CharTermAttribute"
16 | [^TokenStream tokenizer ^CharTermAttribute term-att]
17 | (lazy-seq
18 | (when (.incrementToken tokenizer)
19 | (cons (.term term-att) (tokenizer-seq tokenizer term-att)))))
20 |
21 |
22 | (defn tokenize-text
23 | "Apply a lucene tokenizer to cleaned text content as a lazy-seq"
24 | [^StandardAnalyzer analyzer text]
25 | (let [reader (java.io.StringReader. text)
26 | tokenizer (.tokenStream analyzer nil reader)
27 | term-att (.addAttribute tokenizer CharTermAttribute)]
28 | (tokenizer-seq tokenizer term-att)))
29 |
30 |
31 | (defn -main []
32 | (def analyzer (StandardAnalyzer. LUCENE_VERSION STOP_WORDS))
33 | (def tokens (tokenize-text analyzer TEXT_TO_TOKENIZE))
34 |
35 | (println TEXT_TO_TOKENIZE)
36 | (doseq [token tokens] (println token)))
37 |
38 |
39 |
--------------------------------------------------------------------------------
/apache-commons-daemon/README.md:
--------------------------------------------------------------------------------
1 | # apache-commons-daemon
2 |
3 | Simple example of using the Apache Commons Daemon with Clojure
4 | http://commons.apache.org/proper/commons-daemon/
5 |
6 | You will need to install jsvc as well
7 | http://commons.apache.org/proper/commons-daemon/jsvc.html
8 |
9 | On Ubuntu it is as simple as:
10 |
11 | ```bash
12 | $ sudo apt-get install jsvc
13 | ```
14 |
15 | To build:
16 |
17 | ```bash
18 | $ lein uberjar
19 | ```
20 |
21 | Start/stop like this (change your java home to what is appropriate for you):
22 |
23 | ```bash
24 | $ sudo /usr/bin/jsvc -java-home /usr/lib/jvm/java-8-oracle/jre/ \
25 | -cp "$(pwd)/target/apache-commons-daemon-0.1.0-SNAPSHOT-standalone.jar" \
26 | -outfile "$(pwd)/out.txt" \
27 | apache_commons_daemon.core
28 |
29 | $ sudo /usr/bin/jsvc -java-home /usr/lib/jvm/java-8-oracle/jre/ \
30 | -cp "$(pwd)/target/apache-commons-daemon-0.1.0-SNAPSHOT-standalone.jar" \
31 | -stop \
32 | apache_commons_daemon.core
33 |
34 | $ sudo cat out.txt
35 | ```
36 |
37 | You should see output that looks something like this:
38 |
39 | ```
40 | ;; Starting MetricsComponent
41 | ;; Starting TickComponent
42 | tick
43 | tick
44 | tick
45 | tick
46 | tick
47 | ;; Stopping TickComponent
48 | ;; Stopping MetricsComponent
49 | ;; Metric num ticks: 5
50 | ```
51 |
52 | ## License
53 |
54 | Copyright © 2021 Will Fleming
55 |
56 | Distributed under the Eclipse Public License either version 1.0 or (at
57 | your option) any later version.
58 |
--------------------------------------------------------------------------------
/cascalog/README:
--------------------------------------------------------------------------------
1 | # cascalog-examples
2 |
3 | Examples for using Cascalog
4 |
5 |
6 | ## Usage
7 |
8 | $ lein repl
9 |
10 |
11 | (use 'cascalog_examples.read_file)
12 |
13 | (print-file "data/foo.out")
14 | (print-csv-file "data/state-abbreviation.csv")
15 |
16 |
17 |
18 |
19 | (use 'cascalog_examples.us_state_queries)
20 |
21 | (state-abbreviation-query)
22 | RESULTS
23 | -----------------------
24 | AL Alabama
25 | AK Alaska
26 | AZ Arizona
27 | AR Arkansas
28 | ...
29 | -----------------------
30 |
31 |
32 | (state-starting-with-query "C")
33 | RESULTS
34 | -----------------------
35 | California
36 | Colorado
37 | Connecticut
38 | -----------------------
39 |
40 |
41 | (count-state-starting-with-query "C")
42 | RESULTS
43 | -----------------------
44 | 3
45 | -----------------------
46 |
47 |
48 | (join-state-capital-query)
49 | RESULTS
50 | -----------------------
51 | Alaska Juneau
52 | Alabama Montgomery
53 | Arkansas Little Rock
54 | Arizona Phoenix
55 | ...
56 | -----------------------
57 |
58 |
59 | (state-first-letter-count)
60 | RESULTS
61 | -----------------------
62 | Comparator
63 | A 4
64 | C 3
65 | D 2
66 | F 1
67 | ...
68 | -----------------------
69 |
70 | (state-abbreviation-json-query)
71 | RESULTS
72 | -----------------------
73 | AL Alabama
74 | AK Alaska
75 | AZ Arizona
76 | AR Arkansas
77 | ...
78 | -----------------------
79 |
80 |
81 | ## License
82 |
83 | Copyright © 2021 William Fleming
84 |
85 | Distributed under the Eclipse Public License, the same as Clojure.
86 |
--------------------------------------------------------------------------------
/clj-diff/src/diff/core.clj:
--------------------------------------------------------------------------------
1 | (ns diff.core
2 | (:require [clj-diff.core :as diff]))
3 |
4 | ;; https://github.com/brentonashworth/clj-diff
5 |
6 | (def fuzzy-max-diff 2)
7 | (def fuzzy-percent-diff 0.1)
8 | (def fuzzy-dist diff/edit-distance)
9 | ;(def fuzzy-dist diff/levenshtein-distance)
10 |
11 | (defn fuzzy=
12 | "Returns a fuzzy match."
13 | [a b]
14 | (let [dist (fuzzy-dist a b)]
15 | (or
16 | (<= dist fuzzy-max-diff)
17 | (<= (/ dist (min (count a) (count b)))
18 | fuzzy-percent-diff))))
19 |
20 |
21 | (defn records-match?
22 | [key-fn a b]
23 | (let [kfns (if (sequential? key-fn)
24 | key-fn [key-fn])
25 | rfn (fn [prev next-fn]
26 | (and prev (fuzzy= (next-fn a)
27 | (next-fn b))))]
28 | (reduce rfn true kfns)))
29 |
30 | (def data
31 | {
32 | :mulder {:given-name "Fox" :surname "Mulder"}
33 | :molder {:given-name "Fox" :surname "Molder"}
34 | :mulder2 {:given-name "fox" :surname "mulder"}
35 | :scully {:given-name "Dana" :surname "Scully"}
36 | :scully2 {:given-name "Dan" :surname "Scully"}})
37 |
38 |
39 | (defn -main []
40 | ; true
41 | (println
42 | (records-match? [:given-name :surname] (data :mulder) (data :molder)))
43 |
44 | ; true
45 | (println
46 | (records-match? [:given-name :surname] (data :mulder) (data :mulder2)))
47 |
48 | ; true
49 | (println
50 | (records-match? [:given-name :surname] (data :scully) (data :scully2)))
51 |
52 | ; false
53 | (println
54 | (records-match? [:given-name :surname] (data :mulder) (data :scully))))
55 |
--------------------------------------------------------------------------------
/cheshire/src/json/core.clj:
--------------------------------------------------------------------------------
1 | (ns json.core
2 | (:require [cheshire.core :as json])
3 | (:import [java.util Date]))
4 |
5 |
6 | (defn -main []
7 | ;; generate some json
8 | (println (json/generate-string {:foo "bar" :baz 5}))
9 |
10 | (println (json/generate-string {:foo "bar" :baz nil}))
11 |
12 | (println (json/generate-string {:foo "bar" :baz []}))
13 | (println (json/generate-string {:foo "bar" :baz [1 2 "something"]}))
14 |
15 | ;; write some json to a stream
16 | (json/generate-stream {:foo "bar" :baz 5} (clojure.java.io/writer "/tmp/foo"))
17 |
18 |
19 | ;; generate some JSON with Dates
20 | ;; the Date will be encoded as a string using
21 | ;; the default date format: yyyy-MM-dd'T'HH:mm:ss'Z'
22 | (println (json/generate-string {:foo "bar" :baz (Date. 0)}))
23 |
24 | ;; generate some JSON with Dates with custom Date encoding
25 | (println (json/generate-string {:baz (Date. 0)} "yyyy-MM-dd"))
26 |
27 |
28 | ;; parse some json
29 | (json/parse-string "{\"foo\":\"bar\"}")
30 | ;; => {"foo" "bar"}
31 |
32 | ;; parse some json and get keywords back
33 | (json/parse-string "{\"foo\":\"bar\"}" true)
34 | ;; => {:foo "bar"}
35 |
36 | ;; parse a stream (keywords option also supported)
37 | (def a (json/parse-stream (clojure.java.io/reader "/tmp/foo") true))
38 | (println (type (:foo a)))
39 | ;; => java.lang.String
40 |
41 | (def a (json/parse-stream (clojure.java.io/reader "/tmp/foo")))
42 | (println (type (a "foo")))
43 | ;; => java.lang.String
44 |
45 | (def a (json/parse-stream (clojure.java.io/reader "/tmp/foo")))
46 | (println (type (:foo a)))
47 | ;; => nil
48 | )
49 |
--------------------------------------------------------------------------------
/opennlp/sentence-detection/src/nlp/core.clj:
--------------------------------------------------------------------------------
1 | (ns nlp.core
2 | (:import (java.io FileInputStream))
3 | (:import (opennlp.tools.sentdetect SentenceModel
4 | SentenceDetectorME)))
5 |
6 |
7 | (def text "The history of NLP generally starts in the 1950s, although work can be found from earlier periods. In 1950, Alan Turing published his famous article \"Computing Machinery and Intelligence\" which proposed what is now called the Turing test as a criterion of intelligence. This criterion depends on the ability of a computer program to impersonate a human in a real-time written conversation with a human judge, sufficiently well that the judge is unable to distinguish reliably — on the basis of the conversational content alone — between the program and a real human. The Georgetown experiment in 1954 involved fully automatic translation of more than sixty Russian sentences into English. The authors claimed that within three or five years, machine translation would be a solved problem. However, real progress was much slower, and after the ALPAC report in 1966, which found that ten years long research had failed to fulfill the expectations, funding for machine translation was dramatically reduced. Little further research in machine translation was conducted until the late 1980s, when the first statistical machine translation systems were developed.")
8 |
9 |
10 | (defn -main []
11 | (with-open [is (FileInputStream. "models/opennlp-en-ud-ewt-sentence-1.0-1.9.3.bin")]
12 | (let [model (SentenceModel. is)
13 | sdetector (SentenceDetectorME. model)
14 | sentences (.sentDetect sdetector text)]
15 | (doseq [s sentences]
16 | (println s)))))
17 |
18 |
--------------------------------------------------------------------------------
/core-async/src/core_async_examples/backpressure.clj:
--------------------------------------------------------------------------------
1 | (ns core-async-examples.core
2 | (:require
3 | [clojure.core.async :refer [chan buffer offer! go go-loop timeout >! (get-oauth-authorized-twitter)
26 | (.search query)
27 | (.getTweets))))
28 |
29 | (defn get-home-timeline []
30 | (-> (get-oauth-authorized-twitter)
31 | (.timelines)
32 | (.getHomeTimeline)))
33 |
34 | (defn get-friends-ids
35 | "Returns a vector of user ids that the specified user is friends with."
36 | [screen-name]
37 | (-> (getOAuthAuthorizedTwitter)
38 | (.friendsFollowers)
39 | (.getFriendsIDs screen-name -1)
40 | (.getIDs)
41 | (aclone) ; Java arrays are aliased in Clojure, ensure it won't be modified elsewhere
42 | (vec)))
43 |
44 |
45 | (defn -main []
46 | (def results (search "clojure"))
47 | ;; (def results (get-home-timeline))
48 | (def output (format-statuses-for-output results))
49 | (doseq [tweet output] (println tweet)))
50 |
--------------------------------------------------------------------------------
/apache-spark/flambo-gaming-stack-exchange/src/flambo_gaming_stack_exchange/etl_users.clj:
--------------------------------------------------------------------------------
1 | (ns flambo-gaming-stack-exchange.etl-users
2 | (:require [flambo.conf :as conf]
3 | [flambo.api :as f]
4 | [flambo.sql :as sql]
5 | [clojure.data.xml :as xml])
6 | (:import [org.apache.spark.sql RowFactory]
7 | [org.apache.spark.sql.types StructType StructField Metadata DataTypes])
8 | (:gen-class))
9 |
10 |
11 |
12 | (defn build-sql-context
13 | "Returns a Spark SQLContext"
14 | [app-name]
15 | (let [c (-> (conf/spark-conf)
16 | (conf/master "local[*]")
17 | (conf/app-name app-name))
18 | sc (f/spark-context c)]
19 | (sql/sql-context sc)))
20 |
21 |
22 | (defn xml->row
23 | "Parse a row of user xml and return it as a Spark Row"
24 | [user-xml]
25 | (let [user (xml/parse-str user-xml)
26 | {{:keys [Id DisplayName Reputation]} :attrs} user]
27 | [(RowFactory/create (into-array Object [(Integer/parseInt Id) DisplayName (Integer/parseInt Reputation)]))]))
28 |
29 | "Spark function that reads in a line of XML and potentially returns a Row"
30 | (f/defsparkfn parse-user
31 | [user-xml]
32 | (if (.startsWith user-xml " row user-xml)
34 | []))
35 |
36 |
37 | (def user-schema
38 | (StructType.
39 | (into-array StructField [(StructField. "id" (DataTypes/IntegerType) true (Metadata/empty))
40 | (StructField. "name" (DataTypes/StringType) true (Metadata/empty))
41 | (StructField. "reputation" (DataTypes/IntegerType) true (Metadata/empty))])))
42 |
43 |
44 | (defn -main [& args]
45 | (let [home (java.lang.System/getenv "HOME")
46 | sql-ctx (build-sql-context "ETL Users")
47 | sc (sql/spark-context sql-ctx)
48 | xml-users (f/text-file sc (str home "/data/gaming-stackexchange/Users.xml"))
49 | users (f/flat-map xml-users parse-user)
50 | users-df (.createDataFrame sql-ctx users user-schema)]
51 | (.saveAsParquetFile users-df (str home "/data/gaming-stack-exchange-warehouse/users.parquet"))))
52 |
--------------------------------------------------------------------------------
/apache-spark/flambo-gaming-stack-exchange/src/flambo_gaming_stack_exchange/etl_posts.clj:
--------------------------------------------------------------------------------
1 | (ns flambo-gaming-stack-exchange.etl-posts
2 | (:require [flambo.conf :as conf]
3 | [flambo.api :as f]
4 | [flambo.sql :as sql]
5 | [clojure.data.xml :as xml])
6 | (:import [org.apache.spark.sql RowFactory]
7 | [org.apache.spark.sql.types StructType StructField Metadata DataTypes])
8 | (:gen-class))
9 |
10 |
11 |
12 | (defn build-sql-context
13 | "Returns a Spark SQLContext"
14 | [app-name]
15 | (let [c (-> (conf/spark-conf)
16 | (conf/master "local[*]")
17 | (conf/app-name app-name))
18 | sc (f/spark-context c)]
19 | (sql/sql-context sc)))
20 |
21 | (defn parse-int
22 | "Reads a string, returns a number or nil if the string was x"
23 | [x]
24 | (if (nil? x)
25 | x
26 | (Integer/parseInt x)))
27 |
28 | (defn xml->row
29 | "Parse a row of post xml and return it as a Spark Row"
30 | [post-xml]
31 | (let [user (xml/parse-str post-xml)
32 | {{:keys [OwnerUserId PostTypeId Tags]} :attrs} user]
33 | [(RowFactory/create (into-array Object [(parse-int OwnerUserId) (parse-int PostTypeId) Tags]))]))
34 |
35 |
36 | "Spark function that reads in a line of XML and potentially returns a Row"
37 | (f/defsparkfn parse-post
38 | [post-xml]
39 | (if (.startsWith post-xml " row post-xml)
41 | []))
42 |
43 |
44 |
45 | (def post-schema
46 | (StructType.
47 | (into-array StructField [(StructField. "ownerId" (DataTypes/IntegerType) true (Metadata/empty))
48 | (StructField. "postType" (DataTypes/IntegerType) true (Metadata/empty))
49 | (StructField. "tags" (DataTypes/StringType) true (Metadata/empty))])))
50 |
51 |
52 | (defn -main [& args]
53 | (let [home (java.lang.System/getenv "HOME")
54 | sql-ctx (build-sql-context "ETL Posts")
55 | sc (sql/spark-context sql-ctx)
56 | xml-users (f/text-file sc (str home "/data/gaming-stackexchange/Posts.xml"))
57 | posts (f/flat-map xml-users parse-post)
58 | users-df (.createDataFrame sql-ctx posts post-schema)]
59 | (.saveAsParquetFile users-df (str home "/data/gaming-stack-exchange-warehouse/posts.parquet"))))
60 |
61 |
--------------------------------------------------------------------------------
/twitter4j/streaming-api/src/streaming_api/core.clj:
--------------------------------------------------------------------------------
1 | (ns streaming-api.core
2 | (:gen-class)
3 | (:import [twitter4j
4 | StatusListener TwitterStream TwitterStreamFactory
5 | FilterQuery]
6 | [twitter4j.conf ConfigurationBuilder Configuration]
7 | [twitter4j.json DataObjectFactory]))
8 |
9 | ;(set! *warn-on-reflection* true)
10 |
11 |
12 | (defn config-with-password ^Configuration []
13 | "Build a twitter4j configuration object with a username/password pair"
14 | (let [cb (ConfigurationBuilder.)]
15 | (.setUser cb "YOUR-USERNAME")
16 | (.setPassword cb "YOUR-PASSWORD")
17 |
18 | ; Uncomment if you want access to the raw json
19 | ;(.setJSONStoreEnabled cb true)
20 |
21 | (.build cb)))
22 |
23 |
24 |
25 | (defn status-listener []
26 | "Implementation of twitter4j's StatusListener interface"
27 | (proxy [StatusListener] []
28 |
29 | (onStatus [^twitter4j.Status status]
30 | (println (.getText status))
31 | ; How to get raw json - make sure it's uncommented in the config
32 | ; or else will print nil.
33 | ;(println (DataObjectFactory/getRawJSON status)
34 | )
35 |
36 | (onException [^java.lang.Exception e] (.printStackTrace e))
37 | (onDeletionNotice [^twitter4j.StatusDeletionNotice statusDeletionNotice] ())
38 | (onScrubGeo [userId upToStatusId] ())
39 | (onTrackLimitationNotice [numberOfLimitedStatuses] ())))
40 |
41 |
42 | (defn get-twitter-stream-factory[]
43 | (let [factory (TwitterStreamFactory. (config-with-password))]
44 | (.getInstance factory)))
45 |
46 |
47 | (defn do-filter-stream []
48 | ; We want tweets with the word tweet in them
49 | (let [filter-query (FilterQuery. 0 (long-array []) (into-array String ["tweet"]))
50 | stream (.getFilterStream (get-twitter-stream-factory) filter-query)]
51 | (while true
52 | (.next stream (status-listener)))))
53 |
54 |
55 | (defn do-sample-stream []
56 | (let [stream (get-twitter-stream-factory)]
57 | (.addListener stream (status-listener))
58 | (.sample stream)))
59 |
60 |
61 | (defn -main []
62 | (do-filter-stream)
63 | ; (do-sample-stream)
64 |
65 | )
66 |
67 |
68 |
69 | ; In event want to use OAuth, here's the java
70 | ;ConfigurationBuilder cb = new ConfigurationBuilder();
71 | ; cb.setDebugEnabled(true)
72 | ; .setOAuthConsumerKey("*********************")
73 | ; .setOAuthConsumerSecret("******************************************")
74 | ; .setOAuthAccessToken("**************************************************")
75 | ; .setOAuthAccessTokenSecret("******************************************");
76 | ;TwitterFactory tf = new TwitterFactory(cb.build());
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/clj-time/src/time/core.clj:
--------------------------------------------------------------------------------
1 | (ns time.core
2 | (:gen-class)
3 | (:require
4 | [clj-time.core :as timec]
5 | [clj-time.coerce :as coerce]
6 | [clj-time.format :as time-format]))
7 |
8 |
9 | (def ^:dynamic *default-formats*
10 | [ :date
11 | :date-hour-minute
12 | :date-hour-minute-second
13 | :date-hour-minute-second-ms
14 | :date-time
15 | :date-time-no-ms
16 | :rfc822
17 | "YYYY-MM-dd HH:mm"
18 | "YYYY-MM-dd HH:mm:ss"
19 | "dd/MM/YYYY"
20 | "YYYY/MM/dd"
21 | "d MMM YYYY"])
22 |
23 | (defprotocol ToFormatter
24 | (->formatter [fmt]))
25 |
26 | (extend-protocol ToFormatter
27 | java.lang.String
28 | (->formatter [fmt]
29 | (time-format/formatter fmt))
30 |
31 | clojure.lang.Keyword
32 | (->formatter [fmt]
33 | (time-format/formatters fmt)))
34 |
35 |
36 | (defn parse-or-nil
37 | [fmt date-str]
38 | (try
39 | (time-format/parse
40 | (->formatter fmt)
41 | date-str)
42 | (catch
43 | Exception e
44 | nil)))
45 |
46 | ;; Attempt to parse all known formats, take the first valid one
47 | (defn normalize-datetime
48 | [date-str]
49 | (first
50 | (remove nil?
51 | (map #(parse-or-nil % date-str) *default-formats*))))
52 |
53 |
54 | (defn normalize-datetime-examples []
55 | (println "\n------ normalize-datetime-examples ------")
56 |
57 | ;; #
58 | (println (normalize-datetime "2014-01-22"))
59 |
60 | ;; #
61 | (println (normalize-datetime "2014/01/22"))
62 |
63 | ;; #
64 | (println (normalize-datetime "22 Jan 2014"))
65 |
66 | ;; #
67 | (println (normalize-datetime "2014-01-22 14:25")))
68 |
69 | (defn parse-time-examples []
70 | (println "\n------ parse-time-examples ------")
71 | (let [time-format-example (time-format/formatter "MM/dd/yy")]
72 | (println "MM/dd/yy:" (time-format/parse time-format-example "03/15/21"))))
73 |
74 | (defn relative-dates-examples []
75 | (println "\n------ relative-dates-examples ------")
76 |
77 | (print "1 day from now: ")
78 | (-> 1
79 | timec/days
80 | timec/from-now
81 | println)
82 |
83 | (print "2 days ago: ")
84 | (-> 2
85 | timec/days
86 | timec/ago
87 | println))
88 |
89 | (defn -main []
90 | (println "Current time:" (timec/now))
91 |
92 | ;; #
93 | (println "from-long:" (coerce/from-long 893462400000))
94 |
95 | (parse-time-examples)
96 |
97 | (relative-dates-examples)
98 |
99 | (normalize-datetime-examples))
100 |
--------------------------------------------------------------------------------
/apache-lucene/search/src/lucene/core.clj:
--------------------------------------------------------------------------------
1 | (ns lucene.core
2 | (:gen-class)
3 | (import [org.apache.lucene.analysis.standard StandardAnalyzer]
4 | [org.apache.lucene.document Document Field Field$Store Field$Index]
5 | [org.apache.lucene.index IndexWriter IndexWriterConfig IndexReader]
6 | [org.apache.lucene.queryparser.classic QueryParser]
7 | [org.apache.lucene.search IndexSearcher Query TopDocs]
8 | [org.apache.lucene.store RAMDirectory]
9 | [org.apache.lucene.util Version]))
10 |
11 | (def LUCENE_VERSION (Version/LUCENE_4_10_1))
12 |
13 | (defn createDocument [title content]
14 | (let [document (Document.)
15 | titleField (Field. "title" title Field$Store/YES Field$Index/NO)
16 | contentField (Field. "content" content Field$Store/YES Field$Index/ANALYZED)]
17 | (doto document
18 | (.add titleField)
19 | (.add contentField))
20 | document))
21 |
22 |
23 |
24 | (defn search [searcher queryString]
25 | (let [queryParser (QueryParser. LUCENE_VERSION "content" (StandardAnalyzer. LUCENE_VERSION))
26 | query (.parse queryParser queryString)
27 | topDocs (.search searcher query 5)]
28 | (println "--------------------------")
29 | (println (str "Query: " queryString))
30 | (println (str "Num hits: " (.totalHits topDocs)))
31 | (doseq [document (.scoreDocs topDocs)]
32 | (print (str (.score document) " "))
33 | (println (.get (.doc searcher (.doc document)) "content")))
34 | (println "--------------------------")))
35 |
36 |
37 | (def title-1 "E. W. Dijkstra")
38 | (def content-1 "The computing scientist's main challenge is not to get confused by the complexities of his own making.")
39 |
40 | (def title-2 "Brian Kernigan")
41 | (def content-2 "Controlling complexity is the essence of computer programming.")
42 |
43 | (def title-3 "David Gelernter")
44 | (def content-3 "Beauty is more important in computing than anywhere else in technology because software is so complicated. Beauty is the ultimate defence against complexity.")
45 |
46 |
47 | (defn createIndex []
48 | (let [index (RAMDirectory.)
49 | analyzer (StandardAnalyzer. LUCENE_VERSION)
50 | config (IndexWriterConfig. LUCENE_VERSION analyzer)]
51 | (doto (IndexWriter. index config)
52 | (.addDocument (createDocument title-1 content-1))
53 | (.addDocument (createDocument title-2 content-2))
54 | (.addDocument (createDocument title-3 content-3))
55 | (.commit)
56 | (.close))
57 | index))
58 |
59 |
60 | (defn -main []
61 | (let [index (createIndex)
62 | searcher (IndexSearcher. (IndexReader/open index))]
63 | (search searcher "complexity")
64 | (search searcher "main")))
65 |
--------------------------------------------------------------------------------
/cascalog/src/cascalog_examples/us_state_queries.clj:
--------------------------------------------------------------------------------
1 | (ns cascalog_examples.us_state_queries
2 | (:use cascalog.api)
3 | (:require [clojure.data.csv :as csv]
4 | [cheshire.core :as json]
5 | [cascalog.logic.ops :as ops]))
6 |
7 |
8 | (def state-abbreviation-path "data/state-abbreviation.csv")
9 | (def state-abbreviation-json-path "data/state-abbreviation.json")
10 | (def capital-abbreviation-path "data/capital-abbreviation.csv")
11 |
12 |
13 | (defn csv-parser [line]
14 | (map #(.trim %) (first (csv/read-csv line))))
15 |
16 | (defn state-abbreviation-query []
17 | (let [file-tap (lfs-textline state-abbreviation-path)]
18 | (?<-
19 | (stdout)
20 | [?abbr ?state]
21 | (file-tap ?line)
22 | (csv-parser ?line :> ?state ?abbr))))
23 |
24 | (defn json-parser [line]
25 | (map (json/parse-string line) ["full" "abbr"]))
26 |
27 | (defn state-abbreviation-json-query []
28 | (let [file-tap (lfs-textline state-abbreviation-json-path)]
29 | (?<-
30 | (stdout)
31 | [?abbr ?state]
32 | (file-tap ?line)
33 | (json-parser ?line :> ?state ?abbr))))
34 |
35 |
36 | (deffilterfn starts-with? [^String s prefix] (.startsWith s prefix))
37 |
38 | (defn state-starting-with-query
39 | "Output states starting with the prefix. Ie V -> Vermont, Virginia"
40 | [prefix]
41 | (let [file-tap (lfs-textline state-abbreviation-path)]
42 | (?<-
43 | (stdout)
44 | [?state]
45 | (file-tap ?line)
46 | (csv-parser ?line :> ?state _)
47 | (starts-with? ?state prefix))))
48 |
49 |
50 | (defn count-state-starting-with-query
51 | "Output count of states starting with the prefix. Ie V -> 2"
52 | [prefix]
53 | (let [file-tap (lfs-textline state-abbreviation-path)]
54 | (?<-
55 | (stdout)
56 | [?count]
57 | (file-tap ?line)
58 | (csv-parser ?line :> ?state _)
59 | (starts-with? ?state prefix)
60 | (ops/count ?count))))
61 |
62 |
63 |
64 |
65 | (defn join-state-capital-query []
66 | (let [cap-abbr-tap (lfs-textline capital-abbreviation-path)
67 | st-abbr-tap (lfs-textline state-abbreviation-path)]
68 | (?<-
69 | (stdout)
70 | [?state ?capital]
71 | (cap-abbr-tap ?cap-abbr-line)
72 | (csv-parser ?cap-abbr-line :> ?capital ?abbr)
73 | (st-abbr-tap ?st-abbr-line)
74 | (csv-parser ?st-abbr-line :> ?state ?abbr))))
75 |
76 |
77 |
78 | (defn first-letter [^String word] (first word))
79 |
80 | (defn state-first-letter-count []
81 | (let [file-tap (lfs-textline state-abbreviation-path)]
82 | (?<-
83 | (stdout)
84 | [?first-letter ?letter-count]
85 | (file-tap ?line)
86 | (csv-parser ?line :> ?state _)
87 | (first-letter ?state :> ?first-letter)
88 | (ops/count ?letter-count))))
89 |
--------------------------------------------------------------------------------
/apache-commons-daemon/src/apache_commons_daemon/core.clj:
--------------------------------------------------------------------------------
1 | (ns apache-commons-daemon.core
2 | (:require [com.stuartsierra.component :as component])
3 | (:import [org.apache.commons.daemon Daemon DaemonContext])
4 | (:gen-class
5 | :implements [org.apache.commons.daemon.Daemon]))
6 |
7 |
8 | ;; Application Metrics Component
9 | (defrecord MetricsComponent [num-ticks]
10 | ;; Implement the Lifecycle protocol
11 | component/Lifecycle
12 |
13 | (start [component]
14 | (println ";; Starting MetricsComponent")
15 | (reset! (:num-ticks component) 0)
16 | component)
17 |
18 | (stop [component]
19 | (println ";; Stopping MetricsComponent")
20 | (println (str ";; Metric num ticks: " @(:num-ticks component)))
21 | component))
22 |
23 | (defn make-metrics-component
24 | "Constructor for a metrics component"
25 | []
26 | (map->MetricsComponent {:num-ticks (atom 0)}))
27 |
28 | (defn inc-num-ticks-metric [metrics-component]
29 | (swap! (get metrics-component :num-ticks) inc))
30 |
31 |
32 | ;; Tick Component
33 | (defn do-ticks
34 | "Print to stdout and increment the ticks metric once a second when the component is running"
35 | [state metrics-component]
36 | (while (= :running @state)
37 | (println "tick")
38 | (inc-num-ticks-metric metrics-component)
39 | (Thread/sleep 1000)))
40 |
41 | (defrecord TickComponent [state metrics-component]
42 | ;; Implement the Lifecycle protocol
43 | component/Lifecycle
44 |
45 | (start [component]
46 | (println ";; Starting TickComponent")
47 | (reset! (:state component) :running)
48 | ;; Do some work in another thread
49 | (future (do-ticks (:state component) metrics-component))
50 | component)
51 |
52 | (stop [component]
53 | (println ";; Stopping TickComponent")
54 | (reset! (:state component) :stopped)
55 | component))
56 |
57 |
58 | (defn make-tick-component
59 | "Constructor for a tick component"
60 | []
61 | (map->TickComponent {:state (atom :stopped)}))
62 |
63 |
64 | ;; Application System
65 | (defn make-app-system []
66 | (component/system-map
67 | :metrics-component (make-metrics-component)
68 | :tick-component (component/using
69 | (make-tick-component)
70 | [:metrics-component])))
71 |
72 | (def app-system (make-app-system))
73 |
74 | ;; Separate start/stop functions for easier development in a REPL
75 | (defn start []
76 | (alter-var-root #'app-system component/start))
77 |
78 | (defn stop []
79 | (alter-var-root #'app-system component/stop))
80 |
81 |
82 | ;; Commons Daemon implementatation
83 | (defn -init [this ^DaemonContext context])
84 |
85 | (defn -start [this]
86 | (start))
87 |
88 | (defn -stop [this]
89 | (stop))
90 |
91 | (defn -destroy [this])
92 |
93 | ;; Enable starting via java -jar command
94 | (defn -main [& args]
95 | ;;(init args)
96 | (start))
97 |
--------------------------------------------------------------------------------
/weka/filter-and-rename-columns-in-dataset/src/filter_and_rename_columns_in_dataset/core.clj:
--------------------------------------------------------------------------------
1 | (ns filter-and-rename-columns-in-dataset.core
2 | (import
3 | [weka.core.converters CSVLoader ArffLoader]
4 | [weka.filters Filter]
5 | [weka.filters.unsupervised.attribute Remove]
6 | [java.io File])
7 | (:require
8 | [clojure.string :as clj-str]))
9 |
10 |
11 | (defn ->options
12 | "Convert options into an array of strings"
13 | [& opts]
14 | (into-array String (map str (flatten (remove nil? opts)))))
15 |
16 |
17 | (defn load-csv
18 | [filename & {:keys [header]
19 | :or {header true}}]
20 | (let [options (->options (when-not header "-H"))
21 | loader (doto (CSVLoader.)
22 | (.setOptions options)
23 | (.setSource (File. filename)))]
24 | (.getDataSet loader)))
25 |
26 |
27 | (defn set-fields
28 | "Take a dataset and a sequence of fields names, rename columns in dataset to field names"
29 | [instances field-seq]
30 | (doseq [n (range (.numAttributes instances))]
31 | (.renameAttribute instances
32 | (.attribute instances n)
33 | (name (nth field-seq n)))))
34 |
35 | (def fields [
36 | :geoid :sumlev :state :county :cbsa :csa :necta :cnecta :name :pop100
37 | :housing-units-100 :pop100-2000 :housing-units-100-2000
38 | :race-total :race-total-2000
39 | :race-white :race-white-2000
40 | :race-black :race-black-2000
41 | :race-indian :race-indian-2000
42 | :race-asian :race-asian-2000
43 | :race-hawaiian :race-hawaiian-2000
44 | :race-other :race-other-2000
45 | :race-two-more :race-two-more-2000])
46 |
47 |
48 | (defn attr-n
49 | "Take an attribute name and returns the index"
50 | [instances attr-name]
51 | (->> instances
52 | (.numAttributes)
53 | range
54 | (map #(vector % (.. instances (attribute %) name)))
55 | (filter #(= (second %) (name attr-name)))
56 | ffirst))
57 |
58 | (defn delete-attrs
59 | [instances attr-names]
60 | (reduce (fn [is n] (.deleteAttributeAt is (attr-n is n)) is)
61 | instances
62 | attr-names))
63 |
64 |
65 | (defn filter-attributes
66 | [dataset remove-attrs]
67 | (let [attrs (map inc (map attr-n remove-attrs))
68 | options (->options "-R"
69 | (clj-str/join \, (map str attrs)))
70 | rm (doto (Remove.)
71 | (.setOptions options)
72 | (.setInputFormat dataset))]
73 | (Filter/useFilter dataset rm)))
74 |
75 |
76 |
77 | (defn -main []
78 | (let [data (load-csv "../data/all_160.P3.csv" :header true)
79 | data-fields-set (set-fields data fields)
80 | data-attrs-removed (delete-attrs data [:sumlev :county :cbsa :csa :necta :cnecta])]
81 |
82 | (prn (take 4 (map #(.. data (attribute %) name) (range (.numAttributes data)))))
83 | (prn (take 2 data-attrs-removed))))
84 |
--------------------------------------------------------------------------------
/datomic/src/datomic/core.clj:
--------------------------------------------------------------------------------
1 | (ns datomic.core
2 | (:require [datomic.client.api :as d]))
3 |
4 | ;; To work with this in a REPL, ensure you call (setup-database) prior to running any queries
5 | ;; That will ensure the database and schema were created, and data was added.
6 |
7 | (def client (d/client {:server-type :dev-local
8 | :storage-dir :mem ;; using in memory storage, data will be erased when the process ends
9 | :system "examples"}))
10 |
11 | (def db-name "example-db")
12 |
13 | (defn get-db
14 | "Helper function to get a database"
15 | []
16 | (let [conn (d/connect client {:db-name db-name})
17 | db (d/db conn)]
18 | db))
19 |
20 | (def book-schema
21 | "Schema for books"
22 | [{:db/ident :book/title
23 | :db/valueType :db.type/string
24 | :db/cardinality :db.cardinality/one
25 | :db/doc "The title of the book"}
26 |
27 | {:db/ident :book/authors
28 | :db/valueType :db.type/string
29 | :db/cardinality :db.cardinality/many
30 | :db/doc "The authors of the book"}
31 |
32 | {:db/ident :book/release-year
33 | :db/valueType :db.type/long
34 | :db/cardinality :db.cardinality/one
35 | :db/doc "The year the book was published"}])
36 |
37 | (def first-books
38 | "Books to be added to Datomic"
39 | [{:book/title "The Joy of Clojure"
40 | :book/authors ["Michael Fogus" "Chris Houser"]
41 | :book/release-year 2014}
42 | {:book/title "Elements of Clojure"
43 | :book/authors ["Zachary Tellman"]
44 | :book/release-year 2019}
45 | {:book/title "Getting Clojure"
46 | :book/authors ["Russ Olsen"]
47 | :book/release-year 2018}])
48 |
49 |
50 | (defn setup-database
51 | "Creates a database, then adds the schema and some data to it."
52 | []
53 | (d/create-database client {:db-name db-name})
54 | (let [conn (d/connect client {:db-name db-name})]
55 | (d/transact conn {:tx-data book-schema}) ;; Create the schema
56 | (d/transact conn {:tx-data first-books}) ;; Insert some data
57 | ))
58 |
59 |
60 | ;; ----- Queries -----
61 | (def all-titles-q
62 | "Query to find all book titles"
63 | '[:find ?book-title
64 | :where [_ :book/title ?book-title]])
65 |
66 | (def published-after-2017-q
67 | "Query to find the title and authors of all books published after 2017"
68 | '[:find ?title ?authors
69 | :where
70 | [?book :book/release-year ?release-year]
71 | [?book :book/title ?title]
72 | [?book :book/authors ?authors]
73 | [(< 2017 ?release-year)]])
74 |
75 | (def book-titles-by-author-q
76 | "Query to find all books by an author"
77 | '[:find ?title
78 | :in $ ?author-name
79 | :where [?book :book/authors ?author-name]
80 | [?book :book/title ?title]])
81 |
82 |
83 | ;; Queries I run in CIDER
84 | ;; Ensure (setup-database) has already been called
85 | (comment
86 | (setup-database)
87 | (d/q all-titles-q (get-db))
88 | (d/q published-after-2017-q (get-db))
89 | (d/q book-titles-by-author-q (get-db) "Michael Fogus"))
90 |
--------------------------------------------------------------------------------
/spelling-corrector/src/spell/core.clj:
--------------------------------------------------------------------------------
1 | (ns spell.core
2 | (:gen-class)
3 | (:require [clojure.string :as string])
4 | (:use [clojure.set :only [union]]))
5 |
6 |
7 | (defn tokenize
8 | [text]
9 | (re-seq #"[a-z]+" (string/lower-case text)))
10 |
11 | (defn train
12 | [features]
13 | (frequencies features))
14 |
15 | (def n-words
16 | (train (tokenize (slurp "data/big.txt"))))
17 |
18 | (def alphabet "abcdefghijklmnopqrstuvwxyz")
19 |
20 |
21 | (defn split-word
22 | "Split a word into 2 parts at position i."
23 | [word i]
24 | [(.substring word 0 i)
25 | (.substring word i)])
26 |
27 | (defn delete-char
28 | "Delete the first character in the second part"
29 | [[w1 w2]]
30 | (str w1 (.substring w2 1)))
31 |
32 | (defn transpose-split
33 | "Transpose the first 2 characters of the second part."
34 | [[w1 w2]]
35 | (str w1 (second w2) (first w2) (.substring w2 2)))
36 |
37 | (defn replace-split
38 | "Replace the first character of the second part with every letter."
39 | [[w1 w2]]
40 | (let [w2-0 (.substring w2 1)]
41 | (map #(str w1 % w2-0) alphabet)))
42 |
43 | (defn insert-split
44 | "Insert every letter into the word at the split."
45 | [[w1 w2]]
46 | (map #(str w1 % w2) alphabet))
47 |
48 | (defn edits-1
49 | [word]
50 | (let [splits (map (partial split-word word) (range (inc (count word))))
51 | long-splits (filter #(> (count (second %)) 1) splits)
52 | deletes (map delete-char long-splits)
53 | transposes (map transpose-split long-splits)
54 | replaces (mapcat replace-split long-splits)
55 | inserts (remove nil? (mapcat insert-split splits))]
56 | (set (concat deletes transposes replaces inserts))))
57 |
58 | (defn known-edits-2
59 | [word]
60 | (set (filter (partial contains? n-words)
61 | (apply union (map #(edits-1 %) (edits-1 word))))))
62 |
63 | (defn known
64 | [words]
65 | (set (filter (partial contains? n-words) words)))
66 |
67 | (defn correct
68 | [word]
69 | (let [candidate-thunks [#(known (list word))
70 | #(known (edits-1 word))
71 | #(known-edits-2 word)
72 | #(list word)]]
73 | (->>
74 | candidate-thunks
75 | (map (fn [f] (f)))
76 | (filter #(> (count %) 0))
77 | first (map (fn [w] [(get n-words w 1) w]))
78 | (reduce (partial max-key first))
79 | second)))
80 |
81 | (defn -main []
82 |
83 | ; delete
84 | (println (correct "deete"))
85 |
86 | ; editor
87 | (println (correct "editr"))
88 |
89 | ; tranpsose
90 | ; Unable to correct as transpose is not in the training set
91 | (println (correct "tranpsose"))
92 |
93 | ; editor
94 | (println (correct "eidtor"))
95 |
96 | ; elder
97 | ; Incorrect correction
98 | (println (correct "eidtr"))
99 |
100 | ;; Why are there mistakes?
101 | ; nil
102 | (println (n-words "transpose"))
103 |
104 | ; 40
105 | (println (n-words "elder"))
106 |
107 | ; 17
108 | (println (n-words "editor"))
109 |
110 | )
111 |
--------------------------------------------------------------------------------
/apache-mahout/recommender/src/recommender/core.clj:
--------------------------------------------------------------------------------
1 | (ns recommender.core
2 | (:import
3 | [java.io File]
4 | [org.apache.mahout.cf.taste.impl.eval
5 | AverageAbsoluteDifferenceRecommenderEvaluator RMSRecommenderEvaluator
6 | GenericRecommenderIRStatsEvaluator]
7 | [org.apache.mahout.cf.taste.eval RecommenderBuilder RecommenderIRStatsEvaluator]
8 | [org.apache.mahout.cf.taste.impl.model.file FileDataModel]
9 | [org.apache.mahout.cf.taste.impl.neighborhood NearestNUserNeighborhood]
10 | [org.apache.mahout.cf.taste.impl.recommender GenericUserBasedRecommender]
11 | [org.apache.mahout.cf.taste.impl.similarity PearsonCorrelationSimilarity]
12 | [org.apache.mahout.common RandomUtils]
13 | ))
14 |
15 | (defn recommend [file]
16 | (let [model (FileDataModel. (File. file))
17 | similarity (PearsonCorrelationSimilarity. model)
18 | neighborhood (NearestNUserNeighborhood. 2 similarity model)
19 | recommender (GenericUserBasedRecommender. model neighborhood
20 | similarity)]
21 | (.recommend recommender 1 1)))
22 |
23 |
24 | (defn evaluator [file]
25 | (let [_ (RandomUtils/useTestSeed)
26 | file-model (FileDataModel. (File. file))
27 | evaluator (AverageAbsoluteDifferenceRecommenderEvaluator.)
28 | ;; evaluator (RMSRecommenderEvaluator.)
29 | builder (reify RecommenderBuilder
30 | (buildRecommender [_this model]
31 | (let [similarity (PearsonCorrelationSimilarity. model)
32 | neighborhood (NearestNUserNeighborhood. 2 similarity model)
33 | recommender (GenericUserBasedRecommender. model
34 | neighborhood
35 | similarity)]
36 | recommender)))]
37 | (.evaluate evaluator builder nil file-model 0.7 1.0)))
38 |
39 |
40 | (defn precision [file]
41 | (let [_ (RandomUtils/useTestSeed)
42 | file-model (FileDataModel. (File. file))
43 | evaluator (GenericRecommenderIRStatsEvaluator.)
44 | builder (reify RecommenderBuilder
45 | (buildRecommender [_this model]
46 | (let [similarity (PearsonCorrelationSimilarity. model)
47 | neighborhood (NearestNUserNeighborhood. 2 similarity model)
48 | recommender (GenericUserBasedRecommender. model
49 | neighborhood
50 | similarity)]
51 | recommender)))]
52 | (.evaluate evaluator builder nil file-model nil 2
53 | GenericRecommenderIRStatsEvaluator/CHOOSE_THRESHOLD
54 | 1.0)))
55 |
56 |
57 |
58 | (defn -main []
59 | (def items (recommend "resources/intro.csv"))
60 | (def stats (precision "resources/intro.csv"))
61 |
62 | (doseq [i items] (println (str "Recommended item: " (.getItemID i) " Value: " (.getValue i))))
63 | (println (str "Evaluation: " (evaluator "resources/intro.csv")))
64 | (println (str "Precision: " (.getPrecision stats) " Recall: " (.getRecall stats))))
65 |
66 |
67 |
--------------------------------------------------------------------------------
/apache-spark/flambo-gaming-stack-exchange/src/flambo_gaming_stack_exchange/core.clj:
--------------------------------------------------------------------------------
1 | (ns flambo-gaming-stack-exchange.core
2 | (:require [flambo.conf :as conf]
3 | [flambo.api :as f]
4 | [flambo.sql :as sql])
5 | (:import [org.apache.spark.sql Column]
6 | [org.apache.commons.codec.binary Hex])
7 | (:gen-class))
8 |
9 | (defn string-array
10 | "Helper function for java interop."
11 | [& strings]
12 | (into-array String strings))
13 |
14 | (defn column-array
15 | "Helper function for java interop."
16 | [& columns]
17 | (into-array Column columns))
18 |
19 | (defn build-sql-context
20 | "Returns a Spark SQLContext"
21 | [app-name]
22 | (let [c (-> (conf/spark-conf)
23 | (conf/master "local[*]")
24 | (conf/app-name app-name))
25 | sc (f/spark-context c)]
26 | (sql/sql-context sc)))
27 |
28 | (defn hash-string
29 | "Returns a hexidecimal encoded SHA-1 hash of a string"
30 | [data]
31 | (-> (java.security.MessageDigest/getInstance "SHA-1")
32 | (.digest (.getBytes data))
33 | (Hex/encodeHexString)))
34 |
35 |
36 | "Hash name in a row with the schema [name reputation], returning a
37 | new vector with the name hashed."
38 | (f/defsparkfn hash-name
39 | [row]
40 | (let [[name reputation] row
41 | hashed-name (hash-string name)]
42 | [hashed-name reputation]))
43 |
44 |
45 | (defn -main [& args]
46 | (let [home (java.lang.System/getenv "HOME")
47 | sql-ctx (build-sql-context "Stack Exchange Queries")
48 |
49 | ;; Read in the users Parquet file
50 | users (sql/parquet-file sql-ctx (string-array (str home "/data/gaming-stack-exchange-warehouse/users.parquet")))
51 |
52 | ;; This is one way to query a DataFrame.
53 | query (-> users
54 | (.select (column-array (.col users "name") (.col users "reputation")))
55 | (.filter "reputation > 30000")
56 | (.orderBy (column-array (-> users
57 | (.col "reputation")
58 | (.desc))))
59 | (.limit 10))
60 |
61 | ;; This is another way to run the same query, but to do it this way
62 | ;; we must first register any tables we will be using.
63 | _ (sql/register-temp-table users "users")
64 | sql-query (sql/sql sql-ctx "SELECT name, reputation FROM users WHERE reputation > 30000 ORDER BY reputation DESC LIMIT 10")
65 |
66 | ;; We can also turn a DataFrame to an RDD and use Flambo functions.
67 | ;; Here we hash the users name prior to displaying it.
68 | rdd-query (-> sql-query
69 | (.toJavaRDD)
70 | (f/map sql/row->vec)
71 | (f/map hash-name)
72 | (f/foreach (f/fn [x] (println x))))
73 |
74 | ;; Create and register the posts table
75 | posts (sql/parquet-file sql-ctx (string-array (str home "/data/gaming-stack-exchange-warehouse/posts.parquet")))
76 | _ (sql/register-temp-table posts "posts")
77 |
78 | ;; Top 10 users by number of questions questions asked about the
79 | ;; game Dwarf Fortress.
80 | df-query (sql/sql sql-ctx "SELECT u.name, count(1) as cnt FROM users u, posts p WHERE p.tags LIKE '%dwarf-fortress%' AND u.id = p.ownerId GROUP BY u.name ORDER BY cnt DESC LIMIT 10")]
81 | (.show sql-query)
82 | (.show df-query)))
83 |
--------------------------------------------------------------------------------
/apache-kafka/hello-world-kafka/src/hello_world_kafka/core.clj:
--------------------------------------------------------------------------------
1 | (ns hello-world-kafka.core
2 | (:import (kafka.consumer Consumer ConsumerConfig KafkaStream)
3 | (kafka.producer KeyedMessage ProducerConfig)
4 | (kafka.javaapi.producer Producer)
5 | (java.util Properties)
6 | (java.util.concurrent Executors))
7 | (:gen-class))
8 |
9 |
10 | ;; ---------- Producer ----------
11 | (defn- create-producer
12 | "Creates a producer that can be used to send a message to Kafka"
13 | [brokers]
14 | (let [props (Properties.)]
15 | (doto props
16 | (.put "metadata.broker.list" brokers)
17 | (.put "serializer.class" "kafka.serializer.StringEncoder")
18 | (.put "request.required.acks" "1"))
19 | (Producer. (ProducerConfig. props))))
20 |
21 | (defn- send-to-producer
22 | "Send a string message to Kafka"
23 | [producer topic message]
24 | (let [data (KeyedMessage. topic nil message)]
25 | (.send producer data)))
26 |
27 |
28 | ;; ---------- Consumer ----------
29 | (defrecord KafkaMessage [topic offset partition key value-bytes])
30 |
31 | (defn- create-consumer-config
32 | "Returns a configuration for a Kafka client."
33 | []
34 | (let [props (Properties.)]
35 | (doto props
36 | (.put "zookeeper.connect" "127.0.0.1:2181")
37 | (.put "group.id" "group1")
38 | (.put "zookeeper.session.timeout.ms" "400")
39 | (.put "zookeeper.sync.time.ms" "200")
40 | (.put "auto.commit.interval.ms" "1000"))
41 | (ConsumerConfig. props)))
42 |
43 | (defn- consume-messages
44 | "Continually consume messages from a Kafka topic and write message value to stdout."
45 | [stream thread-num]
46 | (let [it (.iterator ^KafkaStream stream)]
47 | (println (str "Starting thread " thread-num))
48 | (while (.hasNext it)
49 | (as-> (.next it) msg
50 | (KafkaMessage. (.topic msg) (.offset msg) (.partition msg) (.key msg) (.message msg))
51 | (println (str "Received on thread " thread-num ": " (String. (:value-bytes msg))))))
52 | (println (str "Stopping thread " thread-num))))
53 |
54 | (defn- start-consumer-threads
55 | "Start a thread for each stream."
56 | [thread-pool kafka-streams]
57 | (loop [streams kafka-streams
58 | index 0]
59 | (when (seq streams)
60 | (.submit thread-pool (cast Callable #(consume-messages (first streams) index)))
61 | (recur (rest streams) (inc index)))))
62 |
63 |
64 | ;; ---------- Application ----------
65 | ;; $ lein trampoline run random_numbers 2
66 | (defn -main
67 | "Pull messages from a Kafka topic using the High Level Consumer"
68 | [topic num-threads]
69 | (let [consumer (Consumer/createJavaConsumerConnector (create-consumer-config))
70 | consumer-map (.createMessageStreams consumer {topic (Integer/parseInt num-threads)})
71 | kafka-streams (.get consumer-map topic)
72 | thread-pool (Executors/newFixedThreadPool (Integer/parseInt num-threads))
73 | producer (create-producer "127.0.0.1:9092")]
74 |
75 | ;; Clean up on a SIGTERM or Ctrl-C
76 | (.addShutdownHook (Runtime/getRuntime)
77 | (Thread. #(do (.shutdown consumer)
78 | (.shutdown thread-pool))))
79 |
80 | ;; Connect and start listening for messages on Kafka
81 | (start-consumer-threads thread-pool kafka-streams)
82 |
83 | ;; Send a random int to Kafka every 500 milliseconds
84 | (loop []
85 | (let [num (str (rand-int 1000))]
86 | (println (str "Sending to Kafka topic " topic ": " num))
87 | (send-to-producer producer topic num)
88 | (Thread/sleep 500)
89 | (recur)))))
90 |
--------------------------------------------------------------------------------
/weka/k-means/src/k_means/core.clj:
--------------------------------------------------------------------------------
1 | (ns k-means.core
2 | (:require [clojure.string :as str])
3 | (:import
4 | [weka.core EuclideanDistance]
5 | [weka.core.converters ArffLoader]
6 | [weka.clusterers SimpleKMeans]
7 | [weka.filters Filter]
8 | [weka.filters.unsupervised.attribute Remove]
9 | [java.io File]))
10 |
11 | (defn random-seed [seed]
12 | (if (nil? seed)
13 | (.intValue (.getTime (java.util.Date.)))
14 | seed))
15 |
16 |
17 | (defn ->options
18 | [& opts]
19 | (into-array
20 | String
21 | (map str (flatten (remove nil? opts)))))
22 |
23 |
24 |
25 | (defn analysis-parameter
26 | [parameter]
27 | (condp = (count parameter)
28 | ;; [option-string variable-name default-value]
29 | ;; ["-N" k 2]
30 | 3 `[~(first parameter) ~(second parameter)]
31 |
32 | ;; [option-string variable-name default-value flag]
33 | ;; ["-V" verbose false :flag-true]
34 | 4 (condp = (last parameter)
35 | :flag-true `[(when ~(second parameter)
36 | ~(first parameter))]
37 | :flag-false `[(when-not ~(second parameter)
38 | ~(first parameter))]
39 | :not-nil `[(when-not (nil? ~(second parameter))
40 | [~(first parameter) ~(second parameter)])]
41 | :seq (let [name (second parameter)]
42 | (apply concat
43 | (map-indexed (fn [i flag] `[~flag (nth ~name ~i)])
44 | (first parameter))))
45 |
46 | `[~(first parameter)
47 | (~(last parameter) ~(second parameter))])
48 |
49 | ;; [option-string variable-name default-value flag option]
50 | ;; ["-B" distance-of :node-length :flag-equal :branch-length]
51 | 5 (condp = (nth parameter 3)
52 | :flag-equal `[(when (= ~(second parameter) ~(last parameter))
53 | ~(first parameter))]
54 |
55 | :predicate `[(when ~(last parameter)
56 | [~(first parameter) ~(second parameter)])])))
57 |
58 |
59 | (defmacro defanalysis
60 | ([a-name a-class a-method parameters]
61 | `(defn ~a-name
62 | [dataset# &
63 | ;; The variable-names and default-values are used here
64 | ;; to build the function's parameter list.
65 | {:keys ~(mapv second parameters)
66 | :or ~(into {}
67 | (map #(vector (second %) (nth % 2))
68 | parameters))}]
69 | ;; The options, flags, and predicats are used to
70 | ;; construct the options list.
71 | (let [options# (->options ~@(mapcat analysis-parameter
72 | parameters))]
73 | ;; The algorithm's class and invocation function
74 | ;; are used here to actually perform the
75 | ;; processing.
76 | (doto (new ~a-class)
77 | (.setOptions options#)
78 | (. ~a-method dataset#))))))
79 |
80 |
81 | (defanalysis
82 | k-means SimpleKMeans buildClusterer
83 | [["-N" k 2]
84 | ["-I" max-iterations 100]
85 | ["-V" verbose false :flag-true]
86 | ["-S" seed 1 random-seed]
87 | ["-A" distance EuclideanDistance .getName]])
88 |
89 |
90 | (defn load-arff
91 | ([filename]
92 | (.getDataSet (doto (ArffLoader.)
93 | (.setFile (File. filename))))))
94 |
95 |
96 | (defn attr-n
97 | [instances attr-name]
98 | (->> instances
99 | (.numAttributes)
100 | range
101 | (map #(vector % (.. instances (attribute %) name)))
102 | (filter #(= (second %) (name attr-name)))
103 | ffirst))
104 |
105 |
106 | (defn filter-attributes
107 | ([dataset remove-attrs]
108 | (let [attrs (map inc (map (partial attr-n dataset) remove-attrs))
109 | options (->options "-R"
110 | (str/join \, (map str attrs)))
111 | rm (doto (Remove.)
112 | (.setOptions options)
113 | (.setInputFormat dataset))]
114 | (Filter/useFilter dataset rm))))
115 |
116 |
117 |
118 | (defn -main []
119 | (let [iris (load-arff "../data/iris.arff")
120 | iris-petal (filter-attributes iris [:sepallength :sepalwidth :class])
121 | km (k-means iris-petal :k 3)]
122 | (println km)
123 | (println)
124 | (println (type km))
125 | (println (.getSquaredError km))))
126 |
--------------------------------------------------------------------------------
/incanter/working-with-datasets/src/incanterexample/core.clj:
--------------------------------------------------------------------------------
1 | (ns incanterexample.core
2 | (:require
3 | [clojure.data.csv :as csv]
4 | [clojure.data.json :as json]
5 | [clojure.java.io :as java-io]
6 | [clojure.set :as clj-set])
7 | (:use [incanter core io stats charts datasets]))
8 |
9 |
10 | (defn load-incanter-dataset []
11 | (let [iris (get-dataset :iris)]
12 | (println (col-names iris))
13 | ; [:Sepal.Length :Sepal.Width :Petal.Length :Petal.Width :Species]
14 |
15 | (println (nrow iris)) ; 150
16 | (println (set ($ :Species iris))) ; {versicolor virginica setosa}
17 | ))
18 |
19 |
20 | (defn load-clojure-data-structure-into-dataset []
21 | (let [matrix-set (to-dataset [[1 2 3] [4 5 6]])
22 | map-set (to-dataset {:a 1 :b 2 :c 3})
23 | maps-set (to-dataset [{:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6}])
24 | matrix-set-2 (dataset [:a :b :c] [[1 2 3] [4 5 6]])]
25 |
26 | (println (nrow matrix-set)) ; 2
27 | (println (col-names matrix-set)) ; [:col-0 :col-1 :col-2]
28 |
29 | (println (nrow map-set)) ; 1
30 | (println (col-names map-set)) ; [:a :b :c]
31 |
32 | (println (nrow maps-set)) ; 2
33 | (println (col-names maps-set)) ; [:a :c :b]
34 |
35 | (println (nrow matrix-set-2)) ; 2
36 | (println (col-names matrix-set-2)) ; [:a :b :c]
37 | ))
38 |
39 |
40 | (defn view-dataset []
41 | (let [iris (get-dataset :iris)]
42 | (view iris)))
43 |
44 |
45 | (defn convert-dataset-to-matrices []
46 | (let [data-file "data/all_160_in_51.P35.csv"
47 | va-data (read-dataset data-file :header true)
48 | va-matrix (to-matrix ($ [:POP100 :HU100 :P035001] va-data))]
49 |
50 | ; We can treat the matrix as a clojure seq
51 | (println (first va-matrix))
52 | (println (take 2 va-matrix))
53 | (println (count va-matrix))
54 |
55 | ; Get sum of each column in the matrix
56 | (println (reduce plus va-matrix))))
57 |
58 |
59 | (defn using-infix-formulas []
60 | (let [data-file "data/all_160_in_51.P35.csv"
61 | va-data (read-dataset data-file :header true)
62 | va-matrix (to-matrix ($ [:POP100 :HU100 :P035001] va-data))]
63 | (println ($= 7 * 4)) ; 28
64 | (println ($= 7 * 4 + 3)) ; 31
65 |
66 | (println ($= va-matrix * 4))
67 | (println ($= (first va-matrix) * 4))
68 |
69 | ; Take mean of each column
70 | (println ($= (reduce plus va-matrix) / (count va-matrix)))))
71 |
72 | (defn selecting-columns-and-rows []
73 | (let [data-file "data/all_160.P3.csv"
74 | race-data (read-dataset data-file :header true)]
75 |
76 | ;; $ is a wraper over incanter's sel function
77 | ;; We can use it to select columns
78 | (println ($ :POP100 race-data))
79 | (println ($ [:STATE :POP100 :POP100.2000] race-data))
80 |
81 | ;; And select rows
82 | (println ($ 0 :all race-data)) ; one row
83 | (println ($ [0 1 2 3] :all race-data)) ; multiple rows
84 |
85 | ;; And select specific columns and rows
86 | (println ($ 0 [:STATE :POP100] race-data)) ; 1 row, 2 cols
87 | (println ($ [0 1 2 3] [:STATE :POP100] race-data))))
88 |
89 |
90 | (defn filtering-with-where []
91 | (let [data-file "data/all_160_in_51.P35.csv"
92 | va-data (read-dataset data-file :header true)
93 | richmond ($where {:NAME "Richmond city"} va-data)
94 | small-towns ($where {:POP100 {:lte 1000}} va-data)
95 | medium-towns ($where {:POP100 {:gt 1000 :lt 40000}} va-data)
96 | random-half ($where {:GEOID {:$fn (fn [_] (< (rand) 0.5))}} va-data)
97 | ]
98 |
99 | (println richmond) ; city of richmond
100 | (println small-towns) ; cities with population less than or equal 1000
101 | (println (nrow small-towns)) ; 232
102 | (println ($ [0 1 2] :all small-towns))
103 | (println medium-towns) ; population greater than 1,000, less than 4,0000
104 | (println (nrow va-data))
105 | (println (nrow random-half)) ; random selection of about half the lines
106 | ))
107 |
108 | (defn grouping-data-with-group-by []
109 | (let [data-file "data/all_160.P3.csv"
110 | race-data (read-dataset data-file :header true)
111 | by-state ($group-by :STATE race-data)]
112 |
113 | (println (take 5 (keys by-state)))
114 | ; ({:STATE 29} {:STATE 28} {:STATE 31} {:STATE 30} {:STATE 25})
115 |
116 | ; We can get the data for a state out
117 | (println ($ [0 1 2 3] :all (by-state {:STATE 30}))) ; first 4 rows
118 | ))
119 |
120 |
121 | (defn saving-to-csv-and-json []
122 | (let [data-file "data/all_160.P3.csv"
123 | race-data (read-dataset data-file :header true)
124 | census2010 ($ [:STATE :NAME :POP100 :P003002] race-data)]
125 |
126 | ;; Write to CSV formatted
127 | (with-open [f-out (java-io/writer "data/census2010.csv")]
128 | ;; Write column names
129 | (csv/write-csv f-out [(map name (col-names census2010))])
130 | ;; Then write data
131 | (csv/write-csv f-out (to-list census2010)))
132 |
133 | ;; Write to JSON formatted file
134 | (with-open [f-out (java-io/writer "data/census2010.json")]
135 | (json/write (:rows census2010) f-out))))
136 |
137 |
138 |
139 | (defn dedup-second [a b id-col]
140 | (let [a-cols (set (col-names a))]
141 | (conj (filter #(not (contains? a-cols %)) (col-names b)) id-col)))
142 |
143 |
144 | (defn joining-multiple-datasets []
145 | (let [family-data (read-dataset "data/all_160_in_51.P35.csv" :header true)
146 | racial-data (read-dataset "data/all_160_in_51.P3.csv" :header true)
147 | racial-short ($ (vec (dedup-second family-data racial-data :GEOID)) racial-data)
148 | all-data ($join [:GEOID :GEOID] family-data racial-short)]
149 |
150 | ;; #{:SUMLEV :HU100.2000 :HU100 :NAME :GEOID :NECTA :CBSA :CSA :POP100.2000 :CNECTA :POP100 :COUNTY :STATE}
151 | (println (clj-set/intersection
152 | (set (col-names family-data))
153 | (set (col-names racial-data))))
154 |
155 | (println (col-names all-data))
156 |
157 | (println (nrow family-data)) ; 591
158 | (println (nrow racial-data)) ; 591
159 | (println (nrow racial-short)) ; 591
160 | (println (nrow all-data)) ; 591
161 |
162 | ))
163 |
164 |
165 |
166 | (defn -main []
167 | (load-incanter-dataset)
168 | ;(load-clojure-data-structure-into-dataset)
169 | ;(view-dataset)
170 | ;(convert-dataset-to-matrices)
171 | ;(using-infix-formulas)
172 | ;(selecting-columns-and-rows)
173 | ;(filtering-with-where)
174 | ;(grouping-data-with-group-by)
175 | ;(saving-to-csv-and-json)
176 | ;(joining-multiple-datasets)
177 | )
178 |
179 |
180 |
--------------------------------------------------------------------------------
/incanter/graphs/src/incanterexample/core.clj:
--------------------------------------------------------------------------------
1 | (ns incanterexample.core
2 | (:require
3 | [incanter.charts :as c]
4 | [incanter.core :as i]
5 | [incanter.io :as iio]
6 | [incanter.latex :as latex]
7 | [incanter.stats :as s]
8 | [incanter.datasets])
9 | (:import
10 | org.jfree.chart.renderer.category.LayeredBarRenderer
11 | org.jfree.util.SortOrder))
12 |
13 | ;; Can use :jvm-opts ["-Djava.awt.headless=true"]
14 | ;; in project.clj to not display a window
15 |
16 | (defn scatter-plot []
17 | (let [iris (incanter.datasets/get-dataset :iris)
18 | iris-petal-scatter (c/scatter-plot
19 | (i/sel iris :cols :Petal.Width)
20 | (i/sel iris :cols :Petal.Length)
21 | :title "Irises: Petal Width by Petal Length"
22 | :x-label "Width (cm)"
23 | :y-label "Length (cm)")]
24 | (i/view iris-petal-scatter)))
25 |
26 |
27 | (defn bar-chart []
28 | (let [chick-weight (incanter.datasets/get-dataset :chick-weight)
29 | chick-weight-bar (i/with-data
30 | (i/$order :Diet :asc
31 | (i/$rollup :sum :weight :Diet chick-weight))
32 | (c/bar-chart
33 | (i/$map int :Diet)
34 | :weight
35 | :title "Chick Weight"
36 | :x-label "Diet"
37 | :y-label "Weight"))]
38 | (i/view chick-weight-bar)))
39 |
40 | (defn bar-chart-non-numeric-data
41 | "Display a chart showing how many items are in each category"
42 | []
43 | (let [shrooms (iio/read-dataset "data/agaricus-lepiota.data" :header true)
44 | shroom-cap-bar (i/with-data
45 | (->> shrooms
46 | (i/$group-by :cap-shape)
47 | (map (fn [[k v]] (assoc k :count (i/nrow v))))
48 | (sort-by :cap-shape)
49 | i/to-dataset)
50 | (c/bar-chart :cap-shape :count))]
51 | (i/view shroom-cap-bar)))
52 |
53 | (defn histogram []
54 | (let [iris (incanter.datasets/get-dataset :iris)
55 | iris-petal-length-hist (c/histogram
56 | (i/sel iris :cols :Petal.Length)
57 | :title "Iris Petal Lengths"
58 | :x-label "cm"
59 | :nbins 20)]
60 | (i/view iris-petal-length-hist)))
61 |
62 | (defn function-plot
63 | []
64 | (let [f-plot (c/function-plot
65 | #(i/sin %)
66 | 0.0
67 | 10.0
68 | :title "Sine function"
69 | :y-label "Sine")]
70 | (i/view f-plot)))
71 |
72 |
73 | (defn function-plot-with-latex
74 | []
75 | (let [f-plot (c/function-plot
76 | #(i/sin %)
77 | 0.0
78 | 10.0
79 | :title "Sine function"
80 | :y-label "Sine")
81 | equation "f(x)={\\sin x}"]
82 | (latex/add-latex-subtitle f-plot equation)
83 | (i/view f-plot)))
84 |
85 | (defn scatter-chart-with-lines
86 | "Scatter chart with a linear regression shown"
87 | []
88 | (let [iris (incanter.datasets/get-dataset :iris)
89 | iris-petal-scatter (c/scatter-plot
90 | (i/sel iris :cols :Petal.Width)
91 | (i/sel iris :cols :Petal.Length)
92 | :title "Irises: Petal Width by Petal Length"
93 | :x-label "Width (cm)"
94 | :y-label "Length (cm)")
95 | iris-petal-lm (s/linear-model
96 | (i/sel iris :cols :Petal.Length)
97 | (i/sel iris :cols :Petal.Width)
98 | :intercept false)]
99 | (c/add-lines
100 | iris-petal-scatter
101 | (i/sel iris :cols :Petal.Width)
102 | (:fitted iris-petal-lm)
103 | :series-label "Linear Relationship")
104 | (i/view iris-petal-scatter)))
105 |
106 | (defn customizing-with-jfreechart []
107 | (let [iris (incanter.datasets/get-dataset :iris)
108 | iris-dimensions (i/with-data
109 | iris
110 | (doto (c/bar-chart
111 | :Species
112 | :Petal.Width
113 | :title "iris dimensions"
114 | :x-label "species"
115 | :y-label "cm"
116 | :series-label "petal width"
117 | :legend true)
118 | (c/add-categories
119 | :Species :Sepal.Width
120 | :series-label "sepal width")
121 | (c/add-categories
122 | :Species :Petal.Length
123 | :series-label "petal length")
124 | (c/add-categories
125 | :Species :Sepal.Length
126 | :series-label "sepal length")))]
127 | (doto (.getPlot iris-dimensions)
128 | (.setRenderer (doto (LayeredBarRenderer.)
129 | (.setDrawBarOutline false)))
130 | (.setRowRenderingOrder SortOrder/DESCENDING))
131 | (i/view iris-dimensions)))
132 |
133 | (defn save-graph-to-png []
134 | (let [iris (incanter.datasets/get-dataset :iris)
135 | iris-petal-scatter (c/scatter-plot
136 | (i/sel iris :cols :Petal.Width)
137 | (i/sel iris :cols :Petal.Length)
138 | :title "Irises: Petal Width by Petal Length"
139 | :x-label "Width (cm)"
140 | :y-label "Length (cm)")]
141 | (i/save iris-petal-scatter "iris-petal-scatter.png")))
142 |
143 |
144 | (defn graph-multidimensional-data-with-pca []
145 | (let [race-data (iio/read-dataset "data/all_160.P3.csv" :header true)
146 | fields [:P003002 :P003003 :P003004 :P003005 :P003006 :P003007 :P003008]
147 | race-by-state (reduce #(i/$join [:STATE :STATE] %1 %2)
148 | (map #(i/$rollup :sum % :STATE race-data)
149 | fields))
150 | race-by-state-matrix (i/to-matrix race-by-state)
151 | x (i/sel race-by-state-matrix :cols (range 1 8))
152 | pca (s/principal-components x)
153 | components (:rotation pca)
154 | pc1 (i/sel components :cols 0)
155 | pc2 (i/sel components :cols 1)
156 | x1 (i/mmult x pc1)
157 | x2 (i/mmult x pc2)
158 | pca-plot (c/scatter-plot
159 | x1 x2
160 | :x-label "PC1"
161 | :y-label "PC2"
162 | :title "Census Race Data by State")]
163 | (i/view pca-plot)))
164 |
165 |
166 | (defn -main []
167 | ;(scatter-plot)
168 | ;(bar-chart)
169 | ;(bar-chart-non-numeric-data)
170 | ;(histogram)
171 | ;(function-plot)
172 | ;(function-plot-with-latex)
173 | ;(scatter-chart-lines-with)
174 | ;(customizing-with-jfreechart)
175 | ;(save-graph-to-png)
176 | (graph-multidimensional-data-with-pca)
177 | )
178 |
179 |
180 |
--------------------------------------------------------------------------------
/weka/data/iris.arff:
--------------------------------------------------------------------------------
1 | % 1. Title: Iris Plants Database
2 | %
3 | % 2. Sources:
4 | % (a) Creator: R.A. Fisher
5 | % (b) Donor: Michael Marshall (MARSHALL%PLU@io.arc.nasa.gov)
6 | % (c) Date: July, 1988
7 | %
8 | % 3. Past Usage:
9 | % - Publications: too many to mention!!! Here are a few.
10 | % 1. Fisher,R.A. "The use of multiple measurements in taxonomic problems"
11 | % Annual Eugenics, 7, Part II, 179-188 (1936); also in "Contributions
12 | % to Mathematical Statistics" (John Wiley, NY, 1950).
13 | % 2. Duda,R.O., & Hart,P.E. (1973) Pattern Classification and Scene Analysis.
14 | % (Q327.D83) John Wiley & Sons. ISBN 0-471-22361-1. See page 218.
15 | % 3. Dasarathy, B.V. (1980) "Nosing Around the Neighborhood: A New System
16 | % Structure and Classification Rule for Recognition in Partially Exposed
17 | % Environments". IEEE Transactions on Pattern Analysis and Machine
18 | % Intelligence, Vol. PAMI-2, No. 1, 67-71.
19 | % -- Results:
20 | % -- very low misclassification rates (0% for the setosa class)
21 | % 4. Gates, G.W. (1972) "The Reduced Nearest Neighbor Rule". IEEE
22 | % Transactions on Information Theory, May 1972, 431-433.
23 | % -- Results:
24 | % -- very low misclassification rates again
25 | % 5. See also: 1988 MLC Proceedings, 54-64. Cheeseman et al's AUTOCLASS II
26 | % conceptual clustering system finds 3 classes in the data.
27 | %
28 | % 4. Relevant Information:
29 | % --- This is perhaps the best known database to be found in the pattern
30 | % recognition literature. Fisher's paper is a classic in the field
31 | % and is referenced frequently to this day. (See Duda & Hart, for
32 | % example.) The data set contains 3 classes of 50 instances each,
33 | % where each class refers to a type of iris plant. One class is
34 | % linearly separable from the other 2; the latter are NOT linearly
35 | % separable from each other.
36 | % --- Predicted attribute: class of iris plant.
37 | % --- This is an exceedingly simple domain.
38 | %
39 | % 5. Number of Instances: 150 (50 in each of three classes)
40 | %
41 | % 6. Number of Attributes: 4 numeric, predictive attributes and the class
42 | %
43 | % 7. Attribute Information:
44 | % 1. sepal length in cm
45 | % 2. sepal width in cm
46 | % 3. petal length in cm
47 | % 4. petal width in cm
48 | % 5. class:
49 | % -- Iris Setosa
50 | % -- Iris Versicolour
51 | % -- Iris Virginica
52 | %
53 | % 8. Missing Attribute Values: None
54 | %
55 | % Summary Statistics:
56 | % Min Max Mean SD Class Correlation
57 | % sepal length: 4.3 7.9 5.84 0.83 0.7826
58 | % sepal width: 2.0 4.4 3.05 0.43 -0.4194
59 | % petal length: 1.0 6.9 3.76 1.76 0.9490 (high!)
60 | % petal width: 0.1 2.5 1.20 0.76 0.9565 (high!)
61 | %
62 | % 9. Class Distribution: 33.3% for each of 3 classes.
63 |
64 | @RELATION iris
65 |
66 | @ATTRIBUTE sepallength REAL
67 | @ATTRIBUTE sepalwidth REAL
68 | @ATTRIBUTE petallength REAL
69 | @ATTRIBUTE petalwidth REAL
70 | @ATTRIBUTE class {Iris-setosa,Iris-versicolor,Iris-virginica}
71 |
72 | @DATA
73 | 5.1,3.5,1.4,0.2,Iris-setosa
74 | 4.9,3.0,1.4,0.2,Iris-setosa
75 | 4.7,3.2,1.3,0.2,Iris-setosa
76 | 4.6,3.1,1.5,0.2,Iris-setosa
77 | 5.0,3.6,1.4,0.2,Iris-setosa
78 | 5.4,3.9,1.7,0.4,Iris-setosa
79 | 4.6,3.4,1.4,0.3,Iris-setosa
80 | 5.0,3.4,1.5,0.2,Iris-setosa
81 | 4.4,2.9,1.4,0.2,Iris-setosa
82 | 4.9,3.1,1.5,0.1,Iris-setosa
83 | 5.4,3.7,1.5,0.2,Iris-setosa
84 | 4.8,3.4,1.6,0.2,Iris-setosa
85 | 4.8,3.0,1.4,0.1,Iris-setosa
86 | 4.3,3.0,1.1,0.1,Iris-setosa
87 | 5.8,4.0,1.2,0.2,Iris-setosa
88 | 5.7,4.4,1.5,0.4,Iris-setosa
89 | 5.4,3.9,1.3,0.4,Iris-setosa
90 | 5.1,3.5,1.4,0.3,Iris-setosa
91 | 5.7,3.8,1.7,0.3,Iris-setosa
92 | 5.1,3.8,1.5,0.3,Iris-setosa
93 | 5.4,3.4,1.7,0.2,Iris-setosa
94 | 5.1,3.7,1.5,0.4,Iris-setosa
95 | 4.6,3.6,1.0,0.2,Iris-setosa
96 | 5.1,3.3,1.7,0.5,Iris-setosa
97 | 4.8,3.4,1.9,0.2,Iris-setosa
98 | 5.0,3.0,1.6,0.2,Iris-setosa
99 | 5.0,3.4,1.6,0.4,Iris-setosa
100 | 5.2,3.5,1.5,0.2,Iris-setosa
101 | 5.2,3.4,1.4,0.2,Iris-setosa
102 | 4.7,3.2,1.6,0.2,Iris-setosa
103 | 4.8,3.1,1.6,0.2,Iris-setosa
104 | 5.4,3.4,1.5,0.4,Iris-setosa
105 | 5.2,4.1,1.5,0.1,Iris-setosa
106 | 5.5,4.2,1.4,0.2,Iris-setosa
107 | 4.9,3.1,1.5,0.1,Iris-setosa
108 | 5.0,3.2,1.2,0.2,Iris-setosa
109 | 5.5,3.5,1.3,0.2,Iris-setosa
110 | 4.9,3.1,1.5,0.1,Iris-setosa
111 | 4.4,3.0,1.3,0.2,Iris-setosa
112 | 5.1,3.4,1.5,0.2,Iris-setosa
113 | 5.0,3.5,1.3,0.3,Iris-setosa
114 | 4.5,2.3,1.3,0.3,Iris-setosa
115 | 4.4,3.2,1.3,0.2,Iris-setosa
116 | 5.0,3.5,1.6,0.6,Iris-setosa
117 | 5.1,3.8,1.9,0.4,Iris-setosa
118 | 4.8,3.0,1.4,0.3,Iris-setosa
119 | 5.1,3.8,1.6,0.2,Iris-setosa
120 | 4.6,3.2,1.4,0.2,Iris-setosa
121 | 5.3,3.7,1.5,0.2,Iris-setosa
122 | 5.0,3.3,1.4,0.2,Iris-setosa
123 | 7.0,3.2,4.7,1.4,Iris-versicolor
124 | 6.4,3.2,4.5,1.5,Iris-versicolor
125 | 6.9,3.1,4.9,1.5,Iris-versicolor
126 | 5.5,2.3,4.0,1.3,Iris-versicolor
127 | 6.5,2.8,4.6,1.5,Iris-versicolor
128 | 5.7,2.8,4.5,1.3,Iris-versicolor
129 | 6.3,3.3,4.7,1.6,Iris-versicolor
130 | 4.9,2.4,3.3,1.0,Iris-versicolor
131 | 6.6,2.9,4.6,1.3,Iris-versicolor
132 | 5.2,2.7,3.9,1.4,Iris-versicolor
133 | 5.0,2.0,3.5,1.0,Iris-versicolor
134 | 5.9,3.0,4.2,1.5,Iris-versicolor
135 | 6.0,2.2,4.0,1.0,Iris-versicolor
136 | 6.1,2.9,4.7,1.4,Iris-versicolor
137 | 5.6,2.9,3.6,1.3,Iris-versicolor
138 | 6.7,3.1,4.4,1.4,Iris-versicolor
139 | 5.6,3.0,4.5,1.5,Iris-versicolor
140 | 5.8,2.7,4.1,1.0,Iris-versicolor
141 | 6.2,2.2,4.5,1.5,Iris-versicolor
142 | 5.6,2.5,3.9,1.1,Iris-versicolor
143 | 5.9,3.2,4.8,1.8,Iris-versicolor
144 | 6.1,2.8,4.0,1.3,Iris-versicolor
145 | 6.3,2.5,4.9,1.5,Iris-versicolor
146 | 6.1,2.8,4.7,1.2,Iris-versicolor
147 | 6.4,2.9,4.3,1.3,Iris-versicolor
148 | 6.6,3.0,4.4,1.4,Iris-versicolor
149 | 6.8,2.8,4.8,1.4,Iris-versicolor
150 | 6.7,3.0,5.0,1.7,Iris-versicolor
151 | 6.0,2.9,4.5,1.5,Iris-versicolor
152 | 5.7,2.6,3.5,1.0,Iris-versicolor
153 | 5.5,2.4,3.8,1.1,Iris-versicolor
154 | 5.5,2.4,3.7,1.0,Iris-versicolor
155 | 5.8,2.7,3.9,1.2,Iris-versicolor
156 | 6.0,2.7,5.1,1.6,Iris-versicolor
157 | 5.4,3.0,4.5,1.5,Iris-versicolor
158 | 6.0,3.4,4.5,1.6,Iris-versicolor
159 | 6.7,3.1,4.7,1.5,Iris-versicolor
160 | 6.3,2.3,4.4,1.3,Iris-versicolor
161 | 5.6,3.0,4.1,1.3,Iris-versicolor
162 | 5.5,2.5,4.0,1.3,Iris-versicolor
163 | 5.5,2.6,4.4,1.2,Iris-versicolor
164 | 6.1,3.0,4.6,1.4,Iris-versicolor
165 | 5.8,2.6,4.0,1.2,Iris-versicolor
166 | 5.0,2.3,3.3,1.0,Iris-versicolor
167 | 5.6,2.7,4.2,1.3,Iris-versicolor
168 | 5.7,3.0,4.2,1.2,Iris-versicolor
169 | 5.7,2.9,4.2,1.3,Iris-versicolor
170 | 6.2,2.9,4.3,1.3,Iris-versicolor
171 | 5.1,2.5,3.0,1.1,Iris-versicolor
172 | 5.7,2.8,4.1,1.3,Iris-versicolor
173 | 6.3,3.3,6.0,2.5,Iris-virginica
174 | 5.8,2.7,5.1,1.9,Iris-virginica
175 | 7.1,3.0,5.9,2.1,Iris-virginica
176 | 6.3,2.9,5.6,1.8,Iris-virginica
177 | 6.5,3.0,5.8,2.2,Iris-virginica
178 | 7.6,3.0,6.6,2.1,Iris-virginica
179 | 4.9,2.5,4.5,1.7,Iris-virginica
180 | 7.3,2.9,6.3,1.8,Iris-virginica
181 | 6.7,2.5,5.8,1.8,Iris-virginica
182 | 7.2,3.6,6.1,2.5,Iris-virginica
183 | 6.5,3.2,5.1,2.0,Iris-virginica
184 | 6.4,2.7,5.3,1.9,Iris-virginica
185 | 6.8,3.0,5.5,2.1,Iris-virginica
186 | 5.7,2.5,5.0,2.0,Iris-virginica
187 | 5.8,2.8,5.1,2.4,Iris-virginica
188 | 6.4,3.2,5.3,2.3,Iris-virginica
189 | 6.5,3.0,5.5,1.8,Iris-virginica
190 | 7.7,3.8,6.7,2.2,Iris-virginica
191 | 7.7,2.6,6.9,2.3,Iris-virginica
192 | 6.0,2.2,5.0,1.5,Iris-virginica
193 | 6.9,3.2,5.7,2.3,Iris-virginica
194 | 5.6,2.8,4.9,2.0,Iris-virginica
195 | 7.7,2.8,6.7,2.0,Iris-virginica
196 | 6.3,2.7,4.9,1.8,Iris-virginica
197 | 6.7,3.3,5.7,2.1,Iris-virginica
198 | 7.2,3.2,6.0,1.8,Iris-virginica
199 | 6.2,2.8,4.8,1.8,Iris-virginica
200 | 6.1,3.0,4.9,1.8,Iris-virginica
201 | 6.4,2.8,5.6,2.1,Iris-virginica
202 | 7.2,3.0,5.8,1.6,Iris-virginica
203 | 7.4,2.8,6.1,1.9,Iris-virginica
204 | 7.9,3.8,6.4,2.0,Iris-virginica
205 | 6.4,2.8,5.6,2.2,Iris-virginica
206 | 6.3,2.8,5.1,1.5,Iris-virginica
207 | 6.1,2.6,5.6,1.4,Iris-virginica
208 | 7.7,3.0,6.1,2.3,Iris-virginica
209 | 6.3,3.4,5.6,2.4,Iris-virginica
210 | 6.4,3.1,5.5,1.8,Iris-virginica
211 | 6.0,3.0,4.8,1.8,Iris-virginica
212 | 6.9,3.1,5.4,2.1,Iris-virginica
213 | 6.7,3.1,5.6,2.4,Iris-virginica
214 | 6.9,3.1,5.1,2.3,Iris-virginica
215 | 5.8,2.7,5.1,1.9,Iris-virginica
216 | 6.8,3.2,5.9,2.3,Iris-virginica
217 | 6.7,3.3,5.7,2.5,Iris-virginica
218 | 6.7,3.0,5.2,2.3,Iris-virginica
219 | 6.3,2.5,5.0,1.9,Iris-virginica
220 | 6.5,3.0,5.2,2.0,Iris-virginica
221 | 6.2,3.4,5.4,2.3,Iris-virginica
222 | 5.9,3.0,5.1,1.8,Iris-virginica
223 | %
224 | %
225 | %
226 |
--------------------------------------------------------------------------------
/string-utils/LICENSE:
--------------------------------------------------------------------------------
1 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
2 | LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
3 | CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
4 |
5 | 1. DEFINITIONS
6 |
7 | "Contribution" means:
8 |
9 | a) in the case of the initial Contributor, the initial code and
10 | documentation distributed under this Agreement, and
11 |
12 | b) in the case of each subsequent Contributor:
13 |
14 | i) changes to the Program, and
15 |
16 | ii) additions to the Program;
17 |
18 | where such changes and/or additions to the Program originate from and are
19 | distributed by that particular Contributor. A Contribution 'originates' from
20 | a Contributor if it was added to the Program by such Contributor itself or
21 | anyone acting on such Contributor's behalf. Contributions do not include
22 | additions to the Program which: (i) are separate modules of software
23 | distributed in conjunction with the Program under their own license
24 | agreement, and (ii) are not derivative works of the Program.
25 |
26 | "Contributor" means any person or entity that distributes the Program.
27 |
28 | "Licensed Patents" mean patent claims licensable by a Contributor which are
29 | necessarily infringed by the use or sale of its Contribution alone or when
30 | combined with the Program.
31 |
32 | "Program" means the Contributions distributed in accordance with this
33 | Agreement.
34 |
35 | "Recipient" means anyone who receives the Program under this Agreement,
36 | including all Contributors.
37 |
38 | 2. GRANT OF RIGHTS
39 |
40 | a) Subject to the terms of this Agreement, each Contributor hereby grants
41 | Recipient a non-exclusive, worldwide, royalty-free copyright license to
42 | reproduce, prepare derivative works of, publicly display, publicly perform,
43 | distribute and sublicense the Contribution of such Contributor, if any, and
44 | such derivative works, in source code and object code form.
45 |
46 | b) Subject to the terms of this Agreement, each Contributor hereby grants
47 | Recipient a non-exclusive, worldwide, royalty-free patent license under
48 | Licensed Patents to make, use, sell, offer to sell, import and otherwise
49 | transfer the Contribution of such Contributor, if any, in source code and
50 | object code form. This patent license shall apply to the combination of the
51 | Contribution and the Program if, at the time the Contribution is added by the
52 | Contributor, such addition of the Contribution causes such combination to be
53 | covered by the Licensed Patents. The patent license shall not apply to any
54 | other combinations which include the Contribution. No hardware per se is
55 | licensed hereunder.
56 |
57 | c) Recipient understands that although each Contributor grants the licenses
58 | to its Contributions set forth herein, no assurances are provided by any
59 | Contributor that the Program does not infringe the patent or other
60 | intellectual property rights of any other entity. Each Contributor disclaims
61 | any liability to Recipient for claims brought by any other entity based on
62 | infringement of intellectual property rights or otherwise. As a condition to
63 | exercising the rights and licenses granted hereunder, each Recipient hereby
64 | assumes sole responsibility to secure any other intellectual property rights
65 | needed, if any. For example, if a third party patent license is required to
66 | allow Recipient to distribute the Program, it is Recipient's responsibility
67 | to acquire that license before distributing the Program.
68 |
69 | d) Each Contributor represents that to its knowledge it has sufficient
70 | copyright rights in its Contribution, if any, to grant the copyright license
71 | set forth in this Agreement.
72 |
73 | 3. REQUIREMENTS
74 |
75 | A Contributor may choose to distribute the Program in object code form under
76 | its own license agreement, provided that:
77 |
78 | a) it complies with the terms and conditions of this Agreement; and
79 |
80 | b) its license agreement:
81 |
82 | i) effectively disclaims on behalf of all Contributors all warranties and
83 | conditions, express and implied, including warranties or conditions of title
84 | and non-infringement, and implied warranties or conditions of merchantability
85 | and fitness for a particular purpose;
86 |
87 | ii) effectively excludes on behalf of all Contributors all liability for
88 | damages, including direct, indirect, special, incidental and consequential
89 | damages, such as lost profits;
90 |
91 | iii) states that any provisions which differ from this Agreement are offered
92 | by that Contributor alone and not by any other party; and
93 |
94 | iv) states that source code for the Program is available from such
95 | Contributor, and informs licensees how to obtain it in a reasonable manner on
96 | or through a medium customarily used for software exchange.
97 |
98 | When the Program is made available in source code form:
99 |
100 | a) it must be made available under this Agreement; and
101 |
102 | b) a copy of this Agreement must be included with each copy of the Program.
103 |
104 | Contributors may not remove or alter any copyright notices contained within
105 | the Program.
106 |
107 | Each Contributor must identify itself as the originator of its Contribution,
108 | if any, in a manner that reasonably allows subsequent Recipients to identify
109 | the originator of the Contribution.
110 |
111 | 4. COMMERCIAL DISTRIBUTION
112 |
113 | Commercial distributors of software may accept certain responsibilities with
114 | respect to end users, business partners and the like. While this license is
115 | intended to facilitate the commercial use of the Program, the Contributor who
116 | includes the Program in a commercial product offering should do so in a
117 | manner which does not create potential liability for other Contributors.
118 | Therefore, if a Contributor includes the Program in a commercial product
119 | offering, such Contributor ("Commercial Contributor") hereby agrees to defend
120 | and indemnify every other Contributor ("Indemnified Contributor") against any
121 | losses, damages and costs (collectively "Losses") arising from claims,
122 | lawsuits and other legal actions brought by a third party against the
123 | Indemnified Contributor to the extent caused by the acts or omissions of such
124 | Commercial Contributor in connection with its distribution of the Program in
125 | a commercial product offering. The obligations in this section do not apply
126 | to any claims or Losses relating to any actual or alleged intellectual
127 | property infringement. In order to qualify, an Indemnified Contributor must:
128 | a) promptly notify the Commercial Contributor in writing of such claim, and
129 | b) allow the Commercial Contributor tocontrol, and cooperate with the
130 | Commercial Contributor in, the defense and any related settlement
131 | negotiations. The Indemnified Contributor may participate in any such claim
132 | at its own expense.
133 |
134 | For example, a Contributor might include the Program in a commercial product
135 | offering, Product X. That Contributor is then a Commercial Contributor. If
136 | that Commercial Contributor then makes performance claims, or offers
137 | warranties related to Product X, those performance claims and warranties are
138 | such Commercial Contributor's responsibility alone. Under this section, the
139 | Commercial Contributor would have to defend claims against the other
140 | Contributors related to those performance claims and warranties, and if a
141 | court requires any other Contributor to pay any damages as a result, the
142 | Commercial Contributor must pay those damages.
143 |
144 | 5. NO WARRANTY
145 |
146 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON
147 | AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
148 | EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR
149 | CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
150 | PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the
151 | appropriateness of using and distributing the Program and assumes all risks
152 | associated with its exercise of rights under this Agreement , including but
153 | not limited to the risks and costs of program errors, compliance with
154 | applicable laws, damage to or loss of data, programs or equipment, and
155 | unavailability or interruption of operations.
156 |
157 | 6. DISCLAIMER OF LIABILITY
158 |
159 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
160 | CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
161 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
162 | LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
163 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
164 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
165 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
166 | OF SUCH DAMAGES.
167 |
168 | 7. GENERAL
169 |
170 | If any provision of this Agreement is invalid or unenforceable under
171 | applicable law, it shall not affect the validity or enforceability of the
172 | remainder of the terms of this Agreement, and without further action by the
173 | parties hereto, such provision shall be reformed to the minimum extent
174 | necessary to make such provision valid and enforceable.
175 |
176 | If Recipient institutes patent litigation against any entity (including a
177 | cross-claim or counterclaim in a lawsuit) alleging that the Program itself
178 | (excluding combinations of the Program with other software or hardware)
179 | infringes such Recipient's patent(s), then such Recipient's rights granted
180 | under Section 2(b) shall terminate as of the date such litigation is filed.
181 |
182 | All Recipient's rights under this Agreement shall terminate if it fails to
183 | comply with any of the material terms or conditions of this Agreement and
184 | does not cure such failure in a reasonable period of time after becoming
185 | aware of such noncompliance. If all Recipient's rights under this Agreement
186 | terminate, Recipient agrees to cease use and distribution of the Program as
187 | soon as reasonably practicable. However, Recipient's obligations under this
188 | Agreement and any licenses granted by Recipient relating to the Program shall
189 | continue and survive.
190 |
191 | Everyone is permitted to copy and distribute copies of this Agreement, but in
192 | order to avoid inconsistency the Agreement is copyrighted and may only be
193 | modified in the following manner. The Agreement Steward reserves the right to
194 | publish new versions (including revisions) of this Agreement from time to
195 | time. No one other than the Agreement Steward has the right to modify this
196 | Agreement. The Eclipse Foundation is the initial Agreement Steward. The
197 | Eclipse Foundation may assign the responsibility to serve as the Agreement
198 | Steward to a suitable separate entity. Each new version of the Agreement will
199 | be given a distinguishing version number. The Program (including
200 | Contributions) may always be distributed subject to the version of the
201 | Agreement under which it was received. In addition, after a new version of
202 | the Agreement is published, Contributor may elect to distribute the Program
203 | (including its Contributions) under the new version. Except as expressly
204 | stated in Sections 2(a) and 2(b) above, Recipient receives no rights or
205 | licenses to the intellectual property of any Contributor under this
206 | Agreement, whether expressly, by implication, estoppel or otherwise. All
207 | rights in the Program not expressly granted under this Agreement are
208 | reserved.
209 |
210 | This Agreement is governed by the laws of the State of New York and the
211 | intellectual property laws of the United States of America. No party to this
212 | Agreement will bring a legal action under this Agreement more than one year
213 | after the cause of action arose. Each party waives its rights to a jury trial
214 | in any resulting litigation.
215 |
--------------------------------------------------------------------------------
/apache-commons-daemon/LICENSE:
--------------------------------------------------------------------------------
1 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
2 | LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
3 | CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
4 |
5 | 1. DEFINITIONS
6 |
7 | "Contribution" means:
8 |
9 | a) in the case of the initial Contributor, the initial code and
10 | documentation distributed under this Agreement, and
11 |
12 | b) in the case of each subsequent Contributor:
13 |
14 | i) changes to the Program, and
15 |
16 | ii) additions to the Program;
17 |
18 | where such changes and/or additions to the Program originate from and are
19 | distributed by that particular Contributor. A Contribution 'originates' from
20 | a Contributor if it was added to the Program by such Contributor itself or
21 | anyone acting on such Contributor's behalf. Contributions do not include
22 | additions to the Program which: (i) are separate modules of software
23 | distributed in conjunction with the Program under their own license
24 | agreement, and (ii) are not derivative works of the Program.
25 |
26 | "Contributor" means any person or entity that distributes the Program.
27 |
28 | "Licensed Patents" mean patent claims licensable by a Contributor which are
29 | necessarily infringed by the use or sale of its Contribution alone or when
30 | combined with the Program.
31 |
32 | "Program" means the Contributions distributed in accordance with this
33 | Agreement.
34 |
35 | "Recipient" means anyone who receives the Program under this Agreement,
36 | including all Contributors.
37 |
38 | 2. GRANT OF RIGHTS
39 |
40 | a) Subject to the terms of this Agreement, each Contributor hereby grants
41 | Recipient a non-exclusive, worldwide, royalty-free copyright license to
42 | reproduce, prepare derivative works of, publicly display, publicly perform,
43 | distribute and sublicense the Contribution of such Contributor, if any, and
44 | such derivative works, in source code and object code form.
45 |
46 | b) Subject to the terms of this Agreement, each Contributor hereby grants
47 | Recipient a non-exclusive, worldwide, royalty-free patent license under
48 | Licensed Patents to make, use, sell, offer to sell, import and otherwise
49 | transfer the Contribution of such Contributor, if any, in source code and
50 | object code form. This patent license shall apply to the combination of the
51 | Contribution and the Program if, at the time the Contribution is added by the
52 | Contributor, such addition of the Contribution causes such combination to be
53 | covered by the Licensed Patents. The patent license shall not apply to any
54 | other combinations which include the Contribution. No hardware per se is
55 | licensed hereunder.
56 |
57 | c) Recipient understands that although each Contributor grants the licenses
58 | to its Contributions set forth herein, no assurances are provided by any
59 | Contributor that the Program does not infringe the patent or other
60 | intellectual property rights of any other entity. Each Contributor disclaims
61 | any liability to Recipient for claims brought by any other entity based on
62 | infringement of intellectual property rights or otherwise. As a condition to
63 | exercising the rights and licenses granted hereunder, each Recipient hereby
64 | assumes sole responsibility to secure any other intellectual property rights
65 | needed, if any. For example, if a third party patent license is required to
66 | allow Recipient to distribute the Program, it is Recipient's responsibility
67 | to acquire that license before distributing the Program.
68 |
69 | d) Each Contributor represents that to its knowledge it has sufficient
70 | copyright rights in its Contribution, if any, to grant the copyright license
71 | set forth in this Agreement.
72 |
73 | 3. REQUIREMENTS
74 |
75 | A Contributor may choose to distribute the Program in object code form under
76 | its own license agreement, provided that:
77 |
78 | a) it complies with the terms and conditions of this Agreement; and
79 |
80 | b) its license agreement:
81 |
82 | i) effectively disclaims on behalf of all Contributors all warranties and
83 | conditions, express and implied, including warranties or conditions of title
84 | and non-infringement, and implied warranties or conditions of merchantability
85 | and fitness for a particular purpose;
86 |
87 | ii) effectively excludes on behalf of all Contributors all liability for
88 | damages, including direct, indirect, special, incidental and consequential
89 | damages, such as lost profits;
90 |
91 | iii) states that any provisions which differ from this Agreement are offered
92 | by that Contributor alone and not by any other party; and
93 |
94 | iv) states that source code for the Program is available from such
95 | Contributor, and informs licensees how to obtain it in a reasonable manner on
96 | or through a medium customarily used for software exchange.
97 |
98 | When the Program is made available in source code form:
99 |
100 | a) it must be made available under this Agreement; and
101 |
102 | b) a copy of this Agreement must be included with each copy of the Program.
103 |
104 | Contributors may not remove or alter any copyright notices contained within
105 | the Program.
106 |
107 | Each Contributor must identify itself as the originator of its Contribution,
108 | if any, in a manner that reasonably allows subsequent Recipients to identify
109 | the originator of the Contribution.
110 |
111 | 4. COMMERCIAL DISTRIBUTION
112 |
113 | Commercial distributors of software may accept certain responsibilities with
114 | respect to end users, business partners and the like. While this license is
115 | intended to facilitate the commercial use of the Program, the Contributor who
116 | includes the Program in a commercial product offering should do so in a
117 | manner which does not create potential liability for other Contributors.
118 | Therefore, if a Contributor includes the Program in a commercial product
119 | offering, such Contributor ("Commercial Contributor") hereby agrees to defend
120 | and indemnify every other Contributor ("Indemnified Contributor") against any
121 | losses, damages and costs (collectively "Losses") arising from claims,
122 | lawsuits and other legal actions brought by a third party against the
123 | Indemnified Contributor to the extent caused by the acts or omissions of such
124 | Commercial Contributor in connection with its distribution of the Program in
125 | a commercial product offering. The obligations in this section do not apply
126 | to any claims or Losses relating to any actual or alleged intellectual
127 | property infringement. In order to qualify, an Indemnified Contributor must:
128 | a) promptly notify the Commercial Contributor in writing of such claim, and
129 | b) allow the Commercial Contributor tocontrol, and cooperate with the
130 | Commercial Contributor in, the defense and any related settlement
131 | negotiations. The Indemnified Contributor may participate in any such claim
132 | at its own expense.
133 |
134 | For example, a Contributor might include the Program in a commercial product
135 | offering, Product X. That Contributor is then a Commercial Contributor. If
136 | that Commercial Contributor then makes performance claims, or offers
137 | warranties related to Product X, those performance claims and warranties are
138 | such Commercial Contributor's responsibility alone. Under this section, the
139 | Commercial Contributor would have to defend claims against the other
140 | Contributors related to those performance claims and warranties, and if a
141 | court requires any other Contributor to pay any damages as a result, the
142 | Commercial Contributor must pay those damages.
143 |
144 | 5. NO WARRANTY
145 |
146 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON
147 | AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
148 | EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR
149 | CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
150 | PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the
151 | appropriateness of using and distributing the Program and assumes all risks
152 | associated with its exercise of rights under this Agreement , including but
153 | not limited to the risks and costs of program errors, compliance with
154 | applicable laws, damage to or loss of data, programs or equipment, and
155 | unavailability or interruption of operations.
156 |
157 | 6. DISCLAIMER OF LIABILITY
158 |
159 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
160 | CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
161 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
162 | LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
163 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
164 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
165 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
166 | OF SUCH DAMAGES.
167 |
168 | 7. GENERAL
169 |
170 | If any provision of this Agreement is invalid or unenforceable under
171 | applicable law, it shall not affect the validity or enforceability of the
172 | remainder of the terms of this Agreement, and without further action by the
173 | parties hereto, such provision shall be reformed to the minimum extent
174 | necessary to make such provision valid and enforceable.
175 |
176 | If Recipient institutes patent litigation against any entity (including a
177 | cross-claim or counterclaim in a lawsuit) alleging that the Program itself
178 | (excluding combinations of the Program with other software or hardware)
179 | infringes such Recipient's patent(s), then such Recipient's rights granted
180 | under Section 2(b) shall terminate as of the date such litigation is filed.
181 |
182 | All Recipient's rights under this Agreement shall terminate if it fails to
183 | comply with any of the material terms or conditions of this Agreement and
184 | does not cure such failure in a reasonable period of time after becoming
185 | aware of such noncompliance. If all Recipient's rights under this Agreement
186 | terminate, Recipient agrees to cease use and distribution of the Program as
187 | soon as reasonably practicable. However, Recipient's obligations under this
188 | Agreement and any licenses granted by Recipient relating to the Program shall
189 | continue and survive.
190 |
191 | Everyone is permitted to copy and distribute copies of this Agreement, but in
192 | order to avoid inconsistency the Agreement is copyrighted and may only be
193 | modified in the following manner. The Agreement Steward reserves the right to
194 | publish new versions (including revisions) of this Agreement from time to
195 | time. No one other than the Agreement Steward has the right to modify this
196 | Agreement. The Eclipse Foundation is the initial Agreement Steward. The
197 | Eclipse Foundation may assign the responsibility to serve as the Agreement
198 | Steward to a suitable separate entity. Each new version of the Agreement will
199 | be given a distinguishing version number. The Program (including
200 | Contributions) may always be distributed subject to the version of the
201 | Agreement under which it was received. In addition, after a new version of
202 | the Agreement is published, Contributor may elect to distribute the Program
203 | (including its Contributions) under the new version. Except as expressly
204 | stated in Sections 2(a) and 2(b) above, Recipient receives no rights or
205 | licenses to the intellectual property of any Contributor under this
206 | Agreement, whether expressly, by implication, estoppel or otherwise. All
207 | rights in the Program not expressly granted under this Agreement are
208 | reserved.
209 |
210 | This Agreement is governed by the laws of the State of New York and the
211 | intellectual property laws of the United States of America. No party to this
212 | Agreement will bring a legal action under this Agreement more than one year
213 | after the cause of action arose. Each party waives its rights to a jury trial
214 | in any resulting litigation.
215 |
--------------------------------------------------------------------------------
/apache-kafka/hello-world-kafka/LICENSE:
--------------------------------------------------------------------------------
1 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
2 | LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
3 | CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
4 |
5 | 1. DEFINITIONS
6 |
7 | "Contribution" means:
8 |
9 | a) in the case of the initial Contributor, the initial code and
10 | documentation distributed under this Agreement, and
11 |
12 | b) in the case of each subsequent Contributor:
13 |
14 | i) changes to the Program, and
15 |
16 | ii) additions to the Program;
17 |
18 | where such changes and/or additions to the Program originate from and are
19 | distributed by that particular Contributor. A Contribution 'originates' from
20 | a Contributor if it was added to the Program by such Contributor itself or
21 | anyone acting on such Contributor's behalf. Contributions do not include
22 | additions to the Program which: (i) are separate modules of software
23 | distributed in conjunction with the Program under their own license
24 | agreement, and (ii) are not derivative works of the Program.
25 |
26 | "Contributor" means any person or entity that distributes the Program.
27 |
28 | "Licensed Patents" mean patent claims licensable by a Contributor which are
29 | necessarily infringed by the use or sale of its Contribution alone or when
30 | combined with the Program.
31 |
32 | "Program" means the Contributions distributed in accordance with this
33 | Agreement.
34 |
35 | "Recipient" means anyone who receives the Program under this Agreement,
36 | including all Contributors.
37 |
38 | 2. GRANT OF RIGHTS
39 |
40 | a) Subject to the terms of this Agreement, each Contributor hereby grants
41 | Recipient a non-exclusive, worldwide, royalty-free copyright license to
42 | reproduce, prepare derivative works of, publicly display, publicly perform,
43 | distribute and sublicense the Contribution of such Contributor, if any, and
44 | such derivative works, in source code and object code form.
45 |
46 | b) Subject to the terms of this Agreement, each Contributor hereby grants
47 | Recipient a non-exclusive, worldwide, royalty-free patent license under
48 | Licensed Patents to make, use, sell, offer to sell, import and otherwise
49 | transfer the Contribution of such Contributor, if any, in source code and
50 | object code form. This patent license shall apply to the combination of the
51 | Contribution and the Program if, at the time the Contribution is added by the
52 | Contributor, such addition of the Contribution causes such combination to be
53 | covered by the Licensed Patents. The patent license shall not apply to any
54 | other combinations which include the Contribution. No hardware per se is
55 | licensed hereunder.
56 |
57 | c) Recipient understands that although each Contributor grants the licenses
58 | to its Contributions set forth herein, no assurances are provided by any
59 | Contributor that the Program does not infringe the patent or other
60 | intellectual property rights of any other entity. Each Contributor disclaims
61 | any liability to Recipient for claims brought by any other entity based on
62 | infringement of intellectual property rights or otherwise. As a condition to
63 | exercising the rights and licenses granted hereunder, each Recipient hereby
64 | assumes sole responsibility to secure any other intellectual property rights
65 | needed, if any. For example, if a third party patent license is required to
66 | allow Recipient to distribute the Program, it is Recipient's responsibility
67 | to acquire that license before distributing the Program.
68 |
69 | d) Each Contributor represents that to its knowledge it has sufficient
70 | copyright rights in its Contribution, if any, to grant the copyright license
71 | set forth in this Agreement.
72 |
73 | 3. REQUIREMENTS
74 |
75 | A Contributor may choose to distribute the Program in object code form under
76 | its own license agreement, provided that:
77 |
78 | a) it complies with the terms and conditions of this Agreement; and
79 |
80 | b) its license agreement:
81 |
82 | i) effectively disclaims on behalf of all Contributors all warranties and
83 | conditions, express and implied, including warranties or conditions of title
84 | and non-infringement, and implied warranties or conditions of merchantability
85 | and fitness for a particular purpose;
86 |
87 | ii) effectively excludes on behalf of all Contributors all liability for
88 | damages, including direct, indirect, special, incidental and consequential
89 | damages, such as lost profits;
90 |
91 | iii) states that any provisions which differ from this Agreement are offered
92 | by that Contributor alone and not by any other party; and
93 |
94 | iv) states that source code for the Program is available from such
95 | Contributor, and informs licensees how to obtain it in a reasonable manner on
96 | or through a medium customarily used for software exchange.
97 |
98 | When the Program is made available in source code form:
99 |
100 | a) it must be made available under this Agreement; and
101 |
102 | b) a copy of this Agreement must be included with each copy of the Program.
103 |
104 | Contributors may not remove or alter any copyright notices contained within
105 | the Program.
106 |
107 | Each Contributor must identify itself as the originator of its Contribution,
108 | if any, in a manner that reasonably allows subsequent Recipients to identify
109 | the originator of the Contribution.
110 |
111 | 4. COMMERCIAL DISTRIBUTION
112 |
113 | Commercial distributors of software may accept certain responsibilities with
114 | respect to end users, business partners and the like. While this license is
115 | intended to facilitate the commercial use of the Program, the Contributor who
116 | includes the Program in a commercial product offering should do so in a
117 | manner which does not create potential liability for other Contributors.
118 | Therefore, if a Contributor includes the Program in a commercial product
119 | offering, such Contributor ("Commercial Contributor") hereby agrees to defend
120 | and indemnify every other Contributor ("Indemnified Contributor") against any
121 | losses, damages and costs (collectively "Losses") arising from claims,
122 | lawsuits and other legal actions brought by a third party against the
123 | Indemnified Contributor to the extent caused by the acts or omissions of such
124 | Commercial Contributor in connection with its distribution of the Program in
125 | a commercial product offering. The obligations in this section do not apply
126 | to any claims or Losses relating to any actual or alleged intellectual
127 | property infringement. In order to qualify, an Indemnified Contributor must:
128 | a) promptly notify the Commercial Contributor in writing of such claim, and
129 | b) allow the Commercial Contributor tocontrol, and cooperate with the
130 | Commercial Contributor in, the defense and any related settlement
131 | negotiations. The Indemnified Contributor may participate in any such claim
132 | at its own expense.
133 |
134 | For example, a Contributor might include the Program in a commercial product
135 | offering, Product X. That Contributor is then a Commercial Contributor. If
136 | that Commercial Contributor then makes performance claims, or offers
137 | warranties related to Product X, those performance claims and warranties are
138 | such Commercial Contributor's responsibility alone. Under this section, the
139 | Commercial Contributor would have to defend claims against the other
140 | Contributors related to those performance claims and warranties, and if a
141 | court requires any other Contributor to pay any damages as a result, the
142 | Commercial Contributor must pay those damages.
143 |
144 | 5. NO WARRANTY
145 |
146 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON
147 | AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
148 | EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR
149 | CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
150 | PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the
151 | appropriateness of using and distributing the Program and assumes all risks
152 | associated with its exercise of rights under this Agreement , including but
153 | not limited to the risks and costs of program errors, compliance with
154 | applicable laws, damage to or loss of data, programs or equipment, and
155 | unavailability or interruption of operations.
156 |
157 | 6. DISCLAIMER OF LIABILITY
158 |
159 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
160 | CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
161 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
162 | LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
163 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
164 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
165 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
166 | OF SUCH DAMAGES.
167 |
168 | 7. GENERAL
169 |
170 | If any provision of this Agreement is invalid or unenforceable under
171 | applicable law, it shall not affect the validity or enforceability of the
172 | remainder of the terms of this Agreement, and without further action by the
173 | parties hereto, such provision shall be reformed to the minimum extent
174 | necessary to make such provision valid and enforceable.
175 |
176 | If Recipient institutes patent litigation against any entity (including a
177 | cross-claim or counterclaim in a lawsuit) alleging that the Program itself
178 | (excluding combinations of the Program with other software or hardware)
179 | infringes such Recipient's patent(s), then such Recipient's rights granted
180 | under Section 2(b) shall terminate as of the date such litigation is filed.
181 |
182 | All Recipient's rights under this Agreement shall terminate if it fails to
183 | comply with any of the material terms or conditions of this Agreement and
184 | does not cure such failure in a reasonable period of time after becoming
185 | aware of such noncompliance. If all Recipient's rights under this Agreement
186 | terminate, Recipient agrees to cease use and distribution of the Program as
187 | soon as reasonably practicable. However, Recipient's obligations under this
188 | Agreement and any licenses granted by Recipient relating to the Program shall
189 | continue and survive.
190 |
191 | Everyone is permitted to copy and distribute copies of this Agreement, but in
192 | order to avoid inconsistency the Agreement is copyrighted and may only be
193 | modified in the following manner. The Agreement Steward reserves the right to
194 | publish new versions (including revisions) of this Agreement from time to
195 | time. No one other than the Agreement Steward has the right to modify this
196 | Agreement. The Eclipse Foundation is the initial Agreement Steward. The
197 | Eclipse Foundation may assign the responsibility to serve as the Agreement
198 | Steward to a suitable separate entity. Each new version of the Agreement will
199 | be given a distinguishing version number. The Program (including
200 | Contributions) may always be distributed subject to the version of the
201 | Agreement under which it was received. In addition, after a new version of
202 | the Agreement is published, Contributor may elect to distribute the Program
203 | (including its Contributions) under the new version. Except as expressly
204 | stated in Sections 2(a) and 2(b) above, Recipient receives no rights or
205 | licenses to the intellectual property of any Contributor under this
206 | Agreement, whether expressly, by implication, estoppel or otherwise. All
207 | rights in the Program not expressly granted under this Agreement are
208 | reserved.
209 |
210 | This Agreement is governed by the laws of the State of New York and the
211 | intellectual property laws of the United States of America. No party to this
212 | Agreement will bring a legal action under this Agreement more than one year
213 | after the cause of action arose. Each party waives its rights to a jury trial
214 | in any resulting litigation.
215 |
--------------------------------------------------------------------------------
/apache-spark/flambo-gaming-stack-exchange/LICENSE:
--------------------------------------------------------------------------------
1 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
2 | LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
3 | CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
4 |
5 | 1. DEFINITIONS
6 |
7 | "Contribution" means:
8 |
9 | a) in the case of the initial Contributor, the initial code and
10 | documentation distributed under this Agreement, and
11 |
12 | b) in the case of each subsequent Contributor:
13 |
14 | i) changes to the Program, and
15 |
16 | ii) additions to the Program;
17 |
18 | where such changes and/or additions to the Program originate from and are
19 | distributed by that particular Contributor. A Contribution 'originates' from
20 | a Contributor if it was added to the Program by such Contributor itself or
21 | anyone acting on such Contributor's behalf. Contributions do not include
22 | additions to the Program which: (i) are separate modules of software
23 | distributed in conjunction with the Program under their own license
24 | agreement, and (ii) are not derivative works of the Program.
25 |
26 | "Contributor" means any person or entity that distributes the Program.
27 |
28 | "Licensed Patents" mean patent claims licensable by a Contributor which are
29 | necessarily infringed by the use or sale of its Contribution alone or when
30 | combined with the Program.
31 |
32 | "Program" means the Contributions distributed in accordance with this
33 | Agreement.
34 |
35 | "Recipient" means anyone who receives the Program under this Agreement,
36 | including all Contributors.
37 |
38 | 2. GRANT OF RIGHTS
39 |
40 | a) Subject to the terms of this Agreement, each Contributor hereby grants
41 | Recipient a non-exclusive, worldwide, royalty-free copyright license to
42 | reproduce, prepare derivative works of, publicly display, publicly perform,
43 | distribute and sublicense the Contribution of such Contributor, if any, and
44 | such derivative works, in source code and object code form.
45 |
46 | b) Subject to the terms of this Agreement, each Contributor hereby grants
47 | Recipient a non-exclusive, worldwide, royalty-free patent license under
48 | Licensed Patents to make, use, sell, offer to sell, import and otherwise
49 | transfer the Contribution of such Contributor, if any, in source code and
50 | object code form. This patent license shall apply to the combination of the
51 | Contribution and the Program if, at the time the Contribution is added by the
52 | Contributor, such addition of the Contribution causes such combination to be
53 | covered by the Licensed Patents. The patent license shall not apply to any
54 | other combinations which include the Contribution. No hardware per se is
55 | licensed hereunder.
56 |
57 | c) Recipient understands that although each Contributor grants the licenses
58 | to its Contributions set forth herein, no assurances are provided by any
59 | Contributor that the Program does not infringe the patent or other
60 | intellectual property rights of any other entity. Each Contributor disclaims
61 | any liability to Recipient for claims brought by any other entity based on
62 | infringement of intellectual property rights or otherwise. As a condition to
63 | exercising the rights and licenses granted hereunder, each Recipient hereby
64 | assumes sole responsibility to secure any other intellectual property rights
65 | needed, if any. For example, if a third party patent license is required to
66 | allow Recipient to distribute the Program, it is Recipient's responsibility
67 | to acquire that license before distributing the Program.
68 |
69 | d) Each Contributor represents that to its knowledge it has sufficient
70 | copyright rights in its Contribution, if any, to grant the copyright license
71 | set forth in this Agreement.
72 |
73 | 3. REQUIREMENTS
74 |
75 | A Contributor may choose to distribute the Program in object code form under
76 | its own license agreement, provided that:
77 |
78 | a) it complies with the terms and conditions of this Agreement; and
79 |
80 | b) its license agreement:
81 |
82 | i) effectively disclaims on behalf of all Contributors all warranties and
83 | conditions, express and implied, including warranties or conditions of title
84 | and non-infringement, and implied warranties or conditions of merchantability
85 | and fitness for a particular purpose;
86 |
87 | ii) effectively excludes on behalf of all Contributors all liability for
88 | damages, including direct, indirect, special, incidental and consequential
89 | damages, such as lost profits;
90 |
91 | iii) states that any provisions which differ from this Agreement are offered
92 | by that Contributor alone and not by any other party; and
93 |
94 | iv) states that source code for the Program is available from such
95 | Contributor, and informs licensees how to obtain it in a reasonable manner on
96 | or through a medium customarily used for software exchange.
97 |
98 | When the Program is made available in source code form:
99 |
100 | a) it must be made available under this Agreement; and
101 |
102 | b) a copy of this Agreement must be included with each copy of the Program.
103 |
104 | Contributors may not remove or alter any copyright notices contained within
105 | the Program.
106 |
107 | Each Contributor must identify itself as the originator of its Contribution,
108 | if any, in a manner that reasonably allows subsequent Recipients to identify
109 | the originator of the Contribution.
110 |
111 | 4. COMMERCIAL DISTRIBUTION
112 |
113 | Commercial distributors of software may accept certain responsibilities with
114 | respect to end users, business partners and the like. While this license is
115 | intended to facilitate the commercial use of the Program, the Contributor who
116 | includes the Program in a commercial product offering should do so in a
117 | manner which does not create potential liability for other Contributors.
118 | Therefore, if a Contributor includes the Program in a commercial product
119 | offering, such Contributor ("Commercial Contributor") hereby agrees to defend
120 | and indemnify every other Contributor ("Indemnified Contributor") against any
121 | losses, damages and costs (collectively "Losses") arising from claims,
122 | lawsuits and other legal actions brought by a third party against the
123 | Indemnified Contributor to the extent caused by the acts or omissions of such
124 | Commercial Contributor in connection with its distribution of the Program in
125 | a commercial product offering. The obligations in this section do not apply
126 | to any claims or Losses relating to any actual or alleged intellectual
127 | property infringement. In order to qualify, an Indemnified Contributor must:
128 | a) promptly notify the Commercial Contributor in writing of such claim, and
129 | b) allow the Commercial Contributor tocontrol, and cooperate with the
130 | Commercial Contributor in, the defense and any related settlement
131 | negotiations. The Indemnified Contributor may participate in any such claim
132 | at its own expense.
133 |
134 | For example, a Contributor might include the Program in a commercial product
135 | offering, Product X. That Contributor is then a Commercial Contributor. If
136 | that Commercial Contributor then makes performance claims, or offers
137 | warranties related to Product X, those performance claims and warranties are
138 | such Commercial Contributor's responsibility alone. Under this section, the
139 | Commercial Contributor would have to defend claims against the other
140 | Contributors related to those performance claims and warranties, and if a
141 | court requires any other Contributor to pay any damages as a result, the
142 | Commercial Contributor must pay those damages.
143 |
144 | 5. NO WARRANTY
145 |
146 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON
147 | AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
148 | EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR
149 | CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
150 | PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the
151 | appropriateness of using and distributing the Program and assumes all risks
152 | associated with its exercise of rights under this Agreement , including but
153 | not limited to the risks and costs of program errors, compliance with
154 | applicable laws, damage to or loss of data, programs or equipment, and
155 | unavailability or interruption of operations.
156 |
157 | 6. DISCLAIMER OF LIABILITY
158 |
159 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
160 | CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
161 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
162 | LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
163 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
164 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
165 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
166 | OF SUCH DAMAGES.
167 |
168 | 7. GENERAL
169 |
170 | If any provision of this Agreement is invalid or unenforceable under
171 | applicable law, it shall not affect the validity or enforceability of the
172 | remainder of the terms of this Agreement, and without further action by the
173 | parties hereto, such provision shall be reformed to the minimum extent
174 | necessary to make such provision valid and enforceable.
175 |
176 | If Recipient institutes patent litigation against any entity (including a
177 | cross-claim or counterclaim in a lawsuit) alleging that the Program itself
178 | (excluding combinations of the Program with other software or hardware)
179 | infringes such Recipient's patent(s), then such Recipient's rights granted
180 | under Section 2(b) shall terminate as of the date such litigation is filed.
181 |
182 | All Recipient's rights under this Agreement shall terminate if it fails to
183 | comply with any of the material terms or conditions of this Agreement and
184 | does not cure such failure in a reasonable period of time after becoming
185 | aware of such noncompliance. If all Recipient's rights under this Agreement
186 | terminate, Recipient agrees to cease use and distribution of the Program as
187 | soon as reasonably practicable. However, Recipient's obligations under this
188 | Agreement and any licenses granted by Recipient relating to the Program shall
189 | continue and survive.
190 |
191 | Everyone is permitted to copy and distribute copies of this Agreement, but in
192 | order to avoid inconsistency the Agreement is copyrighted and may only be
193 | modified in the following manner. The Agreement Steward reserves the right to
194 | publish new versions (including revisions) of this Agreement from time to
195 | time. No one other than the Agreement Steward has the right to modify this
196 | Agreement. The Eclipse Foundation is the initial Agreement Steward. The
197 | Eclipse Foundation may assign the responsibility to serve as the Agreement
198 | Steward to a suitable separate entity. Each new version of the Agreement will
199 | be given a distinguishing version number. The Program (including
200 | Contributions) may always be distributed subject to the version of the
201 | Agreement under which it was received. In addition, after a new version of
202 | the Agreement is published, Contributor may elect to distribute the Program
203 | (including its Contributions) under the new version. Except as expressly
204 | stated in Sections 2(a) and 2(b) above, Recipient receives no rights or
205 | licenses to the intellectual property of any Contributor under this
206 | Agreement, whether expressly, by implication, estoppel or otherwise. All
207 | rights in the Program not expressly granted under this Agreement are
208 | reserved.
209 |
210 | This Agreement is governed by the laws of the State of New York and the
211 | intellectual property laws of the United States of America. No party to this
212 | Agreement will bring a legal action under this Agreement more than one year
213 | after the cause of action arose. Each party waives its rights to a jury trial
214 | in any resulting litigation.
215 |
--------------------------------------------------------------------------------
/redis/LICENSE:
--------------------------------------------------------------------------------
1 | Eclipse Public License - v 2.0
2 |
3 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
4 | PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
5 | OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
6 |
7 | 1. DEFINITIONS
8 |
9 | "Contribution" means:
10 |
11 | a) in the case of the initial Contributor, the initial content
12 | Distributed under this Agreement, and
13 |
14 | b) in the case of each subsequent Contributor:
15 | i) changes to the Program, and
16 | ii) additions to the Program;
17 | where such changes and/or additions to the Program originate from
18 | and are Distributed by that particular Contributor. A Contribution
19 | "originates" from a Contributor if it was added to the Program by
20 | such Contributor itself or anyone acting on such Contributor's behalf.
21 | Contributions do not include changes or additions to the Program that
22 | are not Modified Works.
23 |
24 | "Contributor" means any person or entity that Distributes the Program.
25 |
26 | "Licensed Patents" mean patent claims licensable by a Contributor which
27 | are necessarily infringed by the use or sale of its Contribution alone
28 | or when combined with the Program.
29 |
30 | "Program" means the Contributions Distributed in accordance with this
31 | Agreement.
32 |
33 | "Recipient" means anyone who receives the Program under this Agreement
34 | or any Secondary License (as applicable), including Contributors.
35 |
36 | "Derivative Works" shall mean any work, whether in Source Code or other
37 | form, that is based on (or derived from) the Program and for which the
38 | editorial revisions, annotations, elaborations, or other modifications
39 | represent, as a whole, an original work of authorship.
40 |
41 | "Modified Works" shall mean any work in Source Code or other form that
42 | results from an addition to, deletion from, or modification of the
43 | contents of the Program, including, for purposes of clarity any new file
44 | in Source Code form that contains any contents of the Program. Modified
45 | Works shall not include works that contain only declarations,
46 | interfaces, types, classes, structures, or files of the Program solely
47 | in each case in order to link to, bind by name, or subclass the Program
48 | or Modified Works thereof.
49 |
50 | "Distribute" means the acts of a) distributing or b) making available
51 | in any manner that enables the transfer of a copy.
52 |
53 | "Source Code" means the form of a Program preferred for making
54 | modifications, including but not limited to software source code,
55 | documentation source, and configuration files.
56 |
57 | "Secondary License" means either the GNU General Public License,
58 | Version 2.0, or any later versions of that license, including any
59 | exceptions or additional permissions as identified by the initial
60 | Contributor.
61 |
62 | 2. GRANT OF RIGHTS
63 |
64 | a) Subject to the terms of this Agreement, each Contributor hereby
65 | grants Recipient a non-exclusive, worldwide, royalty-free copyright
66 | license to reproduce, prepare Derivative Works of, publicly display,
67 | publicly perform, Distribute and sublicense the Contribution of such
68 | Contributor, if any, and such Derivative Works.
69 |
70 | b) Subject to the terms of this Agreement, each Contributor hereby
71 | grants Recipient a non-exclusive, worldwide, royalty-free patent
72 | license under Licensed Patents to make, use, sell, offer to sell,
73 | import and otherwise transfer the Contribution of such Contributor,
74 | if any, in Source Code or other form. This patent license shall
75 | apply to the combination of the Contribution and the Program if, at
76 | the time the Contribution is added by the Contributor, such addition
77 | of the Contribution causes such combination to be covered by the
78 | Licensed Patents. The patent license shall not apply to any other
79 | combinations which include the Contribution. No hardware per se is
80 | licensed hereunder.
81 |
82 | c) Recipient understands that although each Contributor grants the
83 | licenses to its Contributions set forth herein, no assurances are
84 | provided by any Contributor that the Program does not infringe the
85 | patent or other intellectual property rights of any other entity.
86 | Each Contributor disclaims any liability to Recipient for claims
87 | brought by any other entity based on infringement of intellectual
88 | property rights or otherwise. As a condition to exercising the
89 | rights and licenses granted hereunder, each Recipient hereby
90 | assumes sole responsibility to secure any other intellectual
91 | property rights needed, if any. For example, if a third party
92 | patent license is required to allow Recipient to Distribute the
93 | Program, it is Recipient's responsibility to acquire that license
94 | before distributing the Program.
95 |
96 | d) Each Contributor represents that to its knowledge it has
97 | sufficient copyright rights in its Contribution, if any, to grant
98 | the copyright license set forth in this Agreement.
99 |
100 | e) Notwithstanding the terms of any Secondary License, no
101 | Contributor makes additional grants to any Recipient (other than
102 | those set forth in this Agreement) as a result of such Recipient's
103 | receipt of the Program under the terms of a Secondary License
104 | (if permitted under the terms of Section 3).
105 |
106 | 3. REQUIREMENTS
107 |
108 | 3.1 If a Contributor Distributes the Program in any form, then:
109 |
110 | a) the Program must also be made available as Source Code, in
111 | accordance with section 3.2, and the Contributor must accompany
112 | the Program with a statement that the Source Code for the Program
113 | is available under this Agreement, and informs Recipients how to
114 | obtain it in a reasonable manner on or through a medium customarily
115 | used for software exchange; and
116 |
117 | b) the Contributor may Distribute the Program under a license
118 | different than this Agreement, provided that such license:
119 | i) effectively disclaims on behalf of all other Contributors all
120 | warranties and conditions, express and implied, including
121 | warranties or conditions of title and non-infringement, and
122 | implied warranties or conditions of merchantability and fitness
123 | for a particular purpose;
124 |
125 | ii) effectively excludes on behalf of all other Contributors all
126 | liability for damages, including direct, indirect, special,
127 | incidental and consequential damages, such as lost profits;
128 |
129 | iii) does not attempt to limit or alter the recipients' rights
130 | in the Source Code under section 3.2; and
131 |
132 | iv) requires any subsequent distribution of the Program by any
133 | party to be under a license that satisfies the requirements
134 | of this section 3.
135 |
136 | 3.2 When the Program is Distributed as Source Code:
137 |
138 | a) it must be made available under this Agreement, or if the
139 | Program (i) is combined with other material in a separate file or
140 | files made available under a Secondary License, and (ii) the initial
141 | Contributor attached to the Source Code the notice described in
142 | Exhibit A of this Agreement, then the Program may be made available
143 | under the terms of such Secondary Licenses, and
144 |
145 | b) a copy of this Agreement must be included with each copy of
146 | the Program.
147 |
148 | 3.3 Contributors may not remove or alter any copyright, patent,
149 | trademark, attribution notices, disclaimers of warranty, or limitations
150 | of liability ("notices") contained within the Program from any copy of
151 | the Program which they Distribute, provided that Contributors may add
152 | their own appropriate notices.
153 |
154 | 4. COMMERCIAL DISTRIBUTION
155 |
156 | Commercial distributors of software may accept certain responsibilities
157 | with respect to end users, business partners and the like. While this
158 | license is intended to facilitate the commercial use of the Program,
159 | the Contributor who includes the Program in a commercial product
160 | offering should do so in a manner which does not create potential
161 | liability for other Contributors. Therefore, if a Contributor includes
162 | the Program in a commercial product offering, such Contributor
163 | ("Commercial Contributor") hereby agrees to defend and indemnify every
164 | other Contributor ("Indemnified Contributor") against any losses,
165 | damages and costs (collectively "Losses") arising from claims, lawsuits
166 | and other legal actions brought by a third party against the Indemnified
167 | Contributor to the extent caused by the acts or omissions of such
168 | Commercial Contributor in connection with its distribution of the Program
169 | in a commercial product offering. The obligations in this section do not
170 | apply to any claims or Losses relating to any actual or alleged
171 | intellectual property infringement. In order to qualify, an Indemnified
172 | Contributor must: a) promptly notify the Commercial Contributor in
173 | writing of such claim, and b) allow the Commercial Contributor to control,
174 | and cooperate with the Commercial Contributor in, the defense and any
175 | related settlement negotiations. The Indemnified Contributor may
176 | participate in any such claim at its own expense.
177 |
178 | For example, a Contributor might include the Program in a commercial
179 | product offering, Product X. That Contributor is then a Commercial
180 | Contributor. If that Commercial Contributor then makes performance
181 | claims, or offers warranties related to Product X, those performance
182 | claims and warranties are such Commercial Contributor's responsibility
183 | alone. Under this section, the Commercial Contributor would have to
184 | defend claims against the other Contributors related to those performance
185 | claims and warranties, and if a court requires any other Contributor to
186 | pay any damages as a result, the Commercial Contributor must pay
187 | those damages.
188 |
189 | 5. NO WARRANTY
190 |
191 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
192 | PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
193 | BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
194 | IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
195 | TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
196 | PURPOSE. Each Recipient is solely responsible for determining the
197 | appropriateness of using and distributing the Program and assumes all
198 | risks associated with its exercise of rights under this Agreement,
199 | including but not limited to the risks and costs of program errors,
200 | compliance with applicable laws, damage to or loss of data, programs
201 | or equipment, and unavailability or interruption of operations.
202 |
203 | 6. DISCLAIMER OF LIABILITY
204 |
205 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
206 | PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
207 | SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
208 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
209 | PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
210 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
211 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
212 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
213 | POSSIBILITY OF SUCH DAMAGES.
214 |
215 | 7. GENERAL
216 |
217 | If any provision of this Agreement is invalid or unenforceable under
218 | applicable law, it shall not affect the validity or enforceability of
219 | the remainder of the terms of this Agreement, and without further
220 | action by the parties hereto, such provision shall be reformed to the
221 | minimum extent necessary to make such provision valid and enforceable.
222 |
223 | If Recipient institutes patent litigation against any entity
224 | (including a cross-claim or counterclaim in a lawsuit) alleging that the
225 | Program itself (excluding combinations of the Program with other software
226 | or hardware) infringes such Recipient's patent(s), then such Recipient's
227 | rights granted under Section 2(b) shall terminate as of the date such
228 | litigation is filed.
229 |
230 | All Recipient's rights under this Agreement shall terminate if it
231 | fails to comply with any of the material terms or conditions of this
232 | Agreement and does not cure such failure in a reasonable period of
233 | time after becoming aware of such noncompliance. If all Recipient's
234 | rights under this Agreement terminate, Recipient agrees to cease use
235 | and distribution of the Program as soon as reasonably practicable.
236 | However, Recipient's obligations under this Agreement and any licenses
237 | granted by Recipient relating to the Program shall continue and survive.
238 |
239 | Everyone is permitted to copy and distribute copies of this Agreement,
240 | but in order to avoid inconsistency the Agreement is copyrighted and
241 | may only be modified in the following manner. The Agreement Steward
242 | reserves the right to publish new versions (including revisions) of
243 | this Agreement from time to time. No one other than the Agreement
244 | Steward has the right to modify this Agreement. The Eclipse Foundation
245 | is the initial Agreement Steward. The Eclipse Foundation may assign the
246 | responsibility to serve as the Agreement Steward to a suitable separate
247 | entity. Each new version of the Agreement will be given a distinguishing
248 | version number. The Program (including Contributions) may always be
249 | Distributed subject to the version of the Agreement under which it was
250 | received. In addition, after a new version of the Agreement is published,
251 | Contributor may elect to Distribute the Program (including its
252 | Contributions) under the new version.
253 |
254 | Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
255 | receives no rights or licenses to the intellectual property of any
256 | Contributor under this Agreement, whether expressly, by implication,
257 | estoppel or otherwise. All rights in the Program not expressly granted
258 | under this Agreement are reserved. Nothing in this Agreement is intended
259 | to be enforceable by any entity that is not a Contributor or Recipient.
260 | No third-party beneficiary rights are created under this Agreement.
261 |
262 | Exhibit A - Form of Secondary Licenses Notice
263 |
264 | "This Source Code may also be made available under the following
265 | Secondary Licenses when the conditions for such availability set forth
266 | in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public
267 | License as published by the Free Software Foundation, either version 2
268 | of the License, or (at your option) any later version, with the GNU
269 | Classpath Exception which is available at
270 | https://www.gnu.org/software/classpath/license.html."
271 |
272 | Simply including a copy of this Agreement, including this Exhibit A
273 | is not sufficient to license the Source Code under Secondary Licenses.
274 |
275 | If it is not possible or desirable to put the notice in a particular
276 | file, then You may include the notice in a location (such as a LICENSE
277 | file in a relevant directory) where a recipient would be likely to
278 | look for such a notice.
279 |
280 | You may add additional accurate notices of copyright ownership.
281 |
--------------------------------------------------------------------------------
/core-async/LICENSE:
--------------------------------------------------------------------------------
1 | Eclipse Public License - v 2.0
2 |
3 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
4 | PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
5 | OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
6 |
7 | 1. DEFINITIONS
8 |
9 | "Contribution" means:
10 |
11 | a) in the case of the initial Contributor, the initial content
12 | Distributed under this Agreement, and
13 |
14 | b) in the case of each subsequent Contributor:
15 | i) changes to the Program, and
16 | ii) additions to the Program;
17 | where such changes and/or additions to the Program originate from
18 | and are Distributed by that particular Contributor. A Contribution
19 | "originates" from a Contributor if it was added to the Program by
20 | such Contributor itself or anyone acting on such Contributor's behalf.
21 | Contributions do not include changes or additions to the Program that
22 | are not Modified Works.
23 |
24 | "Contributor" means any person or entity that Distributes the Program.
25 |
26 | "Licensed Patents" mean patent claims licensable by a Contributor which
27 | are necessarily infringed by the use or sale of its Contribution alone
28 | or when combined with the Program.
29 |
30 | "Program" means the Contributions Distributed in accordance with this
31 | Agreement.
32 |
33 | "Recipient" means anyone who receives the Program under this Agreement
34 | or any Secondary License (as applicable), including Contributors.
35 |
36 | "Derivative Works" shall mean any work, whether in Source Code or other
37 | form, that is based on (or derived from) the Program and for which the
38 | editorial revisions, annotations, elaborations, or other modifications
39 | represent, as a whole, an original work of authorship.
40 |
41 | "Modified Works" shall mean any work in Source Code or other form that
42 | results from an addition to, deletion from, or modification of the
43 | contents of the Program, including, for purposes of clarity any new file
44 | in Source Code form that contains any contents of the Program. Modified
45 | Works shall not include works that contain only declarations,
46 | interfaces, types, classes, structures, or files of the Program solely
47 | in each case in order to link to, bind by name, or subclass the Program
48 | or Modified Works thereof.
49 |
50 | "Distribute" means the acts of a) distributing or b) making available
51 | in any manner that enables the transfer of a copy.
52 |
53 | "Source Code" means the form of a Program preferred for making
54 | modifications, including but not limited to software source code,
55 | documentation source, and configuration files.
56 |
57 | "Secondary License" means either the GNU General Public License,
58 | Version 2.0, or any later versions of that license, including any
59 | exceptions or additional permissions as identified by the initial
60 | Contributor.
61 |
62 | 2. GRANT OF RIGHTS
63 |
64 | a) Subject to the terms of this Agreement, each Contributor hereby
65 | grants Recipient a non-exclusive, worldwide, royalty-free copyright
66 | license to reproduce, prepare Derivative Works of, publicly display,
67 | publicly perform, Distribute and sublicense the Contribution of such
68 | Contributor, if any, and such Derivative Works.
69 |
70 | b) Subject to the terms of this Agreement, each Contributor hereby
71 | grants Recipient a non-exclusive, worldwide, royalty-free patent
72 | license under Licensed Patents to make, use, sell, offer to sell,
73 | import and otherwise transfer the Contribution of such Contributor,
74 | if any, in Source Code or other form. This patent license shall
75 | apply to the combination of the Contribution and the Program if, at
76 | the time the Contribution is added by the Contributor, such addition
77 | of the Contribution causes such combination to be covered by the
78 | Licensed Patents. The patent license shall not apply to any other
79 | combinations which include the Contribution. No hardware per se is
80 | licensed hereunder.
81 |
82 | c) Recipient understands that although each Contributor grants the
83 | licenses to its Contributions set forth herein, no assurances are
84 | provided by any Contributor that the Program does not infringe the
85 | patent or other intellectual property rights of any other entity.
86 | Each Contributor disclaims any liability to Recipient for claims
87 | brought by any other entity based on infringement of intellectual
88 | property rights or otherwise. As a condition to exercising the
89 | rights and licenses granted hereunder, each Recipient hereby
90 | assumes sole responsibility to secure any other intellectual
91 | property rights needed, if any. For example, if a third party
92 | patent license is required to allow Recipient to Distribute the
93 | Program, it is Recipient's responsibility to acquire that license
94 | before distributing the Program.
95 |
96 | d) Each Contributor represents that to its knowledge it has
97 | sufficient copyright rights in its Contribution, if any, to grant
98 | the copyright license set forth in this Agreement.
99 |
100 | e) Notwithstanding the terms of any Secondary License, no
101 | Contributor makes additional grants to any Recipient (other than
102 | those set forth in this Agreement) as a result of such Recipient's
103 | receipt of the Program under the terms of a Secondary License
104 | (if permitted under the terms of Section 3).
105 |
106 | 3. REQUIREMENTS
107 |
108 | 3.1 If a Contributor Distributes the Program in any form, then:
109 |
110 | a) the Program must also be made available as Source Code, in
111 | accordance with section 3.2, and the Contributor must accompany
112 | the Program with a statement that the Source Code for the Program
113 | is available under this Agreement, and informs Recipients how to
114 | obtain it in a reasonable manner on or through a medium customarily
115 | used for software exchange; and
116 |
117 | b) the Contributor may Distribute the Program under a license
118 | different than this Agreement, provided that such license:
119 | i) effectively disclaims on behalf of all other Contributors all
120 | warranties and conditions, express and implied, including
121 | warranties or conditions of title and non-infringement, and
122 | implied warranties or conditions of merchantability and fitness
123 | for a particular purpose;
124 |
125 | ii) effectively excludes on behalf of all other Contributors all
126 | liability for damages, including direct, indirect, special,
127 | incidental and consequential damages, such as lost profits;
128 |
129 | iii) does not attempt to limit or alter the recipients' rights
130 | in the Source Code under section 3.2; and
131 |
132 | iv) requires any subsequent distribution of the Program by any
133 | party to be under a license that satisfies the requirements
134 | of this section 3.
135 |
136 | 3.2 When the Program is Distributed as Source Code:
137 |
138 | a) it must be made available under this Agreement, or if the
139 | Program (i) is combined with other material in a separate file or
140 | files made available under a Secondary License, and (ii) the initial
141 | Contributor attached to the Source Code the notice described in
142 | Exhibit A of this Agreement, then the Program may be made available
143 | under the terms of such Secondary Licenses, and
144 |
145 | b) a copy of this Agreement must be included with each copy of
146 | the Program.
147 |
148 | 3.3 Contributors may not remove or alter any copyright, patent,
149 | trademark, attribution notices, disclaimers of warranty, or limitations
150 | of liability ("notices") contained within the Program from any copy of
151 | the Program which they Distribute, provided that Contributors may add
152 | their own appropriate notices.
153 |
154 | 4. COMMERCIAL DISTRIBUTION
155 |
156 | Commercial distributors of software may accept certain responsibilities
157 | with respect to end users, business partners and the like. While this
158 | license is intended to facilitate the commercial use of the Program,
159 | the Contributor who includes the Program in a commercial product
160 | offering should do so in a manner which does not create potential
161 | liability for other Contributors. Therefore, if a Contributor includes
162 | the Program in a commercial product offering, such Contributor
163 | ("Commercial Contributor") hereby agrees to defend and indemnify every
164 | other Contributor ("Indemnified Contributor") against any losses,
165 | damages and costs (collectively "Losses") arising from claims, lawsuits
166 | and other legal actions brought by a third party against the Indemnified
167 | Contributor to the extent caused by the acts or omissions of such
168 | Commercial Contributor in connection with its distribution of the Program
169 | in a commercial product offering. The obligations in this section do not
170 | apply to any claims or Losses relating to any actual or alleged
171 | intellectual property infringement. In order to qualify, an Indemnified
172 | Contributor must: a) promptly notify the Commercial Contributor in
173 | writing of such claim, and b) allow the Commercial Contributor to control,
174 | and cooperate with the Commercial Contributor in, the defense and any
175 | related settlement negotiations. The Indemnified Contributor may
176 | participate in any such claim at its own expense.
177 |
178 | For example, a Contributor might include the Program in a commercial
179 | product offering, Product X. That Contributor is then a Commercial
180 | Contributor. If that Commercial Contributor then makes performance
181 | claims, or offers warranties related to Product X, those performance
182 | claims and warranties are such Commercial Contributor's responsibility
183 | alone. Under this section, the Commercial Contributor would have to
184 | defend claims against the other Contributors related to those performance
185 | claims and warranties, and if a court requires any other Contributor to
186 | pay any damages as a result, the Commercial Contributor must pay
187 | those damages.
188 |
189 | 5. NO WARRANTY
190 |
191 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
192 | PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
193 | BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
194 | IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
195 | TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
196 | PURPOSE. Each Recipient is solely responsible for determining the
197 | appropriateness of using and distributing the Program and assumes all
198 | risks associated with its exercise of rights under this Agreement,
199 | including but not limited to the risks and costs of program errors,
200 | compliance with applicable laws, damage to or loss of data, programs
201 | or equipment, and unavailability or interruption of operations.
202 |
203 | 6. DISCLAIMER OF LIABILITY
204 |
205 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
206 | PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
207 | SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
208 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
209 | PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
210 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
211 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
212 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
213 | POSSIBILITY OF SUCH DAMAGES.
214 |
215 | 7. GENERAL
216 |
217 | If any provision of this Agreement is invalid or unenforceable under
218 | applicable law, it shall not affect the validity or enforceability of
219 | the remainder of the terms of this Agreement, and without further
220 | action by the parties hereto, such provision shall be reformed to the
221 | minimum extent necessary to make such provision valid and enforceable.
222 |
223 | If Recipient institutes patent litigation against any entity
224 | (including a cross-claim or counterclaim in a lawsuit) alleging that the
225 | Program itself (excluding combinations of the Program with other software
226 | or hardware) infringes such Recipient's patent(s), then such Recipient's
227 | rights granted under Section 2(b) shall terminate as of the date such
228 | litigation is filed.
229 |
230 | All Recipient's rights under this Agreement shall terminate if it
231 | fails to comply with any of the material terms or conditions of this
232 | Agreement and does not cure such failure in a reasonable period of
233 | time after becoming aware of such noncompliance. If all Recipient's
234 | rights under this Agreement terminate, Recipient agrees to cease use
235 | and distribution of the Program as soon as reasonably practicable.
236 | However, Recipient's obligations under this Agreement and any licenses
237 | granted by Recipient relating to the Program shall continue and survive.
238 |
239 | Everyone is permitted to copy and distribute copies of this Agreement,
240 | but in order to avoid inconsistency the Agreement is copyrighted and
241 | may only be modified in the following manner. The Agreement Steward
242 | reserves the right to publish new versions (including revisions) of
243 | this Agreement from time to time. No one other than the Agreement
244 | Steward has the right to modify this Agreement. The Eclipse Foundation
245 | is the initial Agreement Steward. The Eclipse Foundation may assign the
246 | responsibility to serve as the Agreement Steward to a suitable separate
247 | entity. Each new version of the Agreement will be given a distinguishing
248 | version number. The Program (including Contributions) may always be
249 | Distributed subject to the version of the Agreement under which it was
250 | received. In addition, after a new version of the Agreement is published,
251 | Contributor may elect to Distribute the Program (including its
252 | Contributions) under the new version.
253 |
254 | Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
255 | receives no rights or licenses to the intellectual property of any
256 | Contributor under this Agreement, whether expressly, by implication,
257 | estoppel or otherwise. All rights in the Program not expressly granted
258 | under this Agreement are reserved. Nothing in this Agreement is intended
259 | to be enforceable by any entity that is not a Contributor or Recipient.
260 | No third-party beneficiary rights are created under this Agreement.
261 |
262 | Exhibit A - Form of Secondary Licenses Notice
263 |
264 | "This Source Code may also be made available under the following
265 | Secondary Licenses when the conditions for such availability set forth
266 | in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public
267 | License as published by the Free Software Foundation, either version 2
268 | of the License, or (at your option) any later version, with the GNU
269 | Classpath Exception which is available at
270 | https://www.gnu.org/software/classpath/license.html."
271 |
272 | Simply including a copy of this Agreement, including this Exhibit A
273 | is not sufficient to license the Source Code under Secondary Licenses.
274 |
275 | If it is not possible or desirable to put the notice in a particular
276 | file, then You may include the notice in a location (such as a LICENSE
277 | file in a relevant directory) where a recipient would be likely to
278 | look for such a notice.
279 |
280 | You may add additional accurate notices of copyright ownership.
281 |
--------------------------------------------------------------------------------