Skip to content

Instantly share code, notes, and snippets.

View clcollins's full-sized avatar

Christopher Collins clcollins

View GitHub Profile
@clcollins
clcollins / bashrc_snippet.sh
Created December 9, 2019 14:55
Print all or an index of $GOPATH
# Without an argument, prints the current gopath
# With a integer argument, prints the directory at the index of a multi-directory GOPATH
gopath ()
{
if [ -z "$GOPATH" ]; then
echo "GOPATH not set...";
exit 1;
fi;
local gopath="${GOPATH}";
@clcollins
clcollins / get_node_hostname_labels
Created February 18, 2020 19:43
Scripts for patching a project namespace and deploying pods onto specified nodes in OpenShift
#!/usr/bin/env bash
oc get nodes -l type=compute -o=jsonpath='{range .items[*]}{.metadata.labels.hostname}{"\n"}{end}'
@clcollins
clcollins / get_unowned_accounts.py
Created March 9, 2020 21:21
Identify accounts without legalEntities that are claimed and have a claimLink, but do not have a corresponding account claim
#!/usr/bin/env python
from subprocess import Popen, PIPE
import json
def get_data_from_hive():
# Get a list of all accounts
acct_cmd = [
"oc",
"get",
@clcollins
clcollins / aws-account-operator-env
Last active April 15, 2020 20:43
GVM Project Config
#!/usr/bin/env bash
# The name of the project
name='aws-account-operator'
# The path to be used in the Go /src/ dir
project_source_path="github.com/openshift/${name}"
# Set Go version you want to use
go_version='1.13.1'
@clcollins
clcollins / dmesg.log
Created May 13, 2020 13:36
RPi 4 Raspbian dmesg log
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.19.97-v7l+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1294 SMP Thu Jan 30 13:21:14 GMT 2020
[ 0.000000] CPU: ARMv7 Processor [410fd083] revision 3 (ARMv7), cr=30c5383d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[ 0.000000] OF: fdt: Machine model: Raspberry Pi 4 Model B Rev 1.1
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] cma: Reserved 256 MiB at 0x000000001ec00000
[ 0.000000] On node 0 totalpages: 1012736
[ 0.000000] DMA zone: 1728 pages used for memmap
@clcollins
clcollins / manual_account_cleanup.py
Last active July 13, 2020 17:40
AWS Account Cleanup
#!/usr/bin/env python3
#
# This script written for python3.7
# If running on hive, you will need a virtualenv.
#
# $ virtualenv venv -p python3.7
# $ pip install boto3
#
# Then you should be able to run this script.
@clcollins
clcollins / rpidentify.sh
Created June 26, 2020 15:48
Raspberry Pi LED Identifier
#!/bin/bash
set -o errexit
set -o nounset
trap quit INT TERM
COUNT=0
if ! [ $(id -u) = 0 ]; then
@clcollins
clcollins / piday_countdown_changes.md
Last active March 16, 2021 19:54
PiDay Countdown Article Changes

In the section "Countdown Logic", replace the code example with this:

def countdown(now):
    piday = datetime(now.year, 3, 14)

    # Add a year if we're past PiDay
    if piday < now:
        piday = datetime((now.year + 1), 3, 14)
@clcollins
clcollins / fio.yaml
Created April 5, 2021 18:30
Deploy Openshift File Integrity Operator
---
apiVersion: v1
kind: Namespace
metadata:
name: openshift-file-integrity
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
@clcollins
clcollins / kube-verify.yaml
Last active April 20, 2021 23:01
Kube Verify deployment
---
apiVersion: v1
kind: Namespace
metadata:
labels:
kubernetes.io/metadata.name: kube-verify
name: kube-verify
spec:
---
apiVersion: apps/v1