Skip to content

Instantly share code, notes, and snippets.

View Starefossen's full-sized avatar
🚀
Building platforms for the Norwegain Government

Hans Kristian Flaatten Starefossen

🚀
Building platforms for the Norwegain Government
View GitHub Profile
@max-rocket-internet
max-rocket-internet / prom-k8s-request-limits.md
Last active April 15, 2024 08:06
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) /
@oliveratgithub
oliveratgithub / emojis.json
Last active March 25, 2024 16:37
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family: woman, woman, girl, girl", "shortname": ":woman_woman_girl_girl:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F467", "html": "👩‍👩‍👧‍👧", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family: woman, woman, girl, boy", "shortname": ":woman_woman_girl_boy:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F466", "html": "👩‍👩‍👧‍👦", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family: woman, woman, boy, boy", "shortname": ":woman_woman_boy_boy:", "unicode": "1F469 200D 1F469 200D 1F466 200D 1F466", "html": "👩‍👩‍👦‍👦", "category": "People & Body (family)", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family: man, woman, girl, girl", "shortname": ":man_woman_girl_girl:", "unicode": "1F468 200D 1F469 200D 1F467 200D 1F467", "html": "👨‍👩&z
@ssplatt
ssplatt / kube-proxy-amd64.yml
Created December 5, 2017 04:11
mixed arch (arm and amd64, raspberry pi and pc) kubernetes cluster kube-proxy daemonset configs
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
creationTimestamp: null
generation: 1
labels:
k8s-app: kube-proxy-amd64
name: kube-proxy-amd64
selfLink: /apis/extensions/v1beta1/namespaces/kube-system/daemonsets/kube-proxy-amd64
namespace: kube-system
@EnzoMartin
EnzoMartin / Dockerfile
Last active November 10, 2021 08:23
Building & using Node Alpine docker image
# Runtime image
# Following https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
FROM node:7.7-alpine
# Add tini
RUN apk add --no-cache tini
ENTRYPOINT ["/sbin/tini", "--"]
WORKDIR /usr/src/app/
#!/bin/bash
set -e
# Those should be JENKINS vars
NAME=nginx-deployment-3
PODS_COUNT=3
CONTAINER_NAME=nginx
DOCKER_IMAGE='nginx:1.8'
# Template can be copied from deploy.tmp.yaml to update jenkins var
@iler
iler / Dockerfile
Last active August 2, 2019 02:27
Nginx + ngx_pagespeed on Alpine Linux
FROM alpine:3.3
ENV NGINX_VERSION 1.9.14
ENV PAGESPEED_VERSION 1.11.33.0-beta
RUN build_pkgs="build-base linux-headers openssl-dev pcre-dev wget zlib-dev subversion git patch bash gperf python" && \
runtime_pkgs="ca-certificates openssl pcre zlib" && \
apk --no-cache --update add ${build_pkgs} ${runtime_pkgs} && \
mkdir -p /tmp/src/mod_pagespeed/src && \
cd /tmp/src && \
@olih
olih / jq-cheetsheet.md
Last active April 17, 2024 19:46
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@gomfunkel
gomfunkel / elgato-eve.md
Last active September 9, 2023 18:28
Elgato Eve HomeKit Services & Characteristics

Elgato Eve HomeKit Services & Characteristics

A work in progress collection of proprietary and as of yet undocumented HomeKit characteristics and their UUIDs used by Elgato Eve.

This list is not including all Eve accessories available and some services and characteristics still make no sense to me. If you have anything to contribute, please leave a comment. There is no guarantee that the information listed below is correct.

Elgato Eve Energy (Firmware Revision 1.3.1;466)

Service - Characteristic UUID R W Type Description
@0XDE57
0XDE57 / config.md
Last active April 18, 2024 04:36
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable. I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere No longer required: Enable HTTPS-Only Mode, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".