You should start a blog. Having your own little corner of the internet is good for the soul!
Inspired by Simon Wilson. I decided to try to resurect my long discarded blog. I wrote 2 things that I think are somewhat interesting.
I made the following script to download all Github projects into a directory. It is fun to see everything you have accumulated over the years. :)
curl -u <USERNAME>:<OAUTH_TOKEN> https://api.github.com/user/repos\?per_page\=100 | jq ".[].git_url" | tr -d '"' | while read in; do git clone $in; done
The last 2 months have seen a decline in my output. To combat this, I am implementing a new process that I hereby name the "CAR|CDR" system of productivity. CAR & CDR come from LISP Lore. I picked the name because I like saying CARKIDER phonetically.
It is really quite simple. I have a dynamic list of everything that is important to me. From projects to people to ideas to consumption to whatever. I enumerate every alternating day as either being a CAR (Head of the list) or CDR (rest of the list) day. For instance, this week MWFU are CAR (Head) days and TRS are CDR (Rest) days.
This book, I assume, is supposed to be parody? Right?
I am not sure at what point speculative fiction becomes parody. Similar to the line between erotica and pornography, it may be one of those "I can't tell you what it is, but I know it when I see it" kind of situations.
I wanted the opportunity to try out Planck (User Guide) (SDK), which lets you write shell scripts in clojurescript.
Wrote a small script to upload my blog into Github hosting.
contains?
will check (in the case of a map) for a key within a map. (contains? data v)
returns true
when v
is :a
or :f
. (contains? data :c)
will return false
as :c
is not a top level key in data
.
I need something that converts a particular key/value within a sequence of maps into a single map. this->that
will do nicely.
(defn this->that [this that vs]
"Build a map out of sequence vs; taking `this` as the key and `that` as the value from each"
(reduce
(fn [acc v] (assoc acc (this v) (that v)))
{}
vs))
;; -> {:key-1 :value-1, :key-2 :value-2}
Trying to get back into the swing of things in terms of writing. It is a muscle I need to exercise and all that. Start easy by just posting a movie review.
I think Hellboy (2019) is the second most frenetic movie I have ever seen (First goes to Crank 2 High Voltage). It is the most "Russian Doll"'ed plot in my recollection; felt like one backstory introduced every 15 minutes. Lots of exposition. Fair share of flashbacks. Narratively, it was a mess.
Converting a vector of values to a CSV in pure clojure. Not actually that interesting, just wanted the chance to try out klipse.
(ns example.silly-csv
(:require
[clojure.string :as string]))
(def csv
[["name" "age" "occupation" "gender"]
["Peter Pan" 312 "Lost Boy" "male"]
["Wendy Darling" 14 "Older Sister" "female"]
["Captain Hook" 330 "Pirate" "male"]
["Tinker Bell" nil "Fairy" "female"]])
(defn clean-str [s]
(pr-str (string/replace s "\n" "")))
(defn build-csv [xs]
(->> xs
(map (fn [xs] (map #(if (string? %) (clean-str %) %) xs))) ;; quote all strings
(map (partial string/join ",")) ;; seq of seq -> seq of strings
(string/join "\n"))) ;; seq of string -> string
(println (build-csv csv))
Datastore (Google App Engine) does not let you lock the database. So how do you map across every element in Datastore? Here is a very rough and tumble solution to that problem.