Skip to content

Instantly share code, notes, and snippets.

View jmarhee's full-sized avatar

jdm jmarhee

View GitHub Profile
@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 / 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
from plexapi.myplex import MyPlexAccount
import os
plex_auth_info = {
"username" : os.environ['PLEX_USERNAME'],
"password" : os.environ['PLEX_PASSWORD'],
"server" : os.environ['PLEX_SERVER_NAME']
}
account = MyPlexAccount(plex_auth_info['username'], plex_auth_info['password'])
@jmarhee
jmarhee / README.md
Created April 9, 2023 05:44
Generate an epidemic curve with gnuplot from a CSV of data.

Epidemic Curve Graph Bash Script

This is a Bash script that generates an epidemic curve graph using the gnuplot tool. The script takes in a data file in CSV format and outputs a PNG image of the epidemic curve.

Prerequisites

In order to use this script, you will need to have gnuplot installed on your system. If you're using a Debian-based distribution, you can install gnuplot using the following command:

sudo apt-get install gnuplot
@jmarhee
jmarhee / .muttrc
Last active May 7, 2024 08:26 — forked from lucianposton/.muttrc
mutt: muttrc settings for ProtonMail Bridge
set from="user@protonmail.com"
set my_user="user@protonmail.com"
set my_pass="pass"
set smtp_port="1025"
set imap_port="1143"
set ssl_starttls=yes
set smtp_url="smtp://$my_user:$my_pass@127.0.0.1:$smtp_port"

Install Elemental with virt-install on KVM

Using virt-install to install SUSE Elemental on KVM.

Prerequisites

When creating your Machine Registration Endpoint in the Rancher UI, ensure that registration.emulated-tpm-seed is set to -1, if you plan to add more than a single machine using the ISO you will be building.

For example:

@jmarhee
jmarhee / harvester-boot.sh
Created May 1, 2024 17:24
Boots a two-node Harvester cluster.
#!/bin/bash
CLUSTER_TAG=harvester-$(openssl rand -hex 6)
ISO=/var/lib/libvirt/images/harvester-v1.3.0-amd64.iso
for i in {1..2}; do \
VM_NAME=$(openssl rand -hex 4); \
sudo qemu-img create /var/lib/libvirt/images/${CLUSTER_TAG}-${VM_NAME}-ROOT_VOL.img 180G; \
sudo qemu-img create /var/lib/libvirt/images/${CLUSTER_TAG}-${VM_NAME}-DATA_VOL.img 250G; \
sudo virt-install \
rkeConfig:
chartValues:
rke2-cilium:
kubeProxyReplacement: true
k8sServiceHost: 127.0.0.1
k8sServicePort: 6443
#!/bin/bash
# Define header size (IP + ICMP headers)
HEADER_SIZE=28
# Define the starting MTU size (adjust as needed)
START_MTU=1472
# Define the minimum MTU size (optional, adjust as needed)
MIN_MTU=100 # Common minimum Ethernet MTU
---
- name: Import Kubernetes Cluster into Rancher
hosts: localhost
gather_facts: no
vars:
rancher_url: "https://rancher_url/v3"
rancher_api_token: "bearer_token"
cluster_name: "my-imported-cluster"
tasks:
- name: Create a new cluster in Rancher