Skip to content

Instantly share code, notes, and snippets.

@nicnilov
nicnilov / readme.md
Last active March 9, 2024 14:25
Docker cross-platform Elixir build for linux/amd64 on linux/arm64, Apple Silicon M1, M2, M3, etc.

Docker cross-platform Elixir build for linux/amd64 on linux/arm64, Apple Silicon M1, M2, M3, etc.

Problem

When building an Elixir application docker image on an arm64 platform, the process crashes with a variety of errors:

  • Segmentation fault
  • Error code 139
  • Error code 143
  • Memory request of some enormous size
@nicnilov
nicnilov / gist:d7250b828b4f7082b9454e0a799f7d7b
Last active March 9, 2024 12:01
Virtualized Ubuntu Studio on Arm64

Virtualized Ubuntu Studio on Arm64

Ubuntu Studio only offers amd64 downloads. These can run in a VM in emulation mode which is slow. The sequence to install an equivalent system in arm64 is the following:

  1. Install Ubuntu Server LTS (currently 22.04.4).
  2. Update apt:
sudo apt update && sudo apt upgrade

Disable:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

Enable:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

@nicnilov
nicnilov / gist:308e3eed69f6b31224730848242d5446
Last active August 5, 2023 09:04
Attach and mount a macOS system drive raw image
===
Create a raw image
===
# Find the drive identifier
diskutil list
# Unmount the cached drive representation
diskutil unmountDisk <disk>
@nicnilov
nicnilov / gist:206d4820ab80e344139ffa4f66fafc2b
Last active March 27, 2023 18:20
Zsh docker machine instance in the prompt

In zsh theme file:

# Dm: docker machine
prompt_dm() {
  local dm="$DOCKER_MACHINE_NAME"
  if [[ -n $dm ]]; then
    prompt_segment 020 159 $dm
  fi
}
@nicnilov
nicnilov / dcamprof.md
Last active May 14, 2022 21:25
Compile DCamProf under macOS Big Sur

Prerequisites

  1. DCamProf source (1.0.6 is the latest)
  2. Clang compiler with openmp support
  3. little-cms2
  4. libtiff

Under macOS with XCode installed typically the compiler picked up is the one shipped with XCode. It does not support openmp:

@nicnilov
nicnilov / doc.md
Last active November 17, 2020 16:58
Run RawTherapee custom linux build on Windows 10 with sharp fonts on a HiDPI display

Run RawTherapee custom linux build on Windows 10 with sharp fonts on a HiDPI display

Note that this setup may be a moot point as there are important issues when running RT under WSL. One is the overall low performance compared to a Linux in a Virtual Box setup. Another is repeatable freezes of the VM when the contents of the directory currently open in RT are modified on the host. For these and other reasons the Virtual Box setup turned out to be superior to the WSL.

The credit for WSL setup for graphical apps belongs to https://medium.com/@jeffborch/running-the-scenic-elixir-gui-framework-on-windows-10-using-wsl-f9c01fd276f6.

Configure Windows Subsystem for Linux

1. Enable WSL

@nicnilov
nicnilov / script.sh
Last active October 7, 2020 14:50
RawTherapee compile on macOS Mojave with llvm 10
# Install llvm 10
brew install llvm
# or brew install llvm@10 if it is not the last one anymore
# Clone the repo
cd <some directory>
git clone git@github.com:Beep6581/RawTherapee.git
cd RawTherapee
# Install llvm@8
brew install llvm@8
# Clone the repo
cd <some directory>
git clone git@github.com:Beep6581/RawTherapee.git
cd RawTherapee
noindex () {
mdutil -i off .
sudo rm -rf .{,_.}{fseventsd,Spotlight-V*,Trashes,DocumentRevisions-V*}
mkdir .fseventsd
touch .fseventsd/no_log .metadata_never_index .Trashes
echo "Done"
}