This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns mlstudy.linalgbook | |
(:require [uncomplicate.neanderthal.linalg :as linalg] | |
[tech.viz.vega :as vega]) | |
(:use [uncomplicate.neanderthal core native vect-math] | |
[clojure.repl])) | |
;;; See also | |
;; https://dragan.rocks/articles/21/Hello-World-Programming-with-Linear-Algebra | |
;; Based on Gareth Williams 9th Edition - Linear Algebra with Applications 2017 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn score | |
"Return a tuple representing the best score that can be made from the hand." | |
[hand] | |
(let [isflush (apply = (map second hand)) | |
ranks (map first hand) | |
rsranks (reverse (pk-ranksort ranks)) | |
fq (frequencies ranks) | |
keyswith (partial getkeyswithval fq) | |
fs (sort (vals fq)) | |
match-ranks? #(= (set ranks) (set %)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns trydatahike.beginnersql | |
(:require [datahike.api :as d :refer :all :exclude [filter]] | |
[clojure.string :as string])) | |
;; DUMP or RESTORE | |
;;(require '[datahike.migrate :refer [export-db import-db]]) | |
;;(export-db @bookconn "src/trydatahike/begsqldump.edn") | |
;;(import-db new-conn "src/trydatahike/begsqldump.edn") | |
;; SQL example translated to DataScript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pre><code class="language-klipse"> | |
(def default-config | |
{:chart {:zoomType :xy | |
:type :scatter} | |
:legend {:layout :vertical | |
:align :left | |
:verticalAlign :top | |
:x 100 | |
:y 70 | |
:floating :true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns ufo.core | |
(:use (incanter core stats charts datasets)) | |
(require [clojure.data.json :as json] | |
[clj-time.format :as tf] | |
[net.cgrand.enlive-html :as html] | |
[clojure.string :as string])) | |
;; URL with one month of data (january, 2015) | |
(def ufourl "http://www.nuforc.org/webreports/ndxe201501.html") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns pwprot | |
(:import (java.security MessageDigest Security))) | |
;;generate n random chars | |
(defn gensalt [n] | |
(let [charseq (map char (concat | |
(range 48 58) ; 0-9 | |
(range 97 123)))] ; 0-z | |
(apply str | |
(take n |