Skip to content

Instantly share code, notes, and snippets.

View ThinGuy's full-sized avatar

craig bender ThinGuy

View GitHub Profile
@ThinGuy
ThinGuy / papi-pull.sh
Created September 4, 2025 17:37
Pull all repo sizes from Canonical - WIP
#!/bin/bash
export PAPI_DIR=~/papi
[[ -d ${PAPI_DIR} ]] && { find ${PAPI_DIR} -type f -delete; } || { mkdir -p $PAPI_DIR; }
export OK=$(printf '\e[0;1;38;2;0;255;0m✓\e[0m')
export ORA=$(printf '\e[0;1;38;2;233;84;20m▸\e[0m')
export WRA=$(printf '\e[0;1;38;2;255;255;255m▸\e[0m')
printf "\n\e[2G\e[0;38;2;255;255;255mCanonical \e[0;38;2;233;84;20mPAPI\e[0m: Project and Package Information\e[0m\n"
LINE="$(printf '\u2500%0.0s' {1..47})"
printf "\e[2G${LINE}\n"
@ThinGuy
ThinGuy / ob-mc.sh
Created August 21, 2025 17:09
Meshcommander Setup for Canonical Orangeboxes (run on node00)
#!/bin/bash
# Meshcommander (AMT Management) for Orangeboxes
sudo apt update
sudo apt install nodejs npm -fqy --auto-remove --purge;
sudo mkdir -p /srv/mc;
sudo chown -R $(id -un 1000):$(id -gn 1000) /srv/mc
sudo find /srv/mc -type d -exec chmod u+rwx,g+rwx,o+rx {} \; -o -type f -exec chmod u+rw,g+rw,o+r {} \;
(cd /srv/mc && npm install meshcommander);
@ThinGuy
ThinGuy / pro-pkg-counter.sh
Created June 20, 2025 22:30
An Ubuntu Package Counter - Counts all vs installed and creates manifests by component for the current release.
#!/bin/bash
# An Ubuntu Package Counter - Counts all vs installed and creates manifests by component for the current release.
# Set message
export TITLE='\e[0;1;38;2;233;84;32mUbuntu Pro\e[0;1m™ Package Counter\e[0m'
export GBMSG="Thank you for using \e[0;1;38;2;233;84;32mUbuntu\x21"
# Parameters
export PROG="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/${BASH_SOURCE[0]##*/}"
export DARCH=$(dpkg --print-architecture)
@ThinGuy
ThinGuy / apt-manifest-maker.sh
Last active June 17, 2025 20:42
Create package manifests for all current LTS, Interim, and ESM Ubuntu releases
#!/bin/bash
export ARCH=amd64
export MDIR=~/manifests
[[ -f ${MDIR} ]] && { find ${MDIR} -type f -delete -o type d -delete; } || { mkdir -p ${MDIR}; }
declare -ag UBU_REL_SHORT=($(ubuntu-distro-info --supported-esm && ubuntu-distro-info --supported))
declare -ag UBU_REL_LONG=()
while IFS= read -r LINE;do
@ThinGuy
ThinGuy / aws-pro-counter.sh
Created June 5, 2025 16:07
Script to calculate all vs installed packages on Ubuntu
#!/bin/bash
# An Ubuntu Package Counter - Counts all vs installed and creates manifests by component for current release.
# Set parameters
export TITLE='AWS Summit Washington, DC 2025'
export PROG="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/${BASH_SOURCE[0]##*/}"
export DARCH=$(dpkg --print-architecture)
export REL=$(lsb_release -cs 2>/dev/null|sed 's/^.*$/\u&/')
export VER=$(lsb_release -rs 2>/dev/null)
[[ -f /etc/machine-id ]] && { export MID=$(cat /etc/machine-id); }
@ThinGuy
ThinGuy / pc.py
Created February 25, 2025 22:59
Protocol Checker
import requests
import ftplib
import subprocess
import socket
import argparse
import shutil
from urllib.parse import urlparse
def check_http_https(url):
"""Check if HTTP or HTTPS is available."""
@ThinGuy
ThinGuy / zscaler.sh
Created February 24, 2025 21:53 — forked from CalvinHartwell/zscaler.sh
Zscaler Proxy Example Script for Ubuntu + GNOME including CA Certificate import to browser trust store for Chrome/FF
#!/bin/bash
# Some of these files are uploaded to Landscape server
PAC_FILE_LOCATION="http://<zscaler-pac-config-file-location/file.PAC"
CA_TAR="zscaler.tar.gz"
CA_CERTIFICATE_NAME="<zscaler-root-ca-certificate-name-replace-me.crt>"
CERT_DIR_PATH="/usr/local/share/ca-certificates"
# Import ZSCALER Public CA Root Cert
sudo apt-get install libnss3-tools -y
@ThinGuy
ThinGuy / microcloud-base.yaml
Created January 30, 2025 16:08
One Box Microcloud - Nesting a Microcloud under LXD
name: microcloud-base
description: MicroCloud Base VM Profile
config:
boot.autostart: "true"
linux.kernel_modules: br_netfilter
user.network-config: |
renderer: networkd
version: 2
ethernets:
enp5s0: {}
@ThinGuy
ThinGuy / maas-files.nd
Created December 4, 2024 22:53
How to grab MAAS boot and deployment files
### **Variables**
export RACK=<MAAS_RACK_IP>
export REGION=<MAAS_REGION_IP>
### **Boot Files**
```
curl -sSlL http://$RACK:5248/images/|awk -F'>|<' '/^<a href/{print $3,$5}'
``
@ThinGuy
ThinGuy / msdhcp-maas.md
Created November 14, 2024 18:07
How to Configure Microsoft DHCP for Canonical MAAS

How to Configure Microsoft DHCP for Canonical MAAS

This guide explains how to configure an external Microsoft DHCP server to work with Canonical MAAS (Metal as a Service). Configuring the right DHCP options will ensure that nodes are able to correctly PXE boot and communicate with MAAS for provisioning.

Step 1: Open the DHCP Management Console

  1. On your Windows Server, press Windows + R, type dhcpmgmt.msc, and press Enter.
  2. Alternatively, you can access it through Server Manager by selecting Tools -> DHCP.

Step 2: Select the DHCP Scope to Configure

  1. In the DHCP console, navigate to the appropriate scope that you want to configure for MAAS nodes.