This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
SERVER= | |
CLIENT_NAME= | |
CLIENT_ID= | |
CLIENT_SECRET= | |
AUTH_CODE= | |
ACCESS_TOKEN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#_( | |
true; exec clj -J-Xmx256M -J-XX:-OmitStackTraceInFastThrow -Sdeps "`sed -n -e '/;;(DEPS$/,/;;DEPS)$/p' $0`" -M -i $0 -e '(user/main)' | |
) | |
(ns user | |
#?(:cljs (:require-macros [user :as m])) | |
(:require | |
#?@(:clj ([cljs.build.api :as cljs] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import '(java.util ArrayList | |
List) | |
'(java.util.concurrent.locks ReentrantLock) | |
'(java.util.concurrent.atomic AtomicReference | |
AtomicReferenceArray)) | |
(set! *warn-on-reflection* true) | |
(set! *unchecked-math* :warn-on-boxed) | |
;; TODO: should you be able to sync multiple times on the same event |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro let-macro | |
([bindings body] | |
(let [names (map first bindings)] | |
`(let-macro ~(eval `(letfn ~bindings ~(into {} (map (fn [n] [(list 'quote n) n])) names))) | |
~identity | |
~body))) | |
([bindings k body] | |
(cond (and (seq? body) | |
(symbol? (first body)) | |
(contains? bindings (first body))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat > /tmp/storeid.lisp <<EOF | |
#!/usr/bin/sbcl --script | |
(loop | |
(let* ((parts (list "")) | |
(_ (loop for c across (read-line) do | |
(cond | |
((equal c #\Space) | |
(setf parts (cons "" parts))) | |
('t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn generate-state-machine [init-state inputs states state transition? accum] | |
(gen/sized | |
(fn [size] | |
(if (zero? size) | |
(let [prev (into {} (for [[a b] (partion-all 2 1 (sort inputs))] [b a]))] | |
((fn f [events] | |
(gen/gen-pure | |
(rose/make-rose | |
events |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro return% [a] | |
`(fn return-fn# [success# error#] | |
#(try | |
(success# ~a) | |
(catch Throwable t# | |
(error# t#))))) | |
(defn bind% [m b] | |
(fn a [success error] | |
#(m (fn x [value] ((b value) success error)) error))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let [addr (java.net.UnixDomainSocketAddress/of "/tmp/222") | |
sc (doto (java.nio.channels.ServerSocketChannel/open java.net.StandardProtocolFamily/UNIX) | |
(.bind addr))] | |
(while true | |
(let [c (.accept sc)] | |
(future | |
(let [in (java.nio.channels.Channels/newInputStream c) | |
out (java.nio.channels.Channels/newOutputStream c)] | |
(binding [*in* (clojure.lang.LineNumberingPushbackReader. | |
(clojure.java.io/reader in)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn async-iteration [from-process | |
to-process | |
output-channel | |
& {:keys [values-selector some? init] | |
:or {values-selector vector | |
some? some?}}] | |
(async/go | |
(async/>! to-process init) | |
(loop [value (async/<! from-process)] | |
(if (some? value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; single file web app | |
;; run the following to start the process | |
;; clj -J-Xmx500M -J-XX:-OmitStackTraceInFastThrow -J-Dclojure.server.repl="{:port 9457 :accept clojure.core.server/repl}" -Sdeps '{:deps {net.sourceforge.htmlunit/htmlunit {:mvn/version "2.53.0"} org.clojure/data.json {:mvn/version "2.4.0"} com.github.seancorfield/next.jdbc {:mvn/version "1.2.731"} org.postgresql/postgresql {:mvn/version "42.2.24"} org.clojure/clojurescript {:mvn/version "1.10.879"} io.undertow/undertow-core {:mvn/version "2.2.12.Final"} reagent/reagent {:mvn/version "1.1.0"} cljsjs/react {:mvn/version "17.0.2-0"} cljsjs/react-dom {:mvn/version "17.0.2-0"} com.cognitect/transit-clj {:mvn/version "1.0.324"} com.cognitect/transit-cljs {:mvn/version "0.8.269"}}}' -M -i src/packages.cljc -e '(packages/main)' | |
(ns packages | |
#?(:cljs (:require-macros [packages :as m])) | |
(:require | |
#?@(:clj ([clojure.data.json :as json] | |
[next.jdbc :as jdbc] | |
[cljs.build.api :as cljs] |
NewerOlder