Skip to content

Instantly share code, notes, and snippets.

View raymcdermott's full-sized avatar

Ray McDermott raymcdermott

  • OpenGrail
  • Belgium
View GitHub Profile
@raymcdermott
raymcdermott / jokes.clj
Last active February 11, 2023 17:28
Dumb quote transformations
(defn joke? [quotations r1 r2]
(let [[quotation author] (rand-nth quotations)
words (string/split quotation #" ")
words-count (range (count words))
[i1 i2] (take 2 (shuffle words-count))
start (vec (take (dec i1) words))
start (conj start (rand-nth r1))
remainder (drop i1 words)

ok2cry - end to end cryptography for the API ecosystem.

The following story explains the business need that gave birth to ok2cry. It shows why the need will continue to increase.

Composing products: to innovate in business and to delight customers

A fintech company wanted to offer credit cards to its customers over the loan product that they offered. In the modern manner, they outsourced the credit card management to another company. This kept them out of any regulatory controls which keeps costs and risk to a minimum. It offered an efficient way to quickly launch this new option and make their product more valuable and desirable to customers.

High security standards

The fintech company were using state-of-the-art cloud services to run their operations and manage customer access using Multi-Factor Authentication (MFA).

AWS Lambda, now with first class parentheses

A simple, powerful and compelling story for deploying Clojure with no overhead on AWS Lambdas.

NBB

Keybase proof

I hereby claim:

  • I am raymcdermott on github.
  • I am raymcdermott (https://keybase.io/raymcdermott) on keybase.
  • I have a public key ASBzSH6LGCylAeFE3FiusmnPT-4axjypt15F-CXfalAC3go

To claim this, I am signing this object:

@raymcdermott
raymcdermott / depgen.md
Last active November 25, 2019 19:20
Adhoc CLJS dependency generation

Introduction

A conversation started at the Heart of Clojure conference in Belgium on Friday August 2nd 2019.

The group represented project owners from Maria.Cloud, Next.Journal, Klipse and Replete-Web. The projects make significant use of self-hosted CLJS.

This is a proposal to have a service that generates and caches JS files for a specific CLJS dependency (name & version).

Background

The ClojureScript compiler generates JS files for each of an apps stated CLJS dependencies. The runtime environment then loads each of the needed JS files to satisfy the dependency at runtime.

;; Simplest use cases
;; Transform simple input
(map inc [1 2 3 4 5])
(map str [1 2 3 4 5])
(map clojure.string/lower-case ["COBOL" "Ada" "C"])
;; Extract simple input
@raymcdermott
raymcdermott / decoding-jwt.clj
Last active October 26, 2022 05:47
Simple JWT Decoder in Clojure
(defn base64-decode
"Utility function over the Java 8 base64 decoder"
[to-decode]
(String. (.decode (Base64/getDecoder) ^String to-decode)))
(defn string->edn
"Parse JSON from a string returning an edn map, otherwise nil"
[string]
(when-let [edn (json/decode string true)]
(when (map? edn)
; TODO: have a way to have this list provided / augmented by users
(def ^:private oidc-discovery
"Map from TLDs to discovery endpoints"
{"auth0.com" ".well-known/jwks.json"
"google.com" ".well-known/openid-configuration"})
(defn- get-jwt-data
"Obtain JWT related data and parse it into a Clojure map"
[endpoint]

The person, one Mr Cuntis Yarvin, at the centre of the #lamdaconf debacle performed an Ask Me Anything on Reddit. One of his defenders on Twitter referenced this response from the AMA as proof that he was not racist.

I appreciate that giving more commentary space to this situation provides the oxygen that our protagonist craves. On the other hand I feel like this is sufficiently important to our community to stand up and defend those people that this person seeks to diminish and damage.

So, with that and a deep breath, let's take this response bit by bit and see whether it works out as a defence by the protagonist as evidence of his lack of racism.

Amusingly, my "one offensive comment" was actually me repeating something my wife (not at all a 'shitlady') learned in her MFA program at SF State (not at all a Hitler Youth academy). (This is the observati

@raymcdermott
raymcdermott / source-gold-diff.clj
Last active March 24, 2016 23:08
Obtain diff between source data and golden view
(def api-data {:source-data {:fname "Ray", :last "McDermott", :e-mail "foo@bar.com"},
:golden-view {:first "Ray", :last "McDermott", :email "bar@bar.com", :dob "29/04/2004"},
:mapping {:email :e-mail, :first :fname, :last :last}})
;=> #'user/api-data
(defn source-golden-diff [source-data golden-view source-map]
(let [common-keys (let [keys (clojure.set/intersection (set (keys golden-view))
(set (keys source-data)))]
(into {} (map #(vec [% %]) keys)))