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
;; https://clojurians.slack.com/archives/CLX41ASCS/p1665055449480629?thread_ts=1664969568.562399&cid=CLX41ASCS | |
(require '[babashka.deps :as deps]) | |
(deps/add-deps '{:deps {com.cognitect.aws/endpoints {:mvn/version "1.1.12.206"} | |
com.cognitect.aws/s3 {:mvn/version "822.2.1109.0"} | |
com.grzm/awyeah-api {:git/url "https://github.com/grzm/awyeah-api" | |
:git/sha "0fa7dd51f801dba615e317651efda8c597465af6"}}}) | |
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
CLANG_DIR = $(HOME)/clang+llvm-13.0.1-x86_64-linux-gnu-ubuntu-18.04 | |
CLANG = $(CLANG_DIR)/bin/clang | |
LLC = $(CLANG_DIR)/bin/llc | |
LD = $(CLANG_DIR)/bin/wasm-ld | |
C_SRC := $(wildcard src/c/*.c) | |
OBJ_SRC := $(patsubst %.c, %.o, $(C_SRC)) | |
%.o: %.c # delete competing implicit rule |
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
(ns c99 | |
(:require [clojure.core :as core] | |
[clojure.string :as string])) | |
(def e' clojure.walk/macroexpand-all) | |
(core/defmacro defn [var bindings & body] | |
(str (:tag (meta var)) " " var "(" | |
(->> bindings | |
(map (fn [v] |
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
pub rsa4096 2020-11-27 [SC] [expires: 2023-11-27] | |
AF676FA6E9F8595927FBB9CC39246A7C4EC9E959 | |
uid Crispin Wellington <[email protected]> | |
sub rsa4096 2020-11-27 [E] [expires: 2023-11-27] | |
gpg: sending key 39246A7C4EC9E959 to hkp://pgp.mit.edu |
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 split-camel-case-seq [s] | |
(let [parts (string/split s #"[a-z][A-Z]") | |
word-char-counts (-> (mapv #(+ 2 (count %)) parts) | |
(update 0 dec)) | |
split-points (reductions + 0 word-char-counts) | |
from-to (map vector split-points (rest split-points))] | |
(map | |
(fn [[from to]] (subs s from (min to (count s)))) | |
from-to))) |
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
(ns net-utils | |
(:import [java.net Socket ConnectException])) | |
(defn wait-for-port | |
"Waits for TCP connection to be available on host and port. Options map | |
supports `:timeout` and `:pause`. If `:timeout` is provided and reached, | |
`:default`'s value (if any) is returned. The `:pause` option determines | |
the time waited between retries." | |
([host port] | |
(wait-for-port host port nil)) |
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
#!/usr/bin/env spire | |
;; spin up a digital ocean droplet | |
;; build latest acmetool | |
;; patch and update debian package | |
;; download acmetool binary and new package | |
;; destroy droplet | |
;; requirements: | |
;; spire 0.1.0-alpha.15 or above |
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
#!/usr/bin/env spire | |
(ns user | |
(:require [digitalocean :as do])) | |
(let [droplet (-> | |
{:name "myexample.com" | |
:region "nyc3" | |
:size "s-1vcpu-1gb" | |
:image "ubuntu-16-04-x64" |
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
(ns digitalocean | |
(:require [spire.modules :refer :all] | |
[clojure.data.json :as json])) | |
(defn- make-url [suffix & args] | |
(apply format (str "https://api.digitalocean.com/v2/" suffix) args)) | |
(defn request [args] | |
(curl (merge {:url (make-url "droplets") | |
:headers {:authorization (format "Bearer %s" (System/getenv "DO_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
Sat Aug 18 14:25:29 UTC 2018 |