Skip to content

Instantly share code, notes, and snippets.

View WadeBarnes's full-sized avatar

Wade Barnes WadeBarnes

View GitHub Profile
@WadeBarnes
WadeBarnes / listPodsAndNodes.sh
Last active October 17, 2023 13:40
OpenShift - Rough script to find out where (which node) all your pods are running (this can take some time to run if you have access to lots of namespaces).
# Examples:
#
# - List all pods in an 'Unknown' state:
# oc projects -q | xargs -I {} sh -c "oc get -n {} pod -o wide 2>/dev/null | grep Unknown | awk '{print \"{},\"\$1\",\"\$3\",\"\$7}' | column -t -s , -N Namespace,Pod,Status,Node"
#
# - Delete all pods in an 'Unknown' state:
# oc projects -q | xargs -I {} sh -c "oc get -n {} pod -o wide 2>/dev/null | grep Unknown | \$(awk '{print \"oc -n {} delete --force --grace-period=0 pod \" \$1}')"
#
# - List pods on a given node:
# oc projects -q | xargs -I {} sh -c 'echo -e "\n{}:" && oc get -n {} pod -o wide 2>/dev/null | grep Running | grep ociopf-p-195.dmz' | awk '{print $1","$7}' | column -t -s ,
@WadeBarnes
WadeBarnes / TestConnection.sh
Last active November 21, 2019 15:09
A bash script for testing whether or not a port is open.
#!/bin/bash
OCTOOLSBIN=$(dirname $0)
# =================================================================================================================
# Usage:
# -----------------------------------------------------------------------------------------------------------------
usage() {
cat <<-EOF
Tests to see if a port is open.
@WadeBarnes
WadeBarnes / oc-DeleteNewOrPendingBuilds.sh
Created March 14, 2018 14:56
Delete `New` or `Pending` builds in OpenShift
oc delete builds $(oc get builds | grep 'New\|Pending' | awk '{print $1;}')
@WadeBarnes
WadeBarnes / oc-ListNewOrPendingBuilds.sh
Last active March 14, 2018 14:55
List `New` or `Pending` builds in OpenShift
oc get builds | grep 'New\|Pending' | awk '{print $1;}'
@WadeBarnes
WadeBarnes / ShellIconOverlayIdentifiers_Fix.reg
Created February 4, 2018 20:43
Registry script to fix Windows Explorer overlay icon priority issues with Tortoise and Dropbox.
Windows Registry Editor Version 5.00
; ==============================================================================================================================
; Registry script to fix Windows Explorer overlay icon priority issues with Tortoise and Dropbox.
;
; Priority is given to the Tortoise and Dropbox overlays. All others are ordered but are beyond the 15 overlays that
; Windows will use (Window will only use 11 from this list).
;
; Refer to the references for additional details.
;
; Open RegEdit as an administrator.