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 / phpdocs_facade_generator.php
Created May 24, 2023 09:27 — forked from ardzz/phpdocs_facade_generator.php
PHPDocs facades laravel generator
<?php
/**
* Class FacadePHPDocs
*
* @author Ardhana <ardzz@indoxploit.or.id>
*/
class FacadePHPDocs{
/**
* @var ReflectionClass
@othyn
othyn / youtube_clean_watch_later_videos.js
Created October 21, 2022 17:23 — forked from qoomon/youtube_clean_watch_later_videos.js
Clean YouTube Watch Later Videos
// This script will remove all videos from watch later list
//
// Usage
//
// #1 go to https://www.youtube.com/playlist?list=WL
// #2 run following script in your browser console
// adjust REMOVE_BUTTON_TEXT accordingly to your language, see examples below
(async function() {
const REMOVE_BUTTON_TEXT = 'Remove from Watch later'
@othyn
othyn / guide.md
Last active April 24, 2024 00:43
Fix horrendously bad macOS (12.3.1 tested) SMB (Samba) performance on Unraid

Intro

Out of the box, my SMB performance on macOS 12.3.1 would top out at around 20MB/s in short ~5 second bursts, which was absolutely horrendous, slow to navigate in Finder and slugish to interact with.

Since making these changes, I now get sustained ~80-100MB/s+ and instant Finder navigation which is superb and how things should be out-of-the-box (OOTB)!

May 2023 update: As of Ventura, the SMB issues were just horribly inconsistent and hard to maintain. Something in the combination of Unraid, macOS and SMB just doesn't play nice. I ended up binning NFS/SMB all together and heading to a locally hosted Nextcloud instance for file syncing, then using SFTP/Ansible Git flow for editing files within appdata.

Sources

@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
#!/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 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
@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 / 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 / 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 / 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() {