Skip to content

Instantly share code, notes, and snippets.

View jmarhee's full-sized avatar

jmarhee

View GitHub Profile
@jmarhee
jmarhee / README.md
Created October 25, 2021 16:32 — forked from superseb/README.md
Retrieve kubeconfig from RKE or Rancher 2 custom cluster controlplane node for RKE v0.2.x and Rancher v2.2.x

Retrieve kubeconfig from RKE v0.2.x or Rancher v2.2.x custom cluster controlplane node

For RKE v0.1.x and Rancher v2.0.x/v2.1.x, see https://gist.github.com/superseb/3d8de6092ebc4b1581185197583f472a

This needs to be run on a node with the controlplane role, as it rewrites the server endpoint to https://127.0.0.1:6443, you can of course manually change this if necessary.

Applicable for:

  • RKE v0.2.x
  • Rancher v2.2.x
@jmarhee
jmarhee / resetRemoteManagement.sh
Created July 30, 2021 01:16
When Remote Desktop'd to a Mac, after switching Remote Management to only your user, you will be disconnected. Run this script to restore RDP access to your account.
#!/bin/bash
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -users $1 -privs -all -restart -agent -menu
#!/bin/bash
function new_password () {
if [ ! -z $1 ]; then
length=$1
else
length=20
fi
curl -s "https://www.random.org/passwords/?num=1&len=$length&format=plain&rnd=new" | pbcopy
}
@jmarhee
jmarhee / overlay.sh
Created March 26, 2021 07:52
Overlays all videos in a directory on top of each other.
#!/bin/bash
i=0
while read line
do
array[ $i ]="$line"
(( i++ ))
done < <(ls)
# Creates the base overlay.mkv file
@jmarhee
jmarhee / container_prune.py
Created February 15, 2021 01:19
Terminates containers running longer than an float-value number of hours.
from datetime import datetime
import os
import docker
import dateparser
STARTING_TIME = str(datetime.now()).split(" ")[0]+ "T" + str(datetime.now()).split(" ")[1] + "Z"
if os.environ.get('LIMIT_HOURS') is None:
LIMIT_HOURS = 2.0
else:
@jmarhee
jmarhee / README.md
Created February 7, 2021 07:34 — forked from ctsrc/README.md
How to run FreeBSD 13.0-BETA1 for ARM64 in QEMU on Apple Silicon Mac (MacBook Pro M1, etc)