Skip to content

Instantly share code, notes, and snippets.

View ThinGuy's full-sized avatar

craig bender ThinGuy

View GitHub Profile
@ThinGuy
ThinGuy / ubuntu-namecheck.py
Created November 6, 2026 16:27
Ubuntu Name Check
#!/usr/bin/env python3
"""ubuntu-namecheck 1.0.0 | Read-only host name resolution diagnostics for Ubuntu amd64.
Requirements: Python 3.4+, glibc getent. No pip packages, dig, or root required.
Examples and exit codes: ubuntu-namecheck.py --help
"""
import argparse
import concurrent.futures
import datetime
import glob
@ThinGuy
ThinGuy / ubuntu-dns-doctor.sh
Created November 6, 2026 16:24
Ubuntu DNS Doctor
#!/usr/bin/env bash
#
# ubuntu-dns-doctor.sh
#
# Read-only test and troubleshooting tool for name resolution on Ubuntu amd64.
# Detects which resolver stack the release (and this particular machine) is
# actually using, then walks every layer an application lookup passes through:
#
# application -> glibc NSS (/etc/nsswitch.conf "hosts:")
# -> files (/etc/hosts) | myhostname | mdns4_minimal (avahi) | resolve
@ThinGuy
ThinGuy / lds-reg.sh
Last active November 6, 2026 16:05
Register Landscape
if $(test -f /etc/landscape/landscape-server.crt);then
landscape-config \
-k /etc/landscape/landscape-server.crt \
-t $(hostname -s) \
-u https://landscape.canonical.com/message-system \
--ping-url http://landscape.canonical.com/ping \
-a standalone \
-p lds-123456789-demo \
--http-proxy="" \
--https-proxy="" \
@ThinGuy
ThinGuy / re-ip.sh
Created January 15, 2026 18:55
RACADM commands to re-IP iDRAC
# Set static IP configuration
racadm setniccfg -s <IP_ADDRESS> <NETMASK> <GATEWAY>
# Example:
racadm setniccfg -s 192.168.1.100 255.255.255.0 192.168.1.1
# For DHCP instead:
racadm setniccfg -d
@ThinGuy
ThinGuy / re-ip.py
Created January 15, 2026 18:54
Redfish API to re-IP iDRAC
#!/usr/bin/env python3
import requests
import json
from requests.auth import HTTPBasicAuth
import urllib3
# Disable SSL warnings if using self-signed certs
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# iDRAC credentials and current IP
@ThinGuy
ThinGuy / maas-paths.txt
Created October 21, 2025 17:05
MAAS Paths
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}'
## Test pulling static file via tftp (requires install tftp-hpa package):
### tftp -m binary $RACK -c get <filename from above>
@ThinGuy
ThinGuy / pkgcmp.sh
Last active October 14, 2025 17:13
Quickly check what component (main, universe,etc) . Supports simple regex (via 'apt-cache search -n').
pkgcmp() {
for P in $(apt-cache search -n "${@}"|awk -F' - ' '{print $1}');do
[[ -z ${P} ]] && { continue; };
printf "${P}: $(apt-cache show ${P}|awk '/^Section:/&&!/^$/{if ($2 !~ /\//) print "main";else {gsub(/\/.*/,"",$2);print $2}}')\n";
done
};export -f pkgcmp
@ThinGuy
ThinGuy / change-install-repo.sh
Created October 7, 2025 17:03
Change security.ubuntu.com with us.archive.ubuntu.com for geo-fenced installed.
#!/bin/bash
# Create Directory
mkdir -p ~/www
# Enter directory
cd ~/www
# Create autoinstall.yaml
cat > ~/www/user-data << 'EOF'
@ThinGuy
ThinGuy / geoip.sh
Created October 2, 2025 15:03
Get ipinfo of an FQDN
# prereqs: dnsutils jq
# sudo apt install jq dnsutils -y
geoip() {
dig +short ${@}| \
xargs -rn1 -P1 bash -c \
'curl -sSlL ipinfo.io/${0}|jq -r '"'"'"\(.hostname)\n\(.ip)\n\(.city)\n\(.region)\n\(.country)"'"'"'|paste -sd,'|\
sort -t, -k5V
};export -f geoip
@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"