Skip to content

Instantly share code, notes, and snippets.

View grampelberg's full-sized avatar

Thomas Rampelberg grampelberg

View GitHub Profile
import _merge from 'lodash/merge'
import { useEffect, useState } from 'react'
import { BehaviorSubject, combineLatest, interval, of, Subject } from 'rxjs'
import { fromFetch } from 'rxjs/fetch'
import {
filter,
map,
materialize,
pairwise,
pluck,
:root {
--toolbar-regular-height: 56px;
}
@media (min-width: 0px) and (orientation: landscape) {
:root {
--toolbar-regular-height: 48px;
}
}
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c -x
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CURRENT_DIR := $(notdir $(patsubst %/,%,$(dir $(MKFILE_PATH))))
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: fortune-teller-app
labels:
k8s-app: fortune-teller-app
spec:
replicas: 1
template:
import React, { useState, useEffect, useRef } from 'react';
import fetch from 'fetch-hoc';
import classNames from 'classnames';
import { useHotkeys } from 'react-hotkeys-hook';
const scrollOpts = { behavior: "smooth", block: "nearest" };
const Row = props => {
const {data, selected} = props;
const [visible, setVisible] = useState(true);
---
kind: TrafficTarget
apiVersion: access.smi-spec.io/v1alpha1
metadata:
name: path-specific
namespace: default
destination:
# Note: no service account name
name: service-a
# Note: no namespace, these policies should live in the namespace they are matching.
#!/bin/ash
github_changelog_generator $@
# If CHANGELOG.md exits, copy it to an env var
if [[ -e 'CHANGELOG.md' ]]; then
export CHANGELOG="$(cat CHANGELOG.md | sed ':a;N;$!ba;s/%/%25/g' | sed ':a;N;$!ba;s/\n/%0A/g' | sed ':a;N;$!ba;s/\r/%0D/g)"
fi
echo "$CHANGELOG"
echo ::set-output name=changelog::"${CHANGELOG}"
func routes() []string {
raw := reflect.ValueOf(http.DefaultServeMux).Elem().FieldByName("m")
raw = reflect.NewAt(raw.Type(), unsafe.Pointer(raw.UnsafeAddr())).Elem()
var rts []string
for _, k := range raw.MapKeys() {
rts = append(rts, k.String())
}
sort.Strings(rts)
@grampelberg
grampelberg / iptables.bash
Created November 13, 2019 22:58
k8s diagnostic tools
# Get iptables dumps for *every* namespace currently on the host
# NOTE: k8s services go into the host network namespace so they're inherited by everyone
# pod ip addresses go into their own network namespace
lsns | grep net | awk '{ print $4 }' | xargs -IX nsenter -t X -n iptables-save | curl -F 'f:1=<-' ix.io
INSTALLS ?= nginx-linkerd nginx-bare
define getsvc
kubectl get svc --all-namespaces -l app=nginx-ingress \
--no-headers
endef
define lbip
$(call getsvc) \