org.candelbio.multitool.cljcore
base64-decode
(base64-decode b64-string)
base64-encode
(base64-encode string)
content-files
(content-files dir & regex)
copy-paths
(copy-paths in-path out-path)
Copy in-path to out-path, in-path can be URI or filename, out-path should be a file
dataset-fields
(dataset-fields ds)
date+
(date+ date days hours minutes)
directory-files
(directory-files d filterfn)
download
(download uri file)
Common use case for copy-paths
ensure-directory
(ensure-directory d)
Create directory if it doesn’t exist (recursively)
ensure-file
(ensure-file f)
Ensure that the directory structure to contain this file exists
error
(error s & args)
Throw a generic Exception with formatted string
error-message
(error-message e)
Given an exception, returns the error message
expand-homedir
(expand-homedir path)
file-delete-recursively
(file-delete-recursively fname)
Delete a directory and its contents
file-delete-safe
(file-delete-safe fname)
Delete a file or directory safely (that is, no error if doesn’t exist)
file-exists?
(file-exists? path)
file-lines
(file-lines file)
file-lines-out
(file-lines-out file seq)
file-seq-filtered
(file-seq-filtered remove-fn dir)
A tree seq on java.io.Files
git-log-info
(git-log-info file)
returns [user email timestamp msg commit] of last commit for file
humanize-number
(humanize-number n)
invoke-private
(invoke-private o methodname)
java-resource->string
(java-resource->string resource)
join-path
(join-path & args)
Joins the elements passed in into a path
list-dir-recursive
(list-dir-recursive dir)
Like fs/list-dir, but recurses through subdirectories and does not include dirs in result. Ignore .dotfiles
local-file
(local-file url)
(local-file url local-file)
Make a copy of contens of url in a local temp file or supplied filename
parse-boolean-or-nil
(parse-boolean-or-nil value)
parse-long-or-nil
(parse-long-or-nil value)
pdoseq
macro
(pdoseq seqs & body)
Like doseq but each iteration gets its own thread.
pdoseq*
macro
(pdoseq* seqs & body)
Like doseq* but each iteration gets its own thread.
pmap-keys
(pmap-keys f hashmap)
Map f over the kes of hashmap in parallel
pmap-values
(pmap-values f hashmap)
Map f over the values of hashmap in parallel
process-file-lines
(process-file-lines f in out)
processors
(processors)
Return the number of available processors
read-chars
(read-chars reader n)
read-csv-maps
(read-csv-maps f)
Read a csv file into maps
read-csv-rows
(read-csv-rows f)
Read a csv file into vectors
read-from-file
(read-from-file file)
read-tsv-maps
(read-tsv-maps f & [separator])
Given a tsv file with a header line, returns seq where each elt is a map of field names to strings
read-tsv-rows
(read-tsv-rows f & [separator])
Read a tsv file into vectors
reader
(reader file)
Return a reader for a file, with homedir expansin
schpit
(schpit f content & options)
Like core/spit, but will do something sensible for lazy seqs.
schppit
(schppit f content & options)
Like schpit but will prettyprint.
sh-errchecked
(sh-errchecked & args)
sh-str
(sh-str s)
Version of sh that takes a single string, which can include pipe operators etc
sh-template
(sh-template template params)
Version of sh uses templating
split-path
(split-path path)
Splits a path delimited with /
start-periodic-process!
(start-periodic-process! t f)
Start a background process to execute thunk f every t mssc
string-search-all
(string-search-all string sub & [start])
Return a sequence of all positions where sub is found in string
substitute-file-lines
(substitute-file-lines map)
temp-dir-path
(temp-dir-path)
temp-file-path
(temp-file-path)
timing-fn
(timing-fn f)
Returns a fn that acts like f, but return value is (time result), time in msec]
write-csv-maps
(write-csv-maps f rows)
write-csv-rows
(write-csv-rows f rows)
write-tsv-maps
(write-tsv-maps f rows & {:keys [separator cols], :or {separator \tab}})
write-tsv-rows
(write-tsv-rows f rows & [separator])
writer
(writer file)
Return a writer for a file, with homedir expansin