Skip to content

Instantly share code, notes, and snippets.

View nebed's full-sized avatar
🤓

Uchenna Nebedum nebed

🤓
View GitHub Profile
@nebed
nebed / prom-k8s-request-limits.md
Created February 1, 2023 08:38 — forked from max-rocket-internet/prom-k8s-request-limits.md
How to display Kubernetes request and limit in Grafana / Prometheus properly

CPU: percentage of limit

A lot of people land when trying to find out how to calculate CPU usage metric correctly in prometheus, myself included! So I'll post what I eventually ended up using as I think it's still a little difficult trying to tie together all the snippets of info here and elsewhere.

This is specific to k8s and containers that have CPU limits set.

To show CPU usage as a percentage of the limit given to the container, this is the Prometheus query we used to create nice graphs in Grafana:

sum(rate(container_cpu_usage_seconds_total{name!~".*prometheus.*", image!="", container_name!="POD"}[5m])) by (pod_name, container_name) /
@nebed
nebed / remove_mirrors.sh
Created February 1, 2021 08:40
Remove mirrors for Yum to use default
sed -i -e 's/^#[ ]*baseurl/baseurl/' -e 's/^mirrorlist/#mirrorlist/' -e 's/^metalink/#metalink/' -e 's/download.fedoraproject.org/epel.mirror.constant.com/' /etc/yum.repos.d/*
echo "YUM Mirrors fixed"
@nebed
nebed / daemonset-scaledown.md
Created January 14, 2021 09:26 — forked from ragul28/daemonset-scaledown.md
k8s Trick to Scale down daemonset to zero
  • Scaling k8s daemonset down to zero
kubectl -n kube-system patch daemonset myDaemonset -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'
  • Scaling up k8s daemonset
kubectl -n kube-system patch daemonset myDaemonset --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]'
@nebed
nebed / daemonset-scaledown.md
Created January 14, 2021 09:26 — forked from ragul28/daemonset-scaledown.md
k8s Trick to Scale down daemonset to zero
  • Scaling k8s daemonset down to zero
kubectl -n kube-system patch daemonset myDaemonset -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'
  • Scaling up k8s daemonset
kubectl -n kube-system patch daemonset myDaemonset --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]'
@nebed
nebed / Activate Office 2019 for macOS VoL.md
Created November 20, 2020 07:35 — forked from zthxxx/Activate Office 2019 for macOS VoL.md
crack activate office on mac with license file

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref

@nebed
nebed / disk_from_snapshots.sh
Last active March 24, 2021 15:50
disk from aks snapshots
kubectl get pvc -o json | jq '.items[] | select(.spec.storageClassName == "azuredisk-ssd") | {snapshot: .metadata.name, pvc: .spec.volumeName }' | jq -s '.' > input.json
jq -c '.[]' input.json | while read i; do
zone="true"
resourcegroup="MC_orms-test-stage_orms-main_centralus"
snapshot="/subscriptions/fe06e95f-6f15-4f11-bffa-196d0eb5dd7e/resourceGroups/orms-ms-stage/providers/Microsoft.Compute/snapshots/"$(echo $i | jq -r .snapshot)
pvc="kubernetes-dynamic-"$(echo $i | jq -r .pvc)
az disk delete --name $pvc --resource-group $resourcegroup --yes
if [[ "$snapshot" == *a ]] && [[ "$zone" == "true" ]]
then
az disk create -g $resourcegroup -n $pvc --size-gb 32 --sku Premium_LRS --source $snapshot --zone 1
@nebed
nebed / RCA_report.md
Last active August 29, 2019 22:04
Root Cause Analysis report for Issue No. AESCIS-38263

Root Cause Analysis of the AES EDI Jira (AESEDI-53447)

Date

2019-08-27

Authors

Uchenna Nebedum

Status

Resolved

@nebed
nebed / index.html
Created December 10, 2018 19:53
Two vue-slider on the page
<div id="slider-example">
<p>{{height.max}}</p>
<slider-component v-model="height.value" :ini-value="[height.min,height.max]">
<div></div>
</slider-component>
<slider-component v-model="length.value" :ini-value="[length.min,length.max]"></slider-component>
</div>
@nebed
nebed / README.md
Last active September 18, 2020 14:08 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

All hex value from 100% to 0% alpha:

@nebed
nebed / big_hash_code.py
Created March 1, 2018 14:54
hashcode_big data set
import numpy as np
global valid_slices
valid_slices = 0
global beg_row
beg_row = 0
global beg_col
beg_col = 0
global max_row
max_row=set()