Skip to content

Instantly share code, notes, and snippets.

@realgenekim
realgenekim / example.clj
Created November 6, 2023 21:07
Simple example of using wkok/openai-clojure library in streaming mode
(ns openai.a01-async-openai
(:require
[com.fulcrologic.guardrails.core :refer [>defn >defn- >def | ? =>]]
[wkok.openai-clojure.api :as api]
[openai.companies :as companies]
[diehard.core :as dh]
[clojure.data.json :as json]
[clojure.edn :as edn]
[clojure.spec.alpha :as s]
[clojure.core.async :as a :refer [<!! >!! <! >!]]
@realgenekim
realgenekim / wiring-winning-org-prompt.md
Last active November 4, 2023 18:12
Prompt I've been using on OpenAI GPT-4 and GPT3.5, and Claude 2. Maybe I'll put into a separate repo, because I'm modifying it all the time.

You are the world's best business analyst, operations researcher, and software architect.

Gene Kim (co-author of "Phoenix Project," "DevOps Handbook, etc.) and Steve Spear (author of "High Velocity Edge" and "Decoding the DNA of the Toyota Production System") wrote a new book together: "Wiring the Winning Organization."

In this book, they describe three mechanism:

  • Slowification: problem-solving is pulled back from fast-paced operations to more deliberate planning and practice (e.g., tabletop exercises, simulation, paper prototypes, fire drills, disaster recovery drills, Netflix Chaos Monkey). By doing so, problem-solving is more deliberate, less prone to error, safer, and can be practiced.

  • Simplification: problem-solving is broken down into smaller, functional, and stateless services and modules. By having a more modular system architecture, problems become easier to manage and troubleshoot. Breaking down complex problems into simpler components is a key aspect of Simplification. There ar

@realgenekim
realgenekim / gist:b83a378dbe4a7ca91fb67adfd14908f7
Created October 20, 2023 04:21
tampermonkey script for Piwaa: messaging for linkedin: put in keyboard accelerator to archive message
// ==UserScript==
// @name Piwaa: Linkedin Messages: keyboard accelerators
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Script to accept all the follow requests
// @author You
// @match https://app.piwaa.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=linkedin.com
// @grant none
// ==/UserScript==
@realgenekim
realgenekim / gist:0234c5dd6ad093f57fa9b885f2bd5cd3
Created October 19, 2023 04:55
Expensify tampermonkey script: highlight in pink the comment field (not very visible), and certain expense categories
// ==UserScript==
// @name Highlight Expensify comment fields and dropdown boxes set to certain values
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.expensify.com/expenses
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
@realgenekim
realgenekim / compact-report-control.cljc
Last active January 14, 2023 20:43
Custom compact report layout that puts pagination control into the first row, between the report title and control buttons
(ns com.example.ui.custom-report-control
(:require
#?@(:cljs
[[com.fulcrologic.fulcro.dom :as dom :refer [div]]
[com.fulcrologic.semantic-ui.addons.pagination.ui-pagination :as sui-pagination]]
:clj
[[com.fulcrologic.fulcro.dom-server :as dom :refer [div]]])
[clojure.string :as str]
[com.fulcrologic.fulcro.components :as comp]
[com.fulcrologic.fulcro-i18n.i18n :refer [tr trc]]
@realgenekim
realgenekim / does-titles.titles.clj
Last active October 6, 2022 03:09
These are selected portions of the code to do the analysis presented here: Analysis Of DevOps Enterprise Summit Speaker Titles (2014-2022): http://itrevolution.com/speaker-titles
; I'll post entire repo of how to use this analysis code, but I wanted to get something
; up right away
;
(ns does-titles.titles
(:require
[better-cond.core :as b]
[clojure.string :as str]
[clojure.test :refer :all]
[com.fulcrologic.guardrails.core :refer [>defn >defn- >def | ? =>]]))
(ns com.example.state-machines.incrementally-loaded-report-gk
;(ns com.fulcrologic.rad.state-machines.incrementally-loaded-report
"Gene modifications to incrementally-loaded-report --
This has the same interface as the 'incrementally-loaded-report' UISM included in RAD.
https://github.com/fulcrologic/fulcro-rad/blob/develop/src/main/com/fulcrologic/rad/state_machines/incrementally_loaded_report.cljc
However, instead of rendering only after the resolver resturns the entire data set,
it renders immediately after the first load completes, and use df/load! to asynchronously load
; @tony.kay Good talking yesterday — and you’ve turned me into a believer on UI State Machines.
; You had suggested that instead of replacing each state, one by one, to just copy the entirety into my
; namespace, to make it easier.
;
; Got all the needed changes to lazily load all the Trello card comments very quickly. Eventually, I’ll post the diffs vs. the default RAD report state machine, which will make it more obvious what my changes were. But, just in case, to anyone who might find it helpful, here’s what I did.
;
; change any :: to ::report
; wrote a my-load-report! my-goto-page* and a load-comments-for-page
;
; Surprisingly straightforward to do, as @holyjak and @tony.kay predicted!
@realgenekim
realgenekim / README.md
Last active July 21, 2023 14:29
How to download all Clojure dependencies using clj (equivalent to "lein deps")

I recently had to figure out for a Clojure application how to download all dependency JAR files, for use in a Docker container.

When creating an uberjar, depstar re-downloaded all the external dependencies from Maven central, even though in an earlier Docker build step, I ran clj -Spath to pre-download them (presumably cached into the .m2 directory). In the past, I've used lein deps to do something similiar.

I'm grateful for Sean Corfield helping out (again!!): In short, use clj -P (short for "prepare") to download dependencies. Note the "A:depstar" option, which ensures that the depstar dependencies are downloaded, too.

Here's what it looks like in a Dockerfile:

# to pre-download dependencies, only done if deps.edn changes
@realgenekim
realgenekim / db.clj
Last active February 16, 2021 17:58
Example of getting UTF-8 working with next.jdbc with MySQL, to enable Unicode and emojis, along with using using "REPLACE" instead of "INSERT" to enable upserts.
(ns db.db2
(:require
[next.jdbc :as j]
[next.jdbc.sql :as jsql]
[next.jdbc.sql.builder :as jb]
[clojure.spec.alpha :as s]))
(def mysql-db {:dbtype "mysql"
:dbname "twitter"
:host "127.0.0.1"