Stephen Cagle

Menu

  • Home
  • Archives
  • About Me
  • RSS

Download all Github projects to a directory

October 17, 2020

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

Continue reading →

CAR & CDR system of productivity

September 29, 2020

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.


Continue reading →

Supernova Era by Cixin Liu

September 27, 2020

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.


Continue reading →

Push Blog to Github Hosting using Planck

May 6, 2019

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.


Continue reading →

Quick Containment in a Arbitrary Depth Map

May 3, 2019

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.

Problem


Continue reading →

This To That

April 24, 2019

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}

Continue reading →

Hellboy (2019)

April 13, 2019

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.


Continue reading →

Build a CSV in Clojure

December 23, 2017

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))

Continue reading →

Pagination on Google App Engine Standard

December 21, 2017

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.

Usage


Continue reading →

Random crazy

July 22, 2017

Him: "Another museum on it's way..."

Me: "What?"

Him: "I mean, if you had an atomic aircraft, where would you park it?"

Me: ... \ ... "Area 51?"

Him: Momentary shock registers on his face, skuddles/crab walks away.

Just a random conversation with some of the fairly obviously tweaking tenants in my apartment...


Continue reading →
Next »

Copyright © 2020 Stephen Cagle