Skip to content

Instantly share code, notes, and snippets.

View canit00's full-sized avatar
🖥️
01101100 01100101 01100001 01110010 01101110 01101001 01101110 01100111

canit00

🖥️
01101100 01100101 01100001 01110010 01101110 01101001 01101110 01100111
  • U.S.
View GitHub Profile
@canit00
canit00 / git-clearHistory
Created August 22, 2020 22:32 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
kind: ServiceAccount
apiVersion: v1
metadata:
name: ldap-group-syncer
namespace: openshift-authentication
labels:
app: cronjob-ldap-group-sync
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
@canit00
canit00 / alert.sh
Created September 22, 2019 15:49 — forked from cherti/alert.sh
send a dummy alert to prometheus-alertmanager
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",
@canit00
canit00 / openshift-cheatsheet.md
Created March 25, 2019 11:34 — forked from rafaeltuelho/openshift-cheatsheet.md
My Openshift Cheatsheet

My Openshift Cheatsheet

Examine the cluster quota defined for the environment:

$ oc describe AppliedClusterResourceQuota

Install pkgs using yum in a Dockerfile

@canit00
canit00 / mail_body.j2
Created February 6, 2019 17:36 — forked from halberom/mail_body.j2
ansible - example of using mail module to send one email for all hosts
# templates/mail_body.j2
{% for host in play_hosts %}
The {{ host }} says {{ hostvars[host]['result']['stdout'] }}
{% endfor %}
@canit00
canit00 / Ansible Disk Check
Created November 10, 2018 02:52 — forked from alexanderadam/Ansible Disk Check
Show disk space and warn about disk full in Ansible
* Shows a message while asserting like:
ok: [host] => {
"msg": "disk usage 4.2B of total 20.0GB (21.0%) (should exceed limit 90.0%)"
}
* Note this only looks at first mount point on current node
* Fails if disk is near-full
* Last step pushes to a push-based monitoring service, which will alert us if it doesn't get there after some time
* Need to setup a variable `disk_limit`, which is the max acceptable usage ratio, e.g. set it to 0.8 if you want to keep disks within 80% of max size
@canit00
canit00 / kubectl.md
Created November 5, 2018 19:35 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@canit00
canit00 / openshift_cli_tricks.MD
Created November 5, 2018 17:42 — forked from tuxfight3r/openshift_cli_tricks.MD
openshift cli tricks - using go templates

openshift list all pods and thier specs (requests/limits)

oc get pod -o jsonpath='{range .items[*]}{"SPEC:  \n  LIMITS  : "}{.spec.containers[*].resources.limits}{"\n  REQUESTS: "}{.spec.containers[*].resources.requests}{"\n"}{end}'

openshift list all pods and thier specs with name (requests /limits)

oc get pod -o jsonpath='{range .items[*]}{"NAME:  "}{.metadata.name}{"\nSPEC:  \n  LIMITS  : "}{.spec.containers[*].resources.limits}{"\n  REQUESTS: "}{.spec.containers[*].resources.requests}{"\n\n"}{end}'
@canit00
canit00 / pyscript.py
Created October 21, 2018 15:42 — forked from nhoffman/pyscript.py
Python script template
#!/usr/bin/env python
"""A simple python script template.
"""
from __future__ import print_function
import os
import sys
import argparse
@canit00
canit00 / opt1_template.j2
Created October 12, 2018 13:44 — forked from halberom/opt1_template.j2
ansible - example of template if else
{# style 1 - long form #}
{% if filepath == '/var/opt/tomcat_1' %}
{% set tomcat_value = tomcat_1_value %}
{% else %}
{% set tomcat_value = tomcat_2_value %}
{% endif %}
{# style 2 - short form #}
{% set tomcat_value = tomcat_1_value if (filepath == '/var/opt/tomcat_1') else tomcat_2_value %}