Skip to content

Instantly share code, notes, and snippets.

@darwin
darwin / deps.edn
Last active October 10, 2018 22:18
clojure -Srepro -Sdeps '{:deps {issue {:git/url "https://gist.github.com/darwin/e7748419304915f75633666b906f23f8" :sha "af929e906525703509a4f86ba371d74f8338dc71"}}}' -m main
{: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"}}}
@darwin
darwin / 00-readme.md
Last active June 18, 2020 05:21
[SOLVED] iMac sleep/wake issues caused by my USB mouse (Wake reason: XHC1)

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

@darwin
darwin / terminal.sh
Last active April 25, 2020 09:10
How to inject TotalFinder via a Terminal command under macOS 10.14 Mojave (B6). First install latest TotalFinder beta from https://totalfinder.binaryage.com/beta-changes#latest
sudo tccutil reset AppleEvents
osascript -e "tell application \"Finder\" to «event BATFinit»"
tell application "System Preferences"
launch
activate
reveal anchor "Privacy_Assistive" of pane id "com.apple.preference.security"
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
@darwin
darwin / project.clj.edn
Last active June 12, 2018 19:16
`git clone https://github.com/binaryage/cljs-devtools && cd cljs-devtools && lein pprint`
{:description
"A collection of Chrome DevTools enhancements for ClojureScript developers.",
:compile-path "/Users/darwin/code/cljs-devtools/target/classes",
:deploy-repositories
(["clojars"
{:url "https://clojars.org/repo/",
:password :gpg,
:username :gpg,
:creds :gpg}]),
:group "binaryage",
@darwin
darwin / remove-finder-plist.sh
Last active March 20, 2018 16:06
This script quits Finder, moves it's plist to `/tmp/com.apple.finder.plist` and then launches Finder again. This should effectively reset Finder into factory defaults. Please open `/Applications/Utilities/Terminal.app` and execute this line-by-line.
osascript -e "tell application \"Finder\" to quit"
mv ~/Library/Preferences/com.apple.finder.plist /tmp
osascript -e "tell application \"Finder\" to launch"
@darwin
darwin / totalfinder-diagnostics.md
Last active November 14, 2020 20:47
TotalFinder diagnostics
  1. Please open /Applications/Utilities/Terminal.app
  2. In the Terminal prompt copy&paste this line and hit return:
curl -sL https://updates.binaryage.com/diagnose-totalfinder.sh > /tmp/dtf.sh && bash /tmp/dtf.sh
  1. Please send the resulting file totalfinder-diagnostics.tar.gz (on Desktop) to support@binaryage.com
(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]]
(go
(<! (timeout delay-ms))
((or f identity) n)))
@darwin
darwin / finder-paths.applescript
Last active August 31, 2022 21:59
This is a simple automation script to open a new Finder window with a pre-defined set of paths each in a new tab. Run it in `/Applications/Utilities/Script Editor.app` (hint: you can save the script as a standalone executable from there).
set paths to {"/Users/darwin/Music", "/Users/darwin/Desktop"}
-- initialize new Finder window
tell application "Finder"
activate
set finderWindow to make new Finder window
set toolbar visible of finderWindow to true
end tell
-- open all paths as new tabs
> lein dev-browser-tests
22:48:22 fixtures-server | launching fixtures server for development (silent mode) in '/Users/darwin/code/dirac-ws/dirac/test/browser/fixtures/resources' on port 9080
22:48:22 browser | selected browser binary '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary'
22:48:22 browser | waiting for compilation of clojurescript components...
22:48:26 fig-marion | Figwheel: Cutting some fruit, just a sec ...
22:48:26 fig-dirac | Figwheel: Cutting some fruit, just a sec ...
22:48:26 marion-cs | Watching for changes before compiling ClojureScript...
22:48:27 tests | Watching for changes before compiling ClojureScript...
22:48:29 dev-agent | Listening for transport dt_socket at address: 5005
22:48:40 marion-cs | Compiling "test/marion/resources/unpacked/.compiled/content_script/content_script.js" from ("src/empty" "src/settings" "src/shared" "test/marion/src/content_script")...