Skip to content

Instantly share code, notes, and snippets.

View prashant-shahi's full-sized avatar

Prashant Shahi prashant-shahi

View GitHub Profile
@prashant-shahi
prashant-shahi / nginx.conf
Created July 8, 2023 19:13 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@prashant-shahi
prashant-shahi / SimpleHttpServer.java
Created June 5, 2023 10:07
Simple HTTP Server in Java
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
public class SimpleHttpServer {
public static void main(String[] args) throws IOException {
@prashant-shahi
prashant-shahi / names.json
Last active June 1, 2023 05:01
Sample Names from A to Z - Western
[
"alice",
"bob",
"charlie",
"david",
"eve",
"frank",
"grace",
"heidi",
"ivan",
@prashant-shahi
prashant-shahi / names.json
Last active June 1, 2023 05:01
Sample Names from A to Z - South Asian (Indian)
[
"akash",
"bharat",
"chandu",
"dinesh",
"ekta",
"farhan",
"gaurav",
"harish",
"isha",
<pre id="tiresult" style="font-size: 9px; background-color: #000000; font-weight: bold; padding: 4px 5px; --fs: 9px;"><b style="color:#000000">101110010011011111111101100011111011101100011010101000100001101111100010010100000110000100101010111110010111011000110100010010111111111011111100011011</b>
<b style="color:#000000">001010100101000110100100111111011001001110100110100001</b><b style="color:#010203">0</b><b style="color:#000000">111</b><b style="color:#06070A">1</b><b style="color:#000000">11</b><b style="color:#1D2836">0</b><b style="color:#10161D">1</b><b style="color:#000000">101011111111111111011010011001011000010101101100101000011100011100110000011111011110001</b>
<b style="color:#000000">11101110101001011011101101010001110110011010101011</b><b style="color:#06080A">0</b><b style="color:#151B26">1</b><b style="color:#1A2332">0</b><b style="color:#18202C">1</b><b style="color:#222C3B">0</b><b style="color:#314054">0</b><b style="color:#1F2936">1</b><b style="color:#0C1014">1</b><b style="color:#384A63"
@prashant-shahi
prashant-shahi / license-badges.md
Created November 22, 2022 19:32 — forked from lukas-h/license-badges.md
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

@prashant-shahi
prashant-shahi / Container-Monitoring.json
Last active June 14, 2022 16:28
Docker Meetup - Container Monitoring
{ "layout": [ { "h": 3, "i": "a4f0e09a-91da-402f-a948-a2d978db4dad", "moved": false, "static": false, "w": 6, "x": 0, "y": 2 }, { "h": 3, "i": "9cfac0a5-67e7-4a26-a2fe-1aa62dcb5213", "moved": false, "static": false, "w": 4, "x": 8, "y": 0 }, { "h": 3, "i": "f703c26f-6d3d-49d4-a6fa-3cd963cab8f9", "moved": false, "static": false, "w": 6, "x": 0, "y": 5 }, { "h": 3, "i": "a8e1997a-d7fe-42c2-b4dd-20d608b6cb1e", "moved": false, "static": false, "w": 6, "x": 6, "y": 3 }, { "h": 3, "i": "ce31709c-ff1a-4972-aae1-6b6b1ca640e1", "moved": false, "static": false, "w": 6, "x": 6, "y": 6 }, { "h": 2, "i": "8e7f865f-7d0c-42a8-9a86-997623f6b9a2", "moved": false, "static": false, "w": 3, "x": 3, "y": 0 }, { "h": 2, "i": "06a0f08a-5576-47a9-b579-c111f2d2db23", "moved": false, "static": false, "w": 3, "x": 0, "y": 0 }, { "h": 3, "i": "5d487c9e-3f14-4ea6-b838-756d6dee2bb1", "moved": false, "static": false, "w": 6, "x": 0, "y": 8 }, { "h": 3, "i": "e40a6745-9551-4baa-9cc2-6dc52c79668e", "moved": false, "static": false, "w": 2, "x
@prashant-shahi
prashant-shahi / _readme.md
Created June 9, 2022 14:45 — forked from steeve/_readme.md
How to cross compile Go with CGO programs for a different OS/Arch

How to cross compile Go with CGO programs for a different OS/Arch

It is possible to compile Go programs for a different OS, even though go build says otherwise.

You'll need:

I have created a local Kubernetes cluster with kind. Following are changes you need to get metric-server running on Kind.

Deploy latest metric-server release.

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.5.0/components.yaml

Within existing arguments to metric-server container, you need to add argument --kubelet-insecure-tls.

@prashant-shahi
prashant-shahi / prom-k8s-request-limits.md
Created May 12, 2022 16:53 — 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) /