Skip to content

Instantly share code, notes, and snippets.

func SliceUniqMap(s []int) []int {
// @see https://www.reddit.com/r/golang/comments/5ia523/idiomatic_way_to_remove_duplicates_in_a_slice/db6qa2e/
seen := make(map[int]struct{}, len(s))
j := 0
for _, v := range s {
if _, ok := seen[v]; ok {
continue
}
seen[v] = struct{}{}
s[j] = v
###########################################################################
# jvm.options #
# #
# - all flags defined here will be used by cassandra to startup the JVM #
# - one flag should be specified per line #
# - lines that do not start with '-' will be ignored #
# - only static flags are accepted (no variables or parameters) #
# - dynamic flags will be appended to these on cassandra-env #
###########################################################################
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: eksdemo
region: us-west-2
nodeGroups:
- name: ng0
instanceType: t3.medium
@William-Yeh
William-Yeh / install-awscli.sh
Created August 23, 2019 08:15
eksctl bootstrap
#!/bin/bash
#
# @see https://github.com/pahud/amazon-eks-workshop/blob/master/00-getting-started/create-eks-with-eksctl.md
#
cleanup() {
rm -rf awscli-bundle
rm -f awscli-bundle.zip
}
@William-Yeh
William-Yeh / k8s-workshop-201909-eks.md
Last active August 13, 2019 09:47
給 RD 的 Kubernetes 初體驗(以 EKS 為例)

給 RD 的 Kubernetes 初體驗(以 EKS 為例)

課程簡介

Kubernetes 是目前雲端環境的顯學。可是,傳統的程式,並不是原封不動搬上去,就能夠自動享受 Kubernetes 所宣稱的種種好處。

新的環境,不僅需要新的 Ops 思維,也需要新的 Dev 思維。我們將以一個半小時的時間,從軟體研發者的角度,探討軟體的設計該做哪些最起碼的改變,並體驗 Kubernetes 引進的新觀念及新效益。

@William-Yeh
William-Yeh / k8s-dev-env.md
Created August 13, 2019 09:30
【打造順暢的 K8s Dev 環境】行前須知

【打造順暢的 K8s Dev 環境】行前須知

(將於 10 月 1 日完成)

行前準備

為了活動進行順利,請在出席活動前,確實備妥下列事項。

...

@William-Yeh
William-Yeh / Dockerfile
Created June 21, 2019 04:46
Modify the "TodoFrontend/Dockerfile" file in Lab 5.0 ~ 7.0
#
# http static server one-liners
#
FROM busybox:1.30
WORKDIR /app
COPY . .
RUN chmod +x run.sh
@William-Yeh
William-Yeh / ambassador-rbac.yaml
Last active March 29, 2019 10:41
Simple Ambassador demo
---
#
# Ambassador version: 0.52.0
#
# Adapted from: https://getambassador.io/yaml/ambassador/ambassador-rbac.yaml
# See: https://www.getambassador.io/user-guide/getting-started/
#
apiVersion: v1
kind: Service
@William-Yeh
William-Yeh / k8s in 5 minutes
Last active February 18, 2019 10:12
k8s in 5 minutes
1. Install Docker CE and enable Kubernetes:
See Figure 1 and 2 in https://medium.com/slalom-technology/get-kubernetes-running-locally-on-osx-and-windows-b3b5f176b5bb
2. (Optionally) Install k8s dashboard:
```
$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
$ kubectl proxy
```
@William-Yeh
William-Yeh / Dockerfile
Created April 12, 2016 04:22
Docker run from external volume
FROM alpine
VOLUME ["/livecode"]
CMD ["/livecode/hello.sh"]