Skip to content

Instantly share code, notes, and snippets.

@darwin
darwin / readme.md
Last active April 9, 2024 22:30
APFS Container cloning/replicating under Catalina (with a bootable system)

Today I wanted to move existing APFS-resident macOS Catalina installation to a new disk. I upgraded my late 2014 Mac Mini with a shiny new 1TB SSD. This took way too many hours of my life I will never get back. Hope this saves some time to you.

Good news:

  1. it is possible to create a DMG image from existing APFS container with macOS Catalina installation including metadata needed for complete restore (the DMG contains OS, OS Data, Preboot, Recovery and VM volumes)
  2. it is possible to restore this DMG image into empty APFS container and get a bootable copy of the original system

This information is relevant for Catalina (I'm currently running macOS 10.15.1).

@darwin
darwin / readme.md
Created November 16, 2020 21:59
APFS Container cloning/replicating under macOS 11.0 (Big Sur) - with a bootable system

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?

@darwin
darwin / _readme.md
Last active October 1, 2023 14:10
Gmail issue: 535 5.7.8 Username and Password not accepted.

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.

@darwin
darwin / 1_unexpected.txt
Last active February 14, 2023 13:27
TotalFinder: `csrutil enable --without debug --without fs` no longer works as expected under macOS 11.x
# 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 / 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
@darwin
darwin / ping_pong_go.clj
Last active August 15, 2022 11:25 — forked from jmglov/ping_pong_go.clj
Non-blocking version of core.async ping-pong game
(ns ping-pong-go
(:require [clojure.core.async :as async :refer [<! >!]]))
(defn ping [ch]
(println "Ping")
(go
(>! ch :ping)
(<! (async/timeout 500))))
(defn pong [ch]
@darwin
darwin / index.html
Last active May 1, 2022 20:40
Welcome to comix!
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">A Comix Sample</tspan>
</label>
<actor t="translate(131,49)" pose="-11,9|-5,117|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,79|-18,59|-6,79|-1,59">
@darwin
darwin / gist:658202
Created November 1, 2010 13:54
Podpora sluzeb CNB pro Google Spreadsheets
// Podpora sluzeb CNB pro Google Spreadsheets
// autor: antonin@hildebrand.cz
// ==========================================
//
// =historicalRate(currency, date, zone)
// -------------------------------------
// currency je kod meny (USD, EUR, apod.)
// date je ve formatu d.m.r (pokud neni date zadano, pak se vrati aktualni kurz)
// zone je volitene a uplatni se pro konverzi date na string (pokud neni zadana pouzije se CET)
//
@darwin
darwin / automate-totalfinder-tabs.applescript
Created February 3, 2020 15:34
This is a simple automation script to open two extra tabs and switch them to custom paths. Tested on macOS 10.15.3 (Catalina) and TotalFinder 1.12.3
set paths to {"/Users/darwin/Music", "/Users/darwin/Desktop"}
-- open all paths as new tabs
repeat with path in paths
set applePath to POSIX file path
tell application "Finder" to activate
tell application "System Events"
keystroke "t" using command down
end tell
delay 1
@darwin
darwin / readme.md
Created May 29, 2021 13:29
notes on migration to travis-ci.com

I successfully migrated canary repo under my travis-ci.com account. All seems to work for now. Didn't ask for any credits of OSS yet.

The api endpoint is hard-coded so all old travis-ci.org-associated projects started failing since I switched it to travis-ci.com.

How to migrate your projects:

  1. Use the magic "migrate" button to move them from travis-ci.org to travis-ci.com (If your repos are associated with travis-ci.org, you won't see them under travis-ci.com).
  2. Travis access token is different for travis-ci.com, so old tokens won't work. Please follow the readme and update your tokens in travis.yml in the jobs branch.