Skip to content

Instantly share code, notes, and snippets.

View Remove duplicated items in slice
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
View jvm.options
###########################################################################
# 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 #
###########################################################################
View cluster.yml
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: eksdemo
region: us-west-2
nodeGroups:
- name: ng0
instanceType: t3.medium
View install-awscli.sh
#!/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-dev-env.md
Created Aug 13, 2019
【打造順暢的 K8s Dev 環境】行前須知
View k8s-dev-env.md

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

(將於 10 月 1 日完成)

行前準備

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

...

@William-Yeh
William-Yeh / k8s-workshop-201909-eks.md
Last active Aug 13, 2019
給 RD 的 Kubernetes 初體驗(以 EKS 為例)
View k8s-workshop-201909-eks.md

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

課程簡介

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

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

@William-Yeh
William-Yeh / Dockerfile
Created Jun 21, 2019
Modify the "TodoFrontend/Dockerfile" file in Lab 5.0 ~ 7.0
View Dockerfile
#
# 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 Mar 29, 2019
Simple Ambassador demo
View ambassador-rbac.yaml
---
#
# 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
View 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 Apr 12, 2016
Docker run from external volume
View Dockerfile
FROM alpine
VOLUME ["/livecode"]
CMD ["/livecode/hello.sh"]