Skip to content

Instantly share code, notes, and snippets.

View jkeam's full-sized avatar
🍻

Jon Keam jkeam

🍻
View GitHub Profile
@jkeam
jkeam / Dockerfile
Last active April 19, 2024 04:18
Dockerfile for Cookiecutter Django
FROM registry.access.redhat.com/ubi9/python-311:1-52.1712567218
# Build args mainly for asset compilation
ARG DJANGO_SECRET_KEY
ARG REDIS_URL
ARG DJANGO_ADMIN_URL
ARG SPARKPOST_API_KEY
ARG CARE_OFFICE_PASSWORD
ARG DJANGO_AWS_ACCESS_KEY_ID
ARG DJANGO_AWS_SECRET_ACCESS_KEY
@jkeam
jkeam / generate-secret-key-django.sh
Created January 3, 2024 21:46
Generate Django Secret Key
python manage.py shell
from django.core.management.utils import get_random_secret_key
print(get_random_secret_key())
@jkeam
jkeam / nodes.sh
Last active September 20, 2024 22:32
CPU Count For All Worker Nodes (Ignoring Infras and Masters)
#!/bin/bash
function help() {
echo "This script finds all the CPU for all worker nodes (ignoring them if they are also infra)"
echo
echo "Syntax: nodes.sh [-g|h]"
echo "options:"
echo "h Print this help."
echo "o Obfuscate node names."
echo
@jkeam
jkeam / Rails.Dockerfile
Created September 22, 2023 15:38
Dockerfile to build a Universal Developer Image for Dev Spaces to include Ruby and Rails
FROM quay.io/devfile/universal-developer-image:latest
# The following commands require root
USER 0
# Install a recent version of ruby
ENV RUBY_VERSION 3.1.2
RUN dnf -y update && \
dnf -y install rbenv ruby-build sqlite && \
dnf -y clean all --enablerepo='*' && \
@jkeam
jkeam / .devfile.rails.yaml
Created September 22, 2023 15:36
Example DevFile for Rails
schemaVersion: 2.2.0
metadata:
name: rails-blog
attributes:
controller.devfile.io/devworkspace-config:
name: special-workspaces-config
namespace: l0rd-che
components:
- name: bundle-volume
volume:
@jkeam
jkeam / create-aws-vpc.sh
Last active September 9, 2023 17:59
Create AWS VPC and Subnet using AWS CLI and Bash
#!/bin/bash
# taken from: https://brad-simonin.medium.com/create-an-aws-vpc-and-subnet-using-the-aws-cli-and-bash-a92af4d2e54b
export AWS_ACCESS_KEY_ID=something
export AWS_SECRET_ACCESS_KEY=something
export AWS_DEFAULT_REGION=us-east-1
availabilityZone="us-east-1a"
name="Something"
@jkeam
jkeam / swagger_2_0_cat_facts.json
Created August 17, 2023 14:52
Swagger 2.0 Cat Fact API
{
"swagger": "2.0",
"info": {
"title": "Simple Cat API Overview",
"version": "v2"
},
"host": "cat-product-3scale-apicast-staging.apps.raptor.redhat.technology",
"schemes": [
"https"
],
@jkeam
jkeam / dotnet-publish-task.yaml
Created August 4, 2023 21:18
Dotnet Publish Task
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: dotnet-build-publish
namespace: dotnet
spec:
steps:
- env:
- name: WORKSPACE_SSL_CA_DIRECTORY_BOUND
value: $(workspaces.ssl-ca-directory.bound)
@jkeam
jkeam / get_top_pods.sh
Created July 12, 2023 16:41
Get the top pods in all the projects
#!/bin/bash
# Taken from: https://www.redhat.com/architect/openshift-usage-metrics
for project in `oc get project|grep -v NAME`; \
do echo $project; \
oc project $project 2> /dev/null; \
oc adm top pods; \
done;
https://www.redhat.com/sysadmin/openshift-terminating-state