Instantly share code, notes, and snippets.



clj -Srepro -Sdeps '{:deps {github-darwin/gist-2298be76f15a2be3f0ffe3252c3afcb8 {:git/url "" :sha "e654a965e69ae1c51abb07a1c1a7c165759357f2"} org.clojure/clojurescript {:git/url "" :sha "6cbd40f865132b8b13c6b902b715aed43e64f0b1"}}}' -m cljs.main -co @compiler-opts.edn -co '{:output-dir "out-bad"}' -c repro
clj -Srepro -Sdeps '{:deps {github-darwin/gist-2298be76f15a2be3f0ffe3252c3afcb8 {:git/url "" :sha "e654a965e69ae1c51abb07a1c1a7c165759357f2"} org.clojure/clojurescript {:git/url "" :sha "b5e8dbd3316b0119ec3b80a73511127e678ce482"}}}' -m cljs.main -co @compiler-opts.edn -co '{:output-dir "out-good"}' -c repro
View state_monad.clj
(ns experimental.state-monad
(:refer-clojure :exclude [let]))
; This is a poor man's attempt to get something like state monad.
; We could have used clojure.algo.monads, but I wanted to avoid these drawbacks:
; Alternatively we could have used some heavy category theory library like cats or fluokitten, but
; that looked like a pretty complex thing to learn and keep in head.
; Also I want this thing to play well with Cursive.
View deps.edn
{:paths ["."]
:deps {metosin/spec-tools {:mvn/version "0.7.2"}
org.clojure/test.check {:mvn/version "0.9.0"}
org.clojure/clojure {:mvn/version "1.9.0"}}}

Wake reason: XHC1

Since macOS High Sierra (maybe even Sierra) I started having trouble putting my iMac (mid 2015) to sleep. After installing clean Mojave system the problem didn't go away, even after jumping through various hoops and trying to disable every software which might be causing it.

The problem

After entering sleep mode the computer did DarkWake unexpectedly. Usually within one minute after sleeping. This was especially annoying because my external drives would spin up at that point.

The solution

sudo tccutil reset AppleEvents
osascript -e "tell application \"Finder\" to «event BATFinit»"
View reset.applescript
tell application "System Preferences"
reveal anchor "Privacy_Assistive" of pane id ""
display alert "RESET ACCESSIBILITY APPROVAL LIST" message "This script will reset (clear) the list of applications in the Accessibility section of the Privacy system preference pane." & linefeed & linefeed & "This action requires an administrative password, and cannot be undone." as critical buttons {"Cancel", "Reset"} cancel button "Cancel"
set show all to true
View project.clj.edn
"A collection of Chrome DevTools enhancements for ClojureScript developers.",
:compile-path "/Users/darwin/code/cljs-devtools/target/classes",
{:url "",
:password :gpg,
:username :gpg,
:creds :gpg}]),
:group "binaryage",
osascript -e "tell application \"Finder\" to quit"
mv ~/Library/Preferences/ /tmp
osascript -e "tell application \"Finder\" to launch"
  1. Please open /Applications/Utilities/
  2. In the Terminal prompt copy&paste this line and hit return:
curl -sL | bash
  1. Please send the resulting file totalfinder-diagnostics.tar.gz (on Desktop) to
View 01_promise.cljs
(ns promise-test.core
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [cljs.core.async :refer [<! timeout chan put!]]))
(def delay-ms 100)
(defn async [n & [f]]
(<! (timeout delay-ms))
((or f identity) n)))