Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Writing code one line at a time

Ben othyn

🚀
Writing code one line at a time
View GitHub Profile
@othyn
othyn / guide.md
Last active May 4, 2022
Fix horrendously bad macOS (12.3.1 tested) SMB (Samba) performance on Unraid
View guide.md
@othyn
othyn / App.swift
Last active Apr 28, 2022
How to disable default menu bar items in Swift / SwiftUI for macOS
View App.swift
//
// App.swift
//
// Created by Ben Tindall on 30/03/2022.
//
import Foundation
import SwiftUI
import Cocoa
View setup_rancher_node.sh
#!/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 / docker_mac.sh
Created Mar 16, 2022
Prints all Docker container MAC addresses with container ID and name for easy reference
View docker_mac.sh
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
@othyn
othyn / unraid_mac_mini.md
Last active Mar 6, 2022
Mac mini (late 2012, 6,2) Unraid Setup & Installation / Configuration Log
View unraid_mac_mini.md

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 / move_into_self_directory.sh
Last active Dec 28, 2021
Move files into directory/directories of their own (self) filename
View move_into_self_directory.sh
# 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 / 1-setup.md
Created Dec 20, 2021 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra
View 1-setup.md

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 / switch-kubectl-context.sh
Last active Dec 4, 2021
Easy ZSH/Bash alias for swapping kubectl contexts on the fly
View switch-kubectl-context.sh
# 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 / switch-brew-node.sh
Created Dec 4, 2021
Easy ZSH/Bash alias for swapping Node versions on the fly
View switch-brew-node.sh
# 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-brew-php.sh
Last active Dec 4, 2021
Easy ZSH/Bash alias for swapping PHP versions on the fly
View switch-brew-php.sh
# 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[]'