Skip to content

Instantly share code, notes, and snippets.

View chadmayfield's full-sized avatar

Chad Mayfield chadmayfield

View GitHub Profile
@chadmayfield
chadmayfield / Brewfile
Last active April 23, 2024 16:56
My current Brewfile used when setting up my mac and also for updating it.
# Brewfile: Homebrew bundle file for macOS or Linux app install (with notes/source repos)
#
# Author : Chad Mayfield (chad@chadmayfield.com)
# License : GPLv3
#
# INFO: * Links and comments are added because I'm too old to remember where everything is :)
# * install.sh can be used, but it needs some love (some of it doesn't work correctly).
# * TODO items (and additional information) is listed at the bottom
#
# Installation steps;
@chadmayfield
chadmayfield / install_sshpass_macos.sh
Created October 30, 2020 17:25
Download and compile the latest sshpass since homebrew will not allow it's use anymore in Catalina.
#!/bin/bash
if [ "$(xcode-select -p 1>/dev/null; echo $?)" -ne 0 ]; then xcode-select --install; fi && \
curl -O -L -J https://sourceforge.net/projects/sshpass/files/latest/download && \
ARCHIVE="$(find . -name sshpass*.tar.gz -ctime -30s)" && \
tar xvzf "$ARCHIVE" && \
cd "${ARCHIVE%%.*}" && \
echo "./configure" && \
echo "make" && \
echo "sudo make install" && \
@chadmayfield
chadmayfield / private_fork.md
Created September 10, 2020 22:15 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@chadmayfield
chadmayfield / network_interface_notes.md
Last active June 3, 2019 19:36
Notes on Network Interfaces in Linux/Unix systems

Network Interface Notes

Beginning in Systemd v197, network interfaces assigned by systemd/udev are "predicatble";

Names are now based on;

  • Index numbers for on-board devices (eno1)
  • PCI-ehotplug slot index numbers (ens1)
  • Physical/geographical location of hardware connector (enp2s0)
  • MAC address (enx78e7d1ea46da)
  • Classic, unpredictable kernel-native naming (eth0)

My Kuberentes Command Reference

This is my Kubernetes reference page. Most are commands that I don't want to forget, links to credits where due.

Get detailed cluster information

kubectl cluster-info dump

Get list of Kubernetes node IP addresses

kubectl get nodes -o jsonpath='{ $.items[*].status.addresses[?(@.type=="InternalIP")].address }'

@chadmayfield
chadmayfield / check_registry.sh
Created June 2, 2019 23:33
Quick check of registry
#!/bin/bash
# docker api reference : https://docs.docker.com/registry/spec/api/#detail
# docker list repos : https://docs.docker.com/registry/spec/api/#listing-repositories
curl -X GET localhost:5000/v2/_catalog
@chadmayfield
chadmayfield / check_version.sh
Created June 2, 2019 21:19
Check version of a Github project and email (using cron)
#!/bin/bash
# check_version.sh - check github project for latest release version from cron & email
url="https://github.com/USER/REPO/releases/latest"
txt="/tmp/release.txt"
prj="$(echo $url | awk -F "/" '{print $4 "/" $5}')"
cmd="$(curl -sL -o /dev/null -w "%{url_effective}" ${url} | awk -F "/" '{print $NF}')"
if [ ! -f "$txt" ]; then
@chadmayfield
chadmayfield / blacklist.sh
Last active June 2, 2019 21:39
Blacklist domains in a list file
#!/bin/bash
while read line
do
echo "Blacklisting: $line"
pihole -b $line
done < "/path/to/your/blacklisteddomains.list"
tmux start tmux server
tmux new-session -s basic start a new session and name it basic
tmux new -s basic same command as above but abbreviated
CTRL+b command key combo (PREFIX)
PREFIX + d detach window
tmux list-sessions list running sessions
tmux ls list running sessions abbreviated
tmux attach attach to running session
tmux new -s second -d create tmux instance in background
tmux attach -t second attach to session named "second"
user@localhost:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
jenkinsci/blueocean latest 82af3de1a82d 14 hours ago 433MB
gogs/gogs latest ddfb5cfc5595 35 hours ago 169MB
jenkinsci/blueocean <none> 0edbdc899e2e 38 hours ago 433MB
nginx latest 5699ececb21c 2 days ago 109MB
gogs/gogs <none> 1c9ee1dfb9af 2 days ago 169MB
jenkinsci/blueocean <none> a4830eae32eb 2 days ago 433MB
gogs/gogs <none> 58df9f960a87 3 days ago 169MB
gogs/gogs <none> bea8d72e27db 3 days ago 169MB