Skip to content

Instantly share code, notes, and snippets.

View SplitCSVStorm
cd ~/annals/storm/
mkdir Storm202{0,1}
cat Storm\ 2020\ Transactions.csv | parallel --header : --pipe -N500000 'cat >Storm2020/Storm2020_{#}.csv'
cat Storm\ 2021\ Transactions.csv | parallel --header : --pipe -N500000 'cat >Storm2021/Storm2021_{#}.csv'
zip -r storm.zip Storm202[01]
View SplitCSVStorm
cd ~/annals/storm/
mkdir Storm202{0,1}
cat Storm\ 2020\ Transactions.csv | parallel --header : --pipe -N500000 'cat >Storm2020/Storm2020_{#}.csv'
cat Storm\ 2021\ Transactions.csv | parallel --header : --pipe -N500000 'cat >Storm2021/Storm2021_{#}.csv'
zip -r storm.zip Storm202[01]
View cse121aweek2.clj
;; To get factorial of 5
(* 5 4 3 2 1)
;; To get factorial of n: n!
(apply * (range 5 0 -1)
View test_check_shrink.clj
(require '[clojure.test.check.random :as random]
'[clojure.test.check.generators :as gen]
'[clojure.test.check.rose-tree :as rt])
(defn shrinks
"Shows how a generator will shrink"
([g] (shrinks g 10 10))
([g size] (shrinks g size 10))
([g size sample] (take sample (distinct (map rt/root
(tree-seq (fn [_] true) rt/children (gen/call-gen g (random/make-random) size)))))))
View named_schema.clj
(require '[clojure.test.check.generators :as gen])
(require '[clojure.string :refer [join]])
(require '[schema-generators.generators :as g])
(require '[schema.core :as s])
(def IP String)
#_(def IP (s/named String "IP"))
@m0smith
m0smith / bug_fix.clj
Created Aug 26, 2019
Fixes StackOverflowError with Cider, Datomic Ions and Nrepl
View bug_fix.clj
(ns bug-demo
(:require [datomic.ion.cast :as cast]
[clojure.java.io :refer [output-stream]]))
(cast/initialize-redirect :stderr) ; instead of :stdout
(cast/event {:msg "ShouldNotCauseAStackOverflowErrorInCider"})
@m0smith
m0smith / bug_demo.clj
Created Aug 26, 2019
Shows a problem with stackover flow using cider and datomic ions
View bug_demo.clj
(ns bug-demo
(:require [datomic.ion.cast :as cast]
[clojure.java.io :refer [output-stream]]))
(cast/initialize-redirect :stdout)
(cast/event {:msg "ShouldNotCauseAStackOverflowErrorInCider"})
@m0smith
m0smith / kaocha-deps.edn
Last active Aug 14, 2019
Koacha setup in deps.edn for use with Bitbucket Pipeline
View kaocha-deps.edn
:kaocha {:extra-paths ["test"]
:extra-deps {lambdaisland/kaocha {:mvn/version "0.0-529"}
lambdaisland/kaocha-junit-xml {:mvn/version "0.0-70"}
lambdaisland/kaocha-cloverage {:mvn/version "0.0-32"}
cloverage {:mvn/version "RELEASE"}
}
:main-opts ["-m" "kaocha.runner"
"--plugin" "kaocha.plugin/junit-xml"
"--plugin" "cloverage" "--no-cov-summary"
"--junit-xml-file" "target/test-results/junit.xml"]}
@m0smith
m0smith / vc.py
Created Feb 2, 2017
VC scripts for unified SVN and GIT
View vc.py
#!/usr/local/bin/python
import os
import subprocess
import sys
commands ={ ".svn" : ["svn","-u","status"],
".git" : ["git", "status"] }
def parent_dirs(f_or_d):
View resource-in-archives.el
(defun list-to-hash (coll)
(let ((rtnval (make-hash-table :test 'equal)))
(cl-loop for r across coll
when r
do (puthash (elt r 1) nil rtnval))
rtnval))
(defun jdee-open-source-resource-in-archive-p (archive resource)
""