Skip to content

Instantly share code, notes, and snippets.

View haeramkeem's full-sized avatar

@haeramkeem haeramkeem

View GitHub Profile
/* Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#implementing_basic_set_operations */
function isSuperset(set, subset) {
for (const elem of subset) {
if (!set.has(elem)) {
return false;
}
}
return true;
}
@haeramkeem
haeramkeem / init-array.js
Created August 12, 2022 15:49
JS) Init array
/* Source: https://velog.io/@kler/%EC%9E%90%EB%B0%94%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EB%B0%B0%EC%97%B4-%EC%83%9D%EC%84%B1-%EC%B4%88%EA%B8%B0%ED%99%94-%ED%95%9C%EB%B2%88%EC%97%90-%ED%95%98%EA%B8%B0 */
/* console.log()로 v의 값을 확인해보면 undefined가 출력된다. */
const arr = Array.from({length: 5}, (v, i) => {
console.log(v, i)
return i;
});
// => undefined 0
// => undefined 1
// => undefined 2
@haeramkeem
haeramkeem / 00-py-timelog.README.md
Last active August 3, 2022 04:27
docker.io/haeramkeem/py-timelog:0.0.2
@haeramkeem
haeramkeem / sidecar-logging-example.yaml
Last active August 3, 2022 01:33
Sidecar logging example
apiVersion: apps/v1
kind: Deployment
metadata:
name: sidecar-logging-example
labels:
app: sidecar-logging-example
spec:
replicas: 2
selector:
matchLabels:
@haeramkeem
haeramkeem / elasticsearch-v7.17.3.yaml
Created August 2, 2022 06:52
Elasticsearch v7.17.3 - Build from official Elasticsearch helm chart
## ELASTICSEARCH 7.17.3 MANIFEST
##
## Source chart: helm.elastic.co/elasticsearch v7.17.3
## Modifying this manifest is not recommended; rebuild it instead (via Helm)
##
## Modifications:
## 1. Remove `heritage: Helm` labels
## 2. Remove `chart: elasticsearch` labels
## 3. Remove `release: $HELM_RELASE` labels
## 4. Remove Helm testing pod
@haeramkeem
haeramkeem / elasticsearch-local-pv.yaml
Created August 2, 2022 06:38
Elasticsearch local PV sample
---
apiVersion: v1
kind: PersistentVolume
metadata:
## PV name
name: elasticsearch-master-0
spec:
capacity:
## PV size
storage: 10Gi
@haeramkeem
haeramkeem / kubeadm-init-config.yaml
Created August 2, 2022 06:35
Kubeadm init configutaion file sample
## Example Kubeadm init config file
## @see https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-config
## @see https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta3
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
apiServer:
extraArgs:
## Change kube-apiserver's flags to modify the default tolerations for the pods
@haeramkeem
haeramkeem / bash-check-if-variable-is-set.sh
Created July 19, 2022 01:31
Bash) Check if variable is set
#!/bin/bash
# @see https://stackoverflow.com/a/3601734
if [ -n "$1" ]; then
echo "You supplied the first parameter!"
else
echo "First parameter not supplied."
fi
@haeramkeem
haeramkeem / bash-process-sysservice-check.sh
Last active July 12, 2022 06:59
Bash) checking process and systemd service
#!/bin/bash
# Check if process is running
ps aux | grep -v grep | grep ${PROCESS_NAME}
killall -0 ${PROCESS_NAME}
pgrep ${PROCESS_NAME}
# Check if systemd service is active
# @see https://unix.stackexchange.com/a/396638
systemctl is-active ${SERVICE_NAME}