Skip to content

Instantly share code, notes, and snippets.

@mweibel
mweibel / mapping.yaml
Created July 5, 2021 08:18
banzaicloud/logging-operator working ElasticSearch example with index lifecycle management
apiVersion: v1
kind: Secret
metadata:
name: index-template
stringData:
template: '{"index_patterns":["logstash-*"],"template":{"aliases":{"logstash":{}},"mappings":{"dynamic":"true","dynamic_date_formats":["strict_date_optional_time","yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z"],"dynamic_templates":[]},"settings":{"index":{"lifecycle":{"name":"logstash_policy","rollover_alias":"logstash"},"number_of_shards":"1","number_of_replicas":"0"}}}}'
@mweibel
mweibel / Makefile.tools.mk
Created May 24, 2023 11:22
Install Go/gRPC tools with Makefile
# GOBIN indicates the path where go tooling is put.
GOBIN=$(shell go env GOPATH)/bin
##@ Tooling
# Versions
GOLANGCI_LINT_VER=v1.52.2
PROTOC_GEN_GO_VERSION=v1.30.0
PROTOC_GEN_GO_GRPC_VERSION=v1.3.0
PROTOC_GEN_VALIDATE_VERSION=v1.0.0
@mweibel
mweibel / passport-mock.js
Last active December 5, 2022 03:33
Mock passport.js with an own strategy
/**
* Author: Michael Weibel <michael.weibel@gmail.com>
* License: MIT
*/
var passport = require('passport')
, StrategyMock = require('./strategy-mock');
module.exports = function(app, options) {
// create your verify function on your own -- should do similar things as
@mweibel
mweibel / simple-k8s-backup.sh
Created February 12, 2021 09:48
Simple k8s backup if you don't yet have k8up or velero in place. Use with caution. Extend extracted values as needed.
#!/bin/bash
set -o pipefail -o errexit -o nounset -o errtrace
mkdir -p backup/
for ns in $(kubectl get ns --no-headers -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}'); do
kubectl --namespace="${ns}" get -o=yaml role,rolebinding,secret,configmap | \
yq eval '
del(
@mweibel
mweibel / README.md
Last active May 5, 2022 17:40
cortex configuration

README

Do not use initial-values.yaml. It's an example for our blog post and does not show values safe to use in production.

Workflow
Main*
Unknown*
transmit downstream cluster -> Transmitting
Transmitting
transmitted -> Agent
Agent
Agent Unknown
storage provisioning -> Provisioning
@mweibel
mweibel / gen-redis-protocol.sh
Last active December 17, 2020 05:14
Redis protocol generator in bash according to http://redis.io/topics/mass-insert. Use e.g. with `./fixture.sh |redis-cli --pipe`. Whitespaces within values are currently not supported.
#!/bin/bash
#
# License: MIT
# Author: Michael Weibel
#
gen_redis_protocol() {
cmd=$1
proto=""
proto+="*"
// dbgObject is useful when you have no access to console.log, to debug (e.g. using alert()) a built-in object.
function dbgObject(obj) {
if (Array.isArray(obj)) {
return obj
}
if (typeof obj !== "object") {
return obj
}
const dbg = {}
for (var k in obj) {
@mweibel
mweibel / artifact-passing-linux.yaml
Created August 7, 2020 14:44
argo artifact passing
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: artifact-passing-linux-
spec:
entrypoint: artifact-example
artifactRepositoryRef:
key: gcs
templates:
- name: artifact-example
BEGIN MESSAGE.
MtURVCRvQXV1jha GLHReUbv5IY2aon p2MjDWtTt0MRYtb JXnc8xAmAqzGbQa
DnlO3pIFlj66crL uP1ccDkGxWWTCKq 6Xr2MZHgg6XWBAT 0Bb2PcWp4Zy6F4W
Zpati5yDaOHwZSQ 5dW9lDqTYNXY4yz LmfaJJSBca5W7BF ikbAy7IPFAMyAHu
EqrsljYIMg0Q00F eFxEL2b7yOYBwoX BVgF02IP.
END MESSAGE.