Skip to content

Instantly share code, notes, and snippets.

View elliot42's full-sized avatar

Elliot Block elliot42

  • Form Energy
  • Berkeley, CA
View GitHub Profile

Automating database snapshots to Framed

Taking snapshots of your data and turning them into analyzable CSVs is a best- practice for any team. CSV is the lingua franca of data analysis, so we encourage everyone to regularly generate CSVs, read them yourselves, and push them to Framed consistently to get the best analysis possible.

Automating CSV upload requires an automatic task scheduler such as cron--we're happy to help set you up with a scheduler if you don't have one.

@elliot42
elliot42 / gist:935d5305250602c40e48
Last active August 29, 2015 14:27
clojurescript compilation

How does CLJS compilation work, and interact with the CLJ/CLJS REPL?

Two separate concepts:

  1. Input source
  2. :output-dir

The terms mean the same thing for both:

  1. The compiler in cljs.build.api/build

I think the underlying thing I am trying to wrangle is:

  • the concept of static invariant assertion is useful and admirable
  • the language with which you specify those invariants (i.e. the practicalities of the type system) is important;
  • your work will be to express your program that is both correct and typechecks, i.e. expresses its invariants such that the type checker will accept it
  • the practicalities of the type system determine how fast, elegant, simple or not the process of declaring these contraints is
  • it's not obvious beforehand whether or not your program is in the set of programs that is elegantly expressible to a type system (and this obviously varies depending upon the power/cleanliness of the type system in question, e.g. I think the structural vs. nominal distinction above is huge)
  • because the expression of the types is not enough to guarantee correctness, to actually programmatically check correctness one needs tests, and test coverage will naturally include type correctness
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/transit_python-0.8.240_-py2.7.egg/transit/reader.py", line 38, in read
File "/usr/local/lib/python2.7/dist-packages/transit_python-0.8.240_-py2.7.egg/transit/reader.py", line 79, in load
File "_unpacker.pyx", line 140, in msgpack._unpacker.unpack (msgpack/_unpacker.cpp:140)
File "_unpacker.pyx", line 123, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:123)
msgpack.exceptions.ExtraData: unpack(b) received extra data.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/transit_python-0.8.240_-py2.7.egg/transit/reader.py", line 38, in read
File "/usr/local/lib/python2.7/dist-packages/transit_python-0.8.240_-py2.7.egg/transit/reader.py", line 64, in load
File "/usr/lib/python2.7/json/__init__.py", line 290, in load
**kw)
File "/usr/lib/python2.7/json/__init__.py", line 351, in loads
return cls(encoding=encoding, **kw).decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 369, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
top 12 language features to learning the core of clojure
1. def
- http://www.braveclojure.com/do-things/#1_3__Naming_Things_with_def
2. defn
- http://www.braveclojure.com/do-things/#3_3__Defining_Functions
3. calling functions, `apply`
(let [k0 (rand-int 1024)
v0 (rand-int 1024)
k1 (rand-int 1024)
v1 (rand-int 1024)
;; literal with dynamic keys/Val's
m {k0 v0, k1 v1}
;; evolving a map
m0 {k0 v0}
https://archive.ics.uci.edu/ml/datasets/Iris

If you can succeed at something, without requiring a whole lot of assembly behind it (infrastructure, army of minions), then you will either succeed and win competitively (because you can achieve without needing the resources that others need), or will fail completely.

user=> (do (req) (require '[environ.core :refer [env]])
#_=> (def conn (d/connect (:datomic-uri env)))
#_=> (def db (d/db conn)))
CompilerException java.lang.NullPointerException, compiling:(form-init18989935185954061.clj:2:13)