Skip to content

Instantly share code, notes, and snippets.

View othyn's full-sized avatar
🏳️‍🌈
Be kind, and have an adventure.

Ben othyn

🏳️‍🌈
Be kind, and have an adventure.
View GitHub Profile
@othyn
othyn / Docker connect to remote server.md
Created July 15, 2021 09:11 — forked from kekru/Docker connect to remote server.md
Connect to another host with your docker client, without modifying your local Docker installation

Run commands on remote Docker host

This is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation.

Enable Docker Remote API

First be sure to enable the Docker Remote API on the remote host.

This can easily be done with a container.
For HTTP connection use jarkt/docker-remote-api.

@othyn
othyn / switch-brew-php.sh
Last active December 4, 2021 13:11
Easy ZSH/Bash alias for swapping PHP versions on the fly
# Switch PHP version in brew
# Place this in your ~/.bashrc or similar for autoload into your shell
function phpsw() {
if [ -z "$1" ]; then
logInfo "You need to provide a PHP formulae version to switch to in format:"
logInfo "$ phpsw 8.1"
if command -v jq >/dev/null 2>&1; then
logInfo "Installed PHP versions via Brew:"
brew info --json php | jq -r '.[].versioned_formulae[]'
@othyn
othyn / switch-brew-node.sh
Created December 4, 2021 13:11
Easy ZSH/Bash alias for swapping Node versions on the fly
# Switch Node version in brew
# Place this in your ~/.bashrc or similar for autoload into your shell
function nodesw() {
if [ -z "$1" ]; then
logInfo "You need to provide a Node formulae version to switch to in format:"
logInfo "$ nodesw 16"
if command -v jq >/dev/null 2>&1; then
logInfo "Installed Node versions via Brew:"
brew info --json node | jq -r '.[].versioned_formulae[]'
@othyn
othyn / switch-kubectl-context.sh
Last active December 4, 2021 13:18
Easy ZSH/Bash alias for swapping kubectl contexts on the fly
# List available kubectl contexts
# Based on the below command context storage mechanism
function kswl() {
echo "Listing available kubectl contexts:"
ls -lah ~/.kube/*-config.yaml
}
# Switch kubectl context
# Context files should be stored in the format: ~/.kube/{context_name}-config.yaml
function ksw() {
@othyn
othyn / 1-setup.md
Created December 20, 2021 18:58 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

Last updated March 28, 2021

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

@othyn
othyn / move_into_self_directory.sh
Last active December 28, 2021 02:08
Move files into directory/directories of their own (self) filename
# This script is designed to be a 'one-liner', just remove the comments to paste and go!
# However feel free to add a shebang and use it as a script, swapping the glob out for a cheeky $1.
# [Example usage]
# Given:
# A file I want to place into a directory of its own name...
# ./John Wick.mp4
# ---
# Then:
# This script will create the required directory and move the file into it...
@othyn
othyn / unraid_mac_mini.md
Last active February 16, 2024 14:00
Mac mini (late 2012, 6,2) Unraid Setup & Installation / Configuration Log

Mac mini (late 2012, 6,2) Unraid Setup & Installation / Configuration Log

I'm creating this as reference for people looking to run Unraid on a Mac mini, as there really isn't any info about this online. In this case, I'm running an MD388LL/A model (6,2), an Intel based model running an Intel i7-3615QM @ 2.3GHz with 16GB DDR3 1600MHz memory. In terms of drives, I'm currently running the original 120GB Apple re-badged SSD and 1TB Apple re-badged HDD which are both near EoL.

For the USB drive I'm using an old spare USB 2.0 Kingston 32GB DataTraveler 104. Space wise, its completely overkill, but I don't have any other spares to hand given my others have been used up on two other Unraid boxes. As for USB 2.0, I've had more success on 2.0 drives than 3+.

p.s. I know there is no installation step, just trying to get good SEO for this post to help wanderers!

Running into issues...

@othyn
othyn / docker_mac.sh
Created March 16, 2022 10:41
Prints all Docker container MAC addresses with container ID and name for easy reference
for ID in `docker ps -q`; do
NAME=$(docker inspect -f '{{.Config.Image}}' "${ID}")
MAC=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.MacAddress}}{{end}}' "${ID}")
echo "${ID} :: ${MAC} :: ${NAME}";
done
#!/bin/sh
set -e
# Usage:
# $ https://gist.githubusercontent.com/othyn/87765439d6fa8bdbb193c50935a3b4e1/raw/02a7e9f0e957b286965f88637fac0b6b2b5f7b30/setup_rancher_node.sh | sh
# Designed for:
# - Ubuntu 20.04.4
# - Rancher v2.4.17
# - Docker 20.10
@othyn
othyn / App.swift
Last active January 30, 2024 10:58
How to disable default menu bar items in Swift / SwiftUI for macOS
//
// App.swift
//
// Created by Ben Tindall on 30/03/2022.
//
import Foundation
import SwiftUI
import Cocoa