Skip to content

Instantly share code, notes, and snippets.

View dudash's full-sized avatar
🎸
Be excellent to each other

Jason Dudash dudash

🎸
Be excellent to each other
View GitHub Profile
@dudash
dudash / oc-scale0
Last active April 21, 2022 19:45
oc-scale0: a Plugin for OpenShift CLI to scale all deployments to 0
#!/bin/bash
#
# A simplifed CLI command to scale all deployments to 0
#
# source: https://gist.github.com/dudash/10699ecba6c56e126bd6071f3c187f13/
# docs: https://docs.openshift.com/container-platform/4.7/cli_reference/openshift_cli/extending-cli-plugins.html
#
# To install/use this:
# put this script in /usr/local/bin
# chmod a+x oc-scale0
@dudash
dudash / jboss-eap-image-streams.json
Created July 19, 2017 21:15
OpenShift image streams to import EAP S2I builders into your cluster
{
"kind": "List",
"apiVersion": "v1",
"metadata": {
"name": "jboss-eap-image-streams",
"annotations": {
"description": "ImageStream definitions for JBoss EAP Middleware"
}
},
"items": [
@dudash
dudash / fh-cloudapp-formphototoS3.js
Last active September 18, 2017 23:43
Node.js code to stream a photo from Red Hat Mobile forms to an AWS S3 bucket
var $fh = require('fh-mbaas-api');
var request = require('request');
// // WARNING - DO NOT SHARE AWS KEYS!!!
var AWS = require('aws-sdk');
var AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID;
var AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY;
AWS.config.update({
accessKeyId: AWS_ACCESS_KEY_ID,
secretAccessKey: AWS_SECRET_ACCESS_KEY
@dudash
dudash / aws-lambda-nodejs-S3imageprocessing.js
Last active March 3, 2023 13:47
Simple AWS Lambda function to process an image using imageMagik and dump to S3 (triggered by S3 PUT)
'use strict';
var AWS = require('aws-sdk');
//var im = require('imagemagick');
var im = require("gm").subClass({ imageMagick: true });
var fs = require('fs');
var async = require('async');
// DEBUGGING
// console.log('ENV VARS:');
// console.log('-----------------------');
@dudash
dudash / ansible_ocpsubswitch.md
Last active October 25, 2018 17:03
adhoc Ansible commands for switching Red Hat subscription pool for OpenShift

To switch your OCP subscription to a new one

Create an inventory (aka hosts) file

If you need help, see here

Run the following 4 adhoc Ansible commands

ansible -i hosts -m command -a "subscription-manager repos --disable '*'"
ansible -i hosts -m command -a "subscription-manager remove --all"
ansible -i hosts -m command -a "subscription-manager attach --pool NEW_POOL_ID"
ansible -i hosts -m command -a "subscription-manager repos --disable '*' \
@dudash
dudash / postgres_demo.yml
Last active November 17, 2017 19:35
Stack containing Postgres and Adminer (images coming from dockerhub)
# Use postgres/example user/password credentials
# Switch 3001 to the port you want to expose on localhost
version: '3.1'
services:
db:
image: postgres
restart: always
ports:
@dudash
dudash / oc-waitforpod.sh
Last active April 21, 2022 19:42
OpenShift CLI wait for argument pod to go "Running" - or prompt if no pod name given
#!/bin/bash
# Simple script to wait for named pod
#
# if no arguments are specified it will prompt
# if 1 argument is specified it will look for a pod with that name
# if more than 1 argument is specified it will only use the 1st and ignore the rest
#
# tested against oc 3.9 - might not work with other versions
@dudash
dudash / oc-allmypods
Last active March 18, 2021 20:26
OpenShift CLI get all the pods on all your nodes
#!/bin/bash
echo "--------------------------------------------------"
echo "ALL MY PODS"
echo "--------------------------------------------------"
oc get pods --all-namespaces
echo ""
echo "--------------------------------------------------"
echo "ALL MY PODS MAPPED SORTED BY NODE"
echo "--------------------------------------------------"
oc adm manage-node $(oc get nodes --no-headers -o custom-columns=name:.metadata.name) --list-pods
sudo setfacl -m user:dudash:rw /var/run/docker.sock
@dudash
dudash / docker-inspectall-runtimeuser
Created September 14, 2018 20:38
CLI to list running image details for Image, User, and Container Name
docker inspect $(docker ps -aq) --format '{{.Config.Image}} {{.Config.User}} {{.Name}}'