Skip to content

Instantly share code, notes, and snippets.

View eightysteele's full-sized avatar

Aaron Steele eightysteele

View GitHub Profile
eightysteele:midje-cascalog(develop)$ git rev-parse HEAD
b8c210d9f99e0cbf1e44c01dadebecdbae84a473
eightysteele:midje-cascalog(develop)$ lein -v
Leiningen 2.0.0 on Java 1.7.0_15 OpenJDK 64-Bit Server VM
eightysteele:midje-cascalog(develop)$ lein repl
Retrieving midje/midje/1.5-beta3/midje-1.5-beta3.pom from clojars
Retrieving org/clojure/clojure/1.4.0/clojure-1.4.0.pom from central
Retrieving org/sonatype/oss/oss-parent/5/oss-parent-5.pom from central
Retrieving ordered/ordered/1.2.0/ordered-1.2.0.pom from clojars
Retrieving org/clojure/math.combinatorics/0.0.1/math.combinatorics-0.0.1.pom from central
eightysteele:midje-cascalog(develop)$ lein -v
Leiningen 2.0.0 on Java 1.7.0_15 OpenJDK 64-Bit Server VM
eightysteele:midje-cascalog(develop)$ lein repl
Retrieving midje/midje/1.5-beta3/midje-1.5-beta3.pom from clojars
Retrieving org/clojure/clojure/1.4.0/clojure-1.4.0.pom from central
Retrieving org/sonatype/oss/oss-parent/5/oss-parent-5.pom from central
Retrieving ordered/ordered/1.2.0/ordered-1.2.0.pom from clojars
Retrieving org/clojure/math.combinatorics/0.0.1/math.combinatorics-0.0.1.pom from central
Retrieving org/clojure/pom.contrib/0.0.21/pom.contrib-0.0.21.pom from central
Retrieving org/clojure/clojure/1.3.0-alpha6/clojure-1.3.0-alpha6.pom from central
@eightysteele
eightysteele / georef.json
Last active December 10, 2015 18:48
WIP: Geomancer API JSON response. The georefs.feature is a GeoJSON Feature Object (http://www.geojson.org/geojson-spec.html#feature-objects) and the geometry can be any GeoJSON Geometry object (http://www.geojson.org/geojson-spec.html#geometry-objects).
{
"locality":{
"original":"Berkeley",
"normalized":"berkeley"
},
"georefs":[
{
"feature":{
"type": "Feature",
"bbox": [-180.0, -90.0, 180.0, 90.0],
;; via @sritchie, master butcher:
(defn beast-mode [m]
(let [zip (partial map vector)
[ks v-colls] (apply zip m)]
(for [vs (apply zip v-colls)]
(zipmap ks vs))))
(comment
(let [partitions {:title ["a" "b" "c"] :links [1 2 3] :name [:aaron :tina :noah]}]
(beast-mode partitions)))
mps.publish(
mps.create(
'Chat',
'onchat',
{message: 'Hey @andrewxhill, what is up yo', idea_id: 'agxzfmNyb3dkc2NhbGVyCwsSBElkZWEY0w8M'}));
(use 'forma.hadoop.jobs.scatter)
;; put stuff in pail
(let [pail-path "/Users/robin/delete/tmp/newpail"
vcf-src [(thrift/DataChunk* "vcf"
(thrift/ModisPixelLocation* "500" 28 8 0 0)
25
"00")]
gadm-src [(thrift/DataChunk* "gadm"
(thrift/ModisPixelLocation* "500" 28 8 0 0)
;; Map of lat/lon min and max values.
(def latlon-range {:lat-min -90 :lat-max 90 :lon-min -180 :lon-max 180})
(defn latlon-valid? [lat lon]
"Returns true if lat and lon are valid, otherwise returns false."
(let [{:keys [lat-min lat-max lon-min lon-max]} latlon-range]
(and (<= lat lat-max)
(>= lat lat-min)
(<= lon lon-max)
(>= lon lon-min))))
(import '[java.util UUID])
(defn uuid-stream []
(repeatedly #(str (UUID/randomUUID))))
(defn domain-map [root-path n]
(let [name-seq (take n (uuid-stream))]
(->> (map (partial str root-path "/") name-seq)
(interleave name-seq)
(apply hash-map))))
{
"properties":{
"areas":{
"values":{
"Spizocorys_personata:1.0":24352145855.3125,
"Hylocharis_chrysura:1.0":3110523285033.5,
"Caprimulgus_solala:1.0":0,
"Phylloscopus_chloronotus:1.0":379180718196.1875,
"Geothlypis_chiriquensis:1.0":0,
"Hylorchilus_sumichrasti:1.0":11687204311.5,
{
"properties":{
"areas":{
"values":{
"Hylocharis_chrysura:1.0":3114936261984.672,
"Molothrus_armenti:1.0":0,
"Phylloscopus_chloronotus:1.0":378906273745.875,
"Geothlypis_chiriquensis:1.0":0,
"Hylorchilus_sumichrasti:1.0":11688389637.148438,
"Anthracothorax_veraguensis:1.0":0,