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 / 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
@thbkrkr
thbkrkr / gcloud-ssh-sysctl-vmmaxmapcount.sh
Created November 7, 2019 19:42
Set vm.max_map_count=262144 on the nodes of a GKE cluster #k8s
#!/bin/bash -eu
# Increase Virtual Memory for Elasticsearch on GKE
# https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html
# Dependencies: kubectl, gcloud, jq
nodes() {
kubectl get nodes -o custom-columns=n:.metadata.name --no-headers
}
@lg
lg / paperspace-gaming.ps1
Last active October 31, 2023 17:24
A script to provision a new Paperspace machine for gaming
# init stuff
Install-PackageProvider -Name NuGet -Force
mkdir c:\cloudygamer\downloads
Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "DontUsePowerShellOnWinX" -Value 0
################
# install steam first since windows updates will take forever (and you can install games)
(New-Object System.Net.WebClient).DownloadFile("https://steamcdn-a.akamaihd.net/client/installer/SteamSetup.exe", "c:\cloudygamer\downloads\steamsetup.exe")
@mandrean
mandrean / cloud-config-controller
Created October 28, 2016 13:09
kube-aws fluentd/elastic search/kibana logging for kubernetes
# ...
write_files:
- path: /opt/bin/install-kube-system
permissions: 0700
owner: root:root
content: |
#!/bin/bash -e
# ...
# Custom replication controllers
@gr4y
gr4y / wemo.go
Last active September 25, 2017 17:58
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")