Skip to content

Instantly share code, notes, and snippets.

@darwin
darwin / 1_unexpected.txt
Last active Nov 25, 2020
TotalFinder: `csrutil enable --without debug --without fs` no longer works as expected under macOS 11.x
View 1_unexpected.txt
# in recovery mode
❯ csrutil enable --without debug
# note that prior macOS 11.0 this would disable "Debugging Restrictions"
# since macOS 11.0 it seems to be disabling "Apple Internal" and "Filesystem Protections"
❯ csrutil status
System Integrity Protection status: unknown (Custom Configuration).
Configuration:
@darwin
darwin / readme.md
Created Nov 16, 2020
APFS Container cloning/replicating under macOS 11.0 (Big Sur) - with a bootable system
View readme.md

It is the year 2020 and replicating APFS containers still sucks. One would expect it would be a simple copy and paste in the Disk Utility app but this is still far from reality.

Last year I wrote how I managed to clone my macOS system under Catalina. The main trick was to create a DMG file with multiple volumes, mount it on target machine and drop to command-line to do asr restore from synthetised disk while avoiding possible pitfalls.

The good news is that Apple devs definitely worked on improving this under Big Sur and added some documentation (see man asr). But I didn't understand it fully on first read. Maybe someone could explain how is this supposed to work?

View enable_lib_validation.sh
sudo defaults write /Library/Preferences/com.apple.security.libraryvalidation.plist DisableLibraryValidation
View _.txt
❯ nix-shell --show-trace controller/shell.nix --run 'python controller/main.py'
error: while evaluating the attribute 'buildInputs' of the derivation 'trezor-user-env-controller' at /Users/darwin/farm/trezor-user-env/controller/shell.nix:24:5:
while evaluating the attribute 'passAsFile' of the derivation 'python3-3.8.5-env' at /nix/store/a4svi29pmh2qips8h6649vvzhk5nk5qd-source/pkgs/build-support/trivial-builders.nix:7:7:
while evaluating 'requiredPythonModules' at /nix/store/a4svi29pmh2qips8h6649vvzhk5nk5qd-source/pkgs/top-level/python-packages.nix:64:27, called from /nix/store/a4svi29pmh2qips8h6649vvzhk5nk5qd-source/pkgs/development/interpreters/python/wrapper.nix:15:13:
while evaluating 'unique' at /nix/store/a4svi29pmh2qips8h6649vvzhk5nk5qd-source/lib/lists.nix:643:12, called from /nix/store/a4svi29pmh2qips8h6649vvzhk5nk5qd-source/pkgs/top-level/python-packages.nix:66:6:
while evaluating 'unique' at /nix/store/a4svi29pmh2qips8h6649vvzhk5nk5qd-source/lib/lists.nix:643:12, called from /nix/store/a4svi29pmh2q
View _.txt
❯ nix-shell --show-trace controller/shell.nix --run 'python controller/main.py'
error: while evaluating the attribute 'buildInputs' of the derivation 'trezor-user-env-controller' at /Users/darwin/farm/trezor-user-env/controller/shell.nix:23:5:
while evaluating the attribute 'passAsFile' of the derivation 'python3-3.8.5-env' at /nix/store/a4svi29pmh2qips8h6649vvzhk5nk5qd-source/pkgs/build-support/trivial-builders.nix:7:7:
while evaluating 'requiredPythonModules' at /nix/store/a4svi29pmh2qips8h6649vvzhk5nk5qd-source/pkgs/top-level/python-packages.nix:64:27, called from /nix/store/a4svi29pmh2qips8h6649vvzhk5nk5qd-source/pkgs/development/interpreters/python/wrapper.nix:15:13:
while evaluating 'unique' at /nix/store/a4svi29pmh2qips8h6649vvzhk5nk5qd-source/lib/lists.nix:643:12, called from /nix/store/a4svi29pmh2qips8h6649vvzhk5nk5qd-source/pkgs/top-level/python-packages.nix:66:6:
while evaluating 'unique' at /nix/store/a4svi29pmh2qips8h6649vvzhk5nk5qd-source/lib/lists.nix:643:12, called from /nix/store/a4svi29pmh2q
@darwin
darwin / _readme.md
Last active Sep 14, 2020
Gmail issue: 535 5.7.8 Username and Password not accepted.
View _readme.md

The problem

I'm using web-based gmail as my primary email client. I want to use anoter SMTP server to send emails using secondary email address which is managed by GSuite.

GMail offers "Send emails from a different address or alias" feature[1].

Historically it has been possible to use smtp.gmail.com with my GSuite credentials to enable the feature and send emails via my secondary email without problems.

View gist:f6db7436d1addf998902f36c19ca760b
Running ui-main on thread:main[1]
Color management: using fallback mode for management
Color management: Error could not find role data role.
BLT_lang_init: 'locale' data path for translations not found, continuing
Color management: scene view "Filmic" not found, setting default "Standard".
blf_load_font_default: 'fonts' data path not found for 'droidsans.ttf', will not be able to display text
blf_load_font_default: 'fonts' data path not found for 'bmonofont-i18n.ttf', will not be able to display text
blf_load_font_default: 'fonts' data path not found for 'bmonofont-i18n.ttf', will not be able to display text
2020-06-11 13:10:45.674 java[12724:343425] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
View gist:a6402b5e171982cc93f821e8b533397b
❯ ./build-blender-mac.sh repl
++ dirname ./build-blender-mac.sh
+ cd .
++ pwd
+ ROOT_DIR=/Users/darwin/lab/blender-clj
+ OUR_LIB_DIR=/Users/darwin/lab/blender-clj/lib
+ BLENDER_GIT_DIR=/Users/darwin/lab/blender
+ BLENDER_LIB_DIR=/Users/darwin/lab/blender/../lib
+ BLENDER_BUILD_DIR=/Users/darwin/lab/blender/../build_darwin
+ JNA_VERSION=5.5.0
@darwin
darwin / touch_them.sh
Last active Apr 2, 2020
This scripts finds all files in given directory tree, reads their com.apple.metadata:kMDItemDownloadedDate xattr and changes last modification date to that value if exists.
View touch_them.sh
#!/usr/bin/env bash
set -e
set_date_attr() {
local hex
hex=$(xattr -px "com.apple.metadata:kMDItemDownloadedDate" "$1")
if [[ $? = 0 ]]; then
local date_xml
date_xml=$(xxd -r -p <<< "$hex" | plutil -extract 0 xml1 -o - - | sed '4q;d' | sed -e 's/<[^>]*>//g')
View gist:7e103d6473f6263dc56baab20227653e
> rm -rf ~/.m2/repository/binaryage/dirac/1.5.8
> clojure -Srepro -Sdeps '{:deps {binaryage/dirac {:mvn/version "1.5.8"} org.clojure/clojurescript {:mvn/version "RELEASE"} clj-logging-config {:mvn/version "1.9.12"}}}' -m dirac.main
Error building classpath. Could not find artifact binaryage:dirac:jar:1.5.8 in central (https://repo1.maven.org/maven2/)
You can’t perform that action at this time.