Skip to content

Instantly share code, notes, and snippets.

View WadeBarnes's full-sized avatar

Wade Barnes WadeBarnes

View GitHub Profile
@WadeBarnes
WadeBarnes / getCredentialFromJenkins
Last active May 1, 2024 19:31
Selectivity extract credentials from Jenkins
def credentialId='credential-id-goes-here'
import com.cloudbees.plugins.credentials.CredentialsProvider
import com.cloudbees.plugins.credentials.Credentials
import com.cloudbees.plugins.credentials.domains.Domain
import jenkins.model.Jenkins
def indent = { String text, int indentationCount ->
def replacement = "\t" * indentationCount
text.replaceAll("(?m)^", replacement)
}
@WadeBarnes
WadeBarnes / getScaledDownPods.sh
Last active January 23, 2024 21:32
List all Deployments and DeploymentConfigs that have been scaled to zero
export items=$(oc projects -q);
for item in ${items}; do
pods=$(oc -n ${item} get dc,deploy 2> /dev/null | awk '$4==0' | awk '{print $1}');
if [ ! -z "${pods}" ]; then
echo -e "\n${item}:";
for pod in ${pods}; do
echo -e "\t${pod}";
done
fi
done
@WadeBarnes
WadeBarnes / getElasticSearchLogs
Created June 29, 2023 11:56
In cluster query Elastic Search for logs for a given namespace through the api
curl -vk -XGET "https://elasticsearch.openshift-logging.svc:9200/_search" -H 'Content-Type: application/json' -H "Authorization: Bearer sha256~123abc" -d'
{
"query": {
"match_all": {}
}
}'
@WadeBarnes
WadeBarnes / container-throttling-queries.md
Last active November 10, 2023 19:19
Container throttling queries that I keep forgetting about

Queries to determine how much a container is being throttled

Examples courtesy of Jason Leach.

Example promql query for OCP:

avg(container_cpu_cfs_throttled_periods_total / container_cpu_cfs_periods_total {namespace=~"4a9599-prod", pod=~".*mediator.*", container_name!="POD", image!=""} * 100) BY (pod) 
  • The namespace portion of the query can be a problem when querying inside a namespace.
@WadeBarnes
WadeBarnes / gist:d50ed906af40c035a0a3cf04b7d938fd
Created February 10, 2023 14:34
Docker build commands for testing/troubleshooting indy-test-automation image builds
docker build \
--no-cache \
--progress plain \
--build-arg URSA_VERSION=0.3.2-1 \
--build-arg PYTHON3_PYZMQ_VERSION=22.3.0 \
--build-arg INDY_PLENUM_VERSION=1.13.1~rc3 \
--build-arg INDY_NODE_VERSION=1.13.2~rc5 \
--build-arg NODE_REPO_COMPONENT=rc \
-f Dockerfile.ubuntu-2004 \
-t dockerfile.ubuntu-2004 \
@WadeBarnes
WadeBarnes / gist:96a82751b0f5bfe5ac130a972e1edd60
Created February 4, 2022 14:27
Install libindy on Ubuntu 20.04
FROM ubuntu:20.04
RUN apt-get update -y && apt-get install -y \
gnupg \
ca-certificates
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88
RUN echo "deb https://repo.sovrin.org/sdk/deb bionic stable" >> /etc/apt/sources.list
RUN apt-get update -y && apt-get install -y \
libindy
@WadeBarnes
WadeBarnes / Dockerfile.indy.ubuntu1804
Created February 4, 2022 14:25
Install libindy on Ubuntu 18.04
FROM ubuntu:18.04
RUN apt-get update -y && apt-get install -y \
gnupg \
ca-certificates
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88
RUN echo "deb https://repo.sovrin.org/sdk/deb bionic stable" >> /etc/apt/sources.list
RUN apt-get update -y && apt-get install -y \
libindy
@WadeBarnes
WadeBarnes / settings.json
Created December 20, 2020 20:34
Windows Terminal Profile
// This file was initially generated by Windows Terminal 1.4.3243.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@WadeBarnes
WadeBarnes / gist:f2ec8ef1ebfec49d6f13f89b30ee2d2a
Last active November 25, 2019 00:56
SchemaSpy command line for MS SQL Database
# Dependancies:
# - Java
# - sqljdbc42.jar downloaded to local directory; http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774
# - Graphviz; https://www.graphviz.org/download/
# - use `-vizjs` in place of installing Graphviz; very slow and creates a larger output then Graphviz set to `-lq`
# - use `-hq` and `-lq` to control image quality
java -jar schemaspy-6.1.0.jar -lq -degree 1 -t mssql05 -host <host> -db <database> -o outDir -u <username> -p <password> -dp ./sqljdbc42.jar
oc get -n devex-von-bc-registries-agent-tools pod -o wide 2>/dev/null | grep Error | awk '{print $1}' | xargs oc -n devex-von-bc-registries-agent-tools delete pod {}