Skip to content

Instantly share code, notes, and snippets.

View marfenij's full-sized avatar

Oleksandr Grechishkin marfenij

View GitHub Profile
kubectl get po --all-namespaces | grep Evicted | awk '{print $2, "--namespace", $1}' | xargs kubectl delete pod
initContainers:
- name: volume-mount-hack
image: busybox
command: ["sh", "-c", "chown -R 200:200 /nexus"]
volumeMounts:
- name: <your nexus volume>
mountPath: /nexus
schema: "1" # Schema must match for all
id: auth
metadata:
name: Template to deploy auth api
variables:
- name: k8s-account
description: kubernetes account to deploy
type: string
group: Deployment
- name: namespace
@marfenij
marfenij / gist:893082cb023a691e913c28f2cf929707
Created May 15, 2019 08:43
Suspend/Resume k8s cronjobs
# suspend active cronjobs
kubectl.exe get cronjob | grep False | awk '{print $1}' | xargs kubectl patch cronjob -p '{"spec" : {"suspend" : true }}'
# resume suspended cronjobs
kubectl.exe get cronjob | grep True | awk '{print $1}' | xargs kubectl patch cronjob -p '{"spec" : {"suspend" : false }}'
@marfenij
marfenij / README.md
Created July 25, 2019 10:11 — forked from miku/README.md
git --track vs --set-upstream vs --set-upstream-to

README

Short excursion into git --track, --set-upstream and --set-upstream-to.

All examples use the aliases co for checkout and br for branch.

Setup:

$ git clone [email protected]:AKSW/OntoWiki.git

jq -cr '.[] | "\(.name) \(.)"' test.json | awk '{ file=$1".json"; print $2 > file; close(file); }'

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

kubectl get pods -n kube-system -l k8s-app=prometheus-to-sd -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.containers[*].image}{"\n"}{end}'
https://kubernetes.io/docs/reference/kubectl/jsonpath/
# get inactive rs
kubectl get rs | awk '{if ($2=="0") print $0}'
# delete inactive rs
kubectl get rs | awk '{if ($2=="0") print $1}' | xargs kubectl delete rs
# get error job
kubectl get job | awk '{if ($2=="0/1") print $0}'
# delete error job

Bash

Moving

command description
ctrl + a Goto BEGINNING of command line
ctrl + e Goto END of command line
ctrl + b move back one character