Skip to content

Instantly share code, notes, and snippets.

View daveliepmann's full-sized avatar

Dave Liepmann daveliepmann

View GitHub Profile
@daveliepmann
daveliepmann / load_edn.cljd
Created September 11, 2023 13:11
clojuredart mvp of loading edn from asset file
(ns sample.load-edn
"Load EDN from asset on startup"
(:require
["package:flutter/material.dart" :as m]
["package:flutter/widgets.dart" :as f.widgets]
["package:flutter/services.dart" :as f.services]
[cljd.flutter :as f]
[cljd.reader]))

Speech at the American Legion

Hans Liepmann, circa 1946-8


During the long weary days and nights I spent in the Army, I had ample time to think about my American citizenship. I knew Germany under the Kaiser, during the Weimar Republic, in the beginning of Hitler’s regime and I saw it again at the end of it. Therefore, I had quite some occasion to compare it with America and maybe some of my experiences and observations will be interesting for you to hear. I consider it a great honor to be asked by the American Legion to talk to you and I thank the chairman very much.

You heard in the introduction a short outline of my story but I may be permitted to say a few more words about it. In 1933, when Hitler was chancellor, I received a letter from the government that from the next day on I, being a Jewish physician, was not permitted any longer to take care of patients who were members of the medical insurance companies. That was not so terribly bad in itself. But at that

@daveliepmann
daveliepmann / tensor-with-placeholders.clj
Last active April 16, 2018 13:52
"Construction of a trivial graph to add two float tensors and then repeated invocation of the single graph using placeholders", from https://github.com/tensorflow/tensorflow/issues/6781#issuecomment-271888411 in Clojure based on the original Java
;; make sure your ns has `(:import [org.tensorflow DataType Graph Output Session Tensor])`
;; or if in REPL, evaluate `(import [org.tensorflow DataType Graph Output Session Tensor])` first
;; Construct a graph to add two float Tensors, using placeholders.
(let [g (Graph.)
s (Session. g)
x (-> (.opBuilder g "Placeholder" "x")
(.setAttr "dtype" DataType/FLOAT)
(.build)
(.output 0))
@daveliepmann
daveliepmann / java-interop2.md
Last active April 26, 2021 03:03
Java interop for the Clojurists who haven't done Java and who need to translate Java code to Clojure
;; 300x300 seems to be about where performance starts to degrade.
(let [i (cell (interval :frame inc))]
(cell
(apply layer
(for [x (range 0 300 20)
y (range 0 300 20)]
(let [angle (* (/ 3.14 180) (+ @i x y))]
(position (+ x (* 15 (Math/cos angle)))
(+ y (* 15 (Math/sin angle)))
;; # One-Rep-Maximum Calculator
;; People who strength train often want to predict the maximum weight they could lift for one repetition. This is because actually making a maximal attempt is tiring, slightly risky, and difficult to repeat. Let's see how to guess our "1RM" using sub-maximal attempts.
;; If you need to re-evaluate one of the code blocks below, put your cursor in it and press `Control-Shift-Enter` (`Command-Shift-Enter` on Mac).
;; ## Equations
;; There are many equations used to predict one-repetition maximum based on the greatest weight lifted for two to ten reps. All are unavoidably inexact. One popular method for determining your 1RM comes from Baechle, Earle, and Wathen (2000):
@daveliepmann
daveliepmann / clojurebridge_02_data_structures.cljs
Last active August 5, 2017 07:40
ClojureBridge Berlin curriculum 2: Data Structures
;; # Data Structures
;;
;; So far, we've dealt with discrete pieces of data: one number, one
;; string, one value. When programming, it is more often the case that
;; you want to work with groups of data.
;;
;; Clojure has great facilities for working with these groups, or
;; *collections*, of data. Not only does it provide four different types
;; of collections, but it also provides a uniform way to use all of these
@daveliepmann
daveliepmann / gallery.cljs
Last active August 14, 2017 11:56
Gallery of example expressions, for Maria
;; # A whirlwind tour of Maria.cloud
;; ### 🔺 🔷 🔴 🔶 🔵 🔻
;; The first thing you should do is draw something:
(circle 50)
;; we provide an extensive picture language:
(layer
;;;; Fernseheturm
(def base
(layer (position 35 90 (colorize "grey" (circle 25)))
(position 34 0 (colorize "grey" (rectangle 4 300)))
(position 29 108 (colorize "grey" (rectangle 12 222)))
(position 29 50 (colorize "grey" (rectangle 12 16)))
(position 15 315 (colorize "grey" (triangle 40)))
(position 26 125 (colorize "grey" (rectangle 18 16)))
(position 24 182 (colorize "grey" (rectangle 5 158)))