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 / 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() {
@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-brew-php.sh
Last active November 16, 2024 02:44
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 / 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 / laravel_package_recommendations.md
Last active October 20, 2021 09:41
My top recommended Laravel packages
Package (in Alphabetical Order) Description
@othyn
othyn / write_bootable_windows_iso_to_usb.sh
Last active November 16, 2024 02:43
Quick script to write a bootable UEFI Windows ISO to USB in macOS
#!/bin/bash
# System: Darwin x86_64 19.6.0 (macOS 10.15.6 19G2021)
# Author: Othyn (https://github.com/othyn)
# Source: https://gist.github.com/othyn/29b82e39eb8cdd98adf1be77cbb62700
# Dependencies: pv, wimlib
# Licence: MIT
DEFAULT="\x1b[0m"
RED="\x1b[31m"
@othyn
othyn / LogLevel.php
Last active April 2, 2022 02:26
RFC 5424 log levels for BenSampo's Laravel Enum package.
<?php
namespace App\Enums;
use BenSampo\Enum\Enum;
/**
* @method static static Emergency()
* @method static static Alert()
* @method static static Critical()
@othyn
othyn / ChangePasswordController.php
Last active July 25, 2020 04:46
Laravel 6.x change password (Routes, Controller, Request & View)
<?php
/*
* app/Http/Controllers/Auth/ChangePasswordController.php
*
* Made via the command:
* $ php artisan make:controller Auth/ChangePasswordController -r
*
* This is the custom controller that will do all the heavy lifting for
* changing the users password.
@othyn
othyn / entrypoint.sh
Last active February 5, 2020 16:40
Docker entrypoint.sh to launch either sh/bash or node depending on the script shebang executable type. This came from a personal circumstance where to save resources, one node image could be used to run shell scripts and node scripts that both performed actions against the same resource. This condensed 4 containers into 1, giving the same result.
#!/bin/sh
set -e
FIRST_LINE=$(head -n 1 "${1}")
# As the scripts can be either JS or shell, determine how to exec!
if [ "${FIRST_LINE}" = "#!/bin/sh" ] || [ "${FIRST_LINE}" = "#!/bin/bash" ]; then
eval "./$@"
else
# https://github.com/nodejs/docker-node/blob/master/docker-entrypoint.sh