Skip to content

Instantly share code, notes, and snippets.

View JosiahKerley's full-sized avatar

Josiah Kerley JosiahKerley

View GitHub Profile
@JosiahKerley
JosiahKerley / bond-on-a-bridge.sh
Created August 12, 2023 19:56
QAD DHCP Bond-on-a-Bridge
nmcli --terse con show | cut -d':' -f2 | xargs -I {} nmcli con delete {}
nmcli con add type bridge con-name bridge0 ifname bridge0
nmcli con add type bond con-name bond0 ifname bond0 bond.options "downdelay=100,miimon=100,mode=active-backup,updelay=100" master bridge0
nmcli device status | awk '/ethernet/{print $1}' | xargs -I {} nmcli con add type ethernet con-name {} ifname {} master bond0
<html>
<body>
<script>
while(true);
</script>
</body>
</html>
@JosiahKerley
JosiahKerley / gist:23e8f267df557c5aa0638811543255f8
Created November 14, 2021 22:29
can the board detect when the UPS is on battery power?
#!/usr/bin/python3
import smbus
import time
import os
import sys
import logging
logging.basicConfig(filename='/var/log/power-monitor.log',
filemode='a',
format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
#!/bin/bash
<< COMMENT
If you are using lab rPi's or rhel-based/debian-based vagrant machines,
this should install the serf binary, install a few support packages as well
as a demo tool that uses serf as well as a side-car service.
COMMENT
## Settings
URL=https://releases.hashicorp.com/serf/0.8.1/serf_0.8.1_linux_amd64.zip
[[ -f /etc/rpi-issue ]] && URL=https://releases.hashicorp.com/serf/0.8.1/serf_0.8.1_linux_arm.zip
auth --enableshadow --passalgo=sha512
url --url=http://mirror.centos.org/centos/7/os/x86_64/
text
firstboot --enable
keyboard --vckeymap=us --xlayouts='us'
lang en_US.UTF-8
rootpw --iscrypted $1$changeme$Gc5uJM96SM5XUZNUcieKS/
services --enabled="chronyd"
timezone America/Denver --isUtc
reboot
## Onboard SD Card is --------> /dev/disk/by-path/pci-0000:00:1d.0-usb-0:1.3.1:1.0-scsi-0:0:0:0
## Leftmost disk is ----------> /dev/disk/by-path/pci-0000:00:1f.2-ata-1.0
## Center-leftmost disk is ---> /dev/disk/by-path/pci-0000:00:1f.2-ata-1.1
## Center-rightmost disk is --> /dev/disk/by-path/pci-0000:00:1f.2-ata-2.0
## Rightmost disk is ---------> /dev/disk/by-path/pci-0000:00:1f.2-ata-2.1
auth --enableshadow --passalgo=sha512
url --url=http://mirror.centos.org/centos/7/os/x86_64/
#url --url=http://192.168.1.254:8080/CentOS-7-x86_64-Everything-1708.iso
repo --name="epel" --baseurl=http://download.fedoraproject.org/pub/epel/7/x86_64
repo --name="mariadb" --baseurl=http://yum.mariadb.org/10.1/centos7-amd64
#!/usr/bin/python
import argparse
parser = argparse.ArgumentParser(description='Libvirt based VM builder')
parser.add_argument('--name', '-n', action="store", dest="name", required=True, help='Name of the service')
parser.add_argument('--description', '-d', action="store", dest="description", default=None, required=False, help='Descriprion of the service')
parser.add_argument('--command', '-c', action="store", dest="command", required=True, help='Bash command to execute')
results = parser.parse_args()
if results.description == None:
results.description = results.name
template = '''
@JosiahKerley
JosiahKerley / gist:0009423d597aa1987c1f
Last active October 17, 2015 02:49
Autologon tool for RHEL 7
#!/bin/bash
if [ ! -d ~/.autologon ]
then
mkdir -p ~/.autologon
fi
if [ "$1" == "enable" ]
then
cat /lib/systemd/system/getty@.service > ~/.autologon/lastexec
sed -i '/^ExecStart/s/ExecStart.*/ExecStart=-\/sbin\/agetty --autologin root --noclear %I/' /lib/systemd/system/getty@.service
if [ ! "$2" == "" ]
@JosiahKerley
JosiahKerley / gist:f705380fb231d1aad201
Created August 11, 2014 21:14
rolling-restart.sh
#!/bin/bash
echo "Starting reboot sequence: $*"
echo ""
thisHost=False
user=root
if [ "$*" != "" ]
then
for i in $*
do