Skip to content

Instantly share code, notes, and snippets.

View moonape1226's full-sized avatar

Carl Tsai moonape1226

  • Miso Inc.
  • Taiwan, Taipei
View GitHub Profile
#!/usr/bin/env bash
# Reference: https://sharats.me/posts/shell-script-best-practices/
set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi
@moonape1226
moonape1226 / nifi-auto-recovery-docker-compose.yml
Created March 21, 2022 10:27
Nifi with auto recovery mechanism using docker compose
version: "3.5"
networks:
nifi:
services:
nifi:
cap_add:
- NET_ADMIN # low port bindings
image: apache/nifi:1.15.3
@moonape1226
moonape1226 / query-based-routing-ingress.yaml
Last active March 14, 2022 10:46
a k8s ingress manifest to achieve query-based routing with ALB ingress controller
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/actions.rule-path-1: >
{"type": "forward", "forwardConfig": {"targetGroups": [{"serviceName": "nginx-path1", "servicePort": 80, "weight": 100}]}}
alb.ingress.kubernetes.io/conditions.rule-path-1: >
[{"Field":"query-string","QueryStringConfig":{"Values":[{"Key":"path","Value":"nginx1"}]}}]
alb.ingress.kubernetes.io/actions.rule-path-2: >
@moonape1226
moonape1226 / wrong_kubectl_config.txt
Last active July 24, 2021 02:07
wrong kubectl config
apiVersion: v1
clusters:
- cluster:
  certificate-authority-data: ***
  server: https://***.eks.amazonaws.com
  name: ***
...
@moonape1226
moonape1226 / gist:96f9191ec8933d6b6964e61e6d5f3521
Last active February 24, 2023 15:08
S3 bucket policy for storing AWS ALB access log
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::${aws_elb_account_id}:root"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::${bucket_name}/prefix/AWSLogs/${your_account_id}/*"
@moonape1226
moonape1226 / gist:a5cad88aa6564f18a024e6ac1a66adb1
Last active February 24, 2023 15:01
S3 bucket policy for storing AWS NLB access log
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AWSLogDeliveryWrite",
"Effect": "Allow",
"Principal": {
"Service": "delivery.logs.amazonaws.com"
},
"Action": "s3:PutObject",
FROM alpine:3.11
RUN apk update
RUN apk add --no-cache bash python3
RUN apk add --no-cache --virtual=build gcc libffi-dev musl-dev openssl-dev python3-dev make
RUN pip3 install azure-cli
RUN pip3 install awscli
RUN apk del --purge build
ENV TZ Asia/Taipei