Skip to content

Instantly share code, notes, and snippets.

View mandrean's full-sized avatar

Sebastian Mandrean mandrean

  • Stockholm, Sweden
View GitHub Profile
@mandrean
mandrean / install-pulseview-gettext-macos
Created January 23, 2023 17:29
Install PulseView (& gettext) on Apple M1 Silicon (aarch64, arm64)
# install xcodes
brew install robotsandpencils/made/xcodes aria2
# install & select latest version of xcode
xcodes list | awk 'END{system("xcodes install " $1"; xcodes select " $1)}'
# install x86-64 homebrew
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# switch to x86_64 homebrew
@mandrean
mandrean / install-nodejs-lts-raspberry-pi-zero-w-armv6
Created November 7, 2022 11:22
Install NodeJS LTS on Raspberry Pi Zero W (ARMv6)
# update system
$ sudo apt update && sudo apt upgrade
# uninstall old node (v10?)
$ sudo apt remove nodejs npm -y
# install nvm
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
# use 'unofficial builds' in nvm
@mandrean
mandrean / gha_403_ghcr.txt
Created March 21, 2022 13:06
How to fix Github Actions 403 when pushing to a new private GHCR.io registry in a GH org
1. Manually build the image locally with the correct tag, then push it
2. Find the newly created package at https://github.com/orgs/[ORG]/packages
3. Link it with the right repository
4. Go to https://github.com/[ORG]/[REPO]/pkgs/container/[PACKAGE] and link it with the right repository action
@mandrean
mandrean / Install Apple Clang 12 next to Apple Clang 13
Created January 23, 2022 02:15
Install Apple Clang 12 next to Apple Clang 13
# download 'Command_Line_Tools_for_Xcode_12.5.1.dmg' from Apple's developer portal:
# https://developer.apple.com/download/all/?q=xcode
# mount 'Command_Line_Tools_for_Xcode_12.5.1.dmg', then unpack it
❯ pkgutil --expand-full /Volumes/Command\ Line\ Developer\ Tools/Command\ Line\ Tools.pkg /tmp/CLTools
# rename existing CLTools v13
❯ sudo mv /Library/Developer/CommandLineTools /Library/Developer/CommandLineTools@13
# move CLTools v12 into place
@mandrean
mandrean / Install Arm Embedded GCC toolchain on Apple M1 Silicon (aarch64, arm64)
Last active March 31, 2024 14:29
Install xPack GNU Arm Embedded GCC toolchain on Apple M1 Silicon (aarch64 / arm64)
# Install xpm using npm
$ npm install --global xpm@latest
# Install xPack distribution of Arm toolchain with Apple M1 Silicon support
$ xpm install @xpack-dev-tools/arm-none-eabi-gcc@10.3.1-2.3.1
# Add Arm toolchain binaries to PATH in your .bashrc or .zshrc
$ echo 'export PATH="$HOME/Library/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/10.3.1-2.3.1/.content/bin:$PATH"' >> ~/.bashrc
$ source ~/.bashrc
# Instructions for fresh install
$ sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --daemon
# reboot
$ source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
$ echo 'export NIX_PATH=darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH' | tee -a ~/.zshrc
$ echo 'source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh' | tee -a ~/.zshrc
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
$ nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
@mandrean
mandrean / osx-for-hackers.sh
Created October 10, 2017 13:35 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@mandrean
mandrean / wemo.go
Created September 25, 2017 17:58 — forked from gr4y/wemo.go
Toggle all WeMo switches. If it is on, it will turn off. If it is off, it will turn on. Just a quick little thing.
package main
import (
"fmt"
"github.com/huin/goupnp"
"github.com/huin/goupnp/soap"
)
func main() {
devices, err := goupnp.DiscoverDevices("urn:Belkin:device:controllee")
/*
Source for ida_patcher
Copyright (c) 2006 Chris Eagle cseagle at gmail.com
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT