Skip to content

Instantly share code, notes, and snippets.

@jebberjeb
jebberjeb / OpenAISheets.gs
Created February 12, 2024 18:46
OpenAISheets.gs
var API_KEY = "<your api key>"
function NUGPT(instructions, prompt, model) {
var payload = {
'model': (model || "gpt-3.5-turbo-0125"),
'messages': [
{
'role': 'system',
'content': instructions
(def jp-fsm {:init :uninitialized
:entity-type :journalpost
:state-field :journalpost/status
:states {:uninitialized {:transitions [{:event :oprettet
:target :udkast}]}
:udkast {:entities {:journalnote '...}
:transitions [{:event :lock
:target :laast}
{:event :update}]}
:laast {:transitions [{:event :open
(use '[specviz.graphviz])
(def states {:no-warn {:missed-first-name :first-name-required
:missed-last-name :last-name-required
:missed-dob-day :dob-required
:missed-dob-month :dob-required
:missed-dob-year :dob-required
:missed-ssn-area :ssn-required
:missed-ssn-group :ssn-required
:missed-ssn-serial :ssn-required
@jebberjeb
jebberjeb / logback-partial.xml
Created January 12, 2017 22:05
Logback appender used with Stuart Sierra's log.dev
<appender name="ALL_LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- Default encoder is ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
<encoder>
<pattern>%date{HH:mm:ss.SSS} %-5level %logger{25}: %msg %X thread=%thread%n</pattern>
</encoder>
<!-- Default location of log file is log/all.log -->
<file>log/all.log</file>
(ns user)
(require '[twou.centralpark.model.publish :as publish])
(require '[clojure.string :as string])
(require '[datomic.api :as d])
;; Get all attributes
(def all-attrs (d/q '[:find [?name ...]
:where [?eid :db/ident ?name]]
(dev/db)))
(ns vatican.schema
"Extract the schema from a Datomic database."
(:require [datomic.api :as d]))
(defn gen-mem-db-uri
"Generate a unique uri for use with an in-memory Datomic database."
[]
(str "datomic:mem://" (d/squuid)))
;; TODO: parameterize the partition
@jebberjeb
jebberjeb / saml.clj
Created September 27, 2016 18:46
Parse SAML metadata with clojure spec
(ns foo.saml
(:require
[clojure.spec :as s]
[clojure.string :as string]
[clojure.xml :as xml])
(:import
(java.io ByteArrayInputStream)))
(s/def :sso/Binding #{"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"})
(s/def :sso/attrs (s/keys :req-un [:sso/Binding ::Location]))
(defn generate-order
[db taskdefs ref-kw]
(->> taskdefs
(map :db/id)
(workflow/sort-taskdefs db)
(map (fn [id] (d/entity db id)))
(map :task.def/id)
(map (fn [id] [ref-kw id]))))
(defn generate-order*
@jebberjeb
jebberjeb / test.clj
Created December 3, 2015 20:51
Subscriptions Data Test
(deftest subscriptions-perf-test
(testing "subscriptions messages all received"
(let [broker (d/start-broker)
subs-count 10
reply-tos (repeatedly subs-count #(a/chan 1024))
group-code "foo" #_(generate-l85-uuid)
subs-str (str "group_s:" group-code)
test-record-count 10000
subs-reply-count (atom 0)]
@jebberjeb
jebberjeb / tmux.clj
Last active September 10, 2015 18:01
(ns si.tmux
(:require [clojure.string :as str]
[si.data :as d]))
(defn ->ssh-cmd
"Create remote ssh command."
[ssh-user command host]
(str "ssh -t " ssh-user "@" host " \"" command "\""))
(defn gen-conf