This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## a k8s operator tutorial: https://betterprogramming.pub/build-a-kubernetes-operator-in-10-minutes-11eec1492d30 | |
# create kubernetes cluster in docker | |
kind create cluster --image=kindest/node:v1.21.2 | |
# load curve2operator image to kind node | |
kind load docker-image curve2operator/curve-operator:v1.0.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.gson.Gson; | |
import com.google.gson.stream.JsonReader; | |
import io.grpc.ManagedChannel; | |
import io.grpc.ManagedChannelBuilder; | |
import org.springframework.core.io.DefaultResourceLoader; | |
import org.springframework.core.io.Resource; | |
import org.springframework.core.io.ResourceLoader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# docker-compose -f ./zookeeper.yml up -d | |
version: '3' | |
services: | |
zookeeper: | |
image: zookeeper | |
ports: | |
- 2181:2181 | |
restart: on-failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import json | |
import sys | |
import time | |
from multiprocessing.connection import Client, Listener | |
parser = argparse.ArgumentParser() | |
parser.add_argument("--type", type=str) | |
args = parser.parse_args() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import wave | |
def wav2pcm(wavfile, pcmfile, data_type=np.int16): | |
f = open(wavfile, "rb") | |
f.seek(0) | |
f.read(44) | |
data = np.fromfile(f, dtype= data_type) | |
data.tofile(pcmfile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ env PYENV_DEBUG=1 pyenv install -v 3.6.4 | |
+(/usr/local/bin/pyenv:23): enable -f /usr/local/bin/../libexec/pyenv-realpath.dylib realpath | |
+(/usr/local/bin/pyenv:30): '[' -z '' ']' | |
++(/usr/local/bin/pyenv:32): type -p greadlink readlink | |
++(/usr/local/bin/pyenv:32): head -1 | |
+(/usr/local/bin/pyenv:32): READLINK=/usr/bin/readlink | |
+(/usr/local/bin/pyenv:33): '[' -n /usr/bin/readlink ']' | |
+(/usr/local/bin/pyenv:58): '[' -z /Users/kasheemlew/.pyenv ']' | |
+(/usr/local/bin/pyenv:61): PYENV_ROOT=/Users/kasheemlew/.pyenv | |
+(/usr/local/bin/pyenv:63): export PYENV_ROOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/rand" | |
"errors" | |
"flag" | |
"fmt" | |
"io" | |
"net" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
etcd1: | |
image: "quay.io/coreos/etcd:v3.4.7" | |
entrypoint: /usr/local/bin/etcd | |
command: | |
- '--name=etcd1' | |
- '--data-dir=/etcd_data' | |
- '--initial-advertise-peer-urls=http://etcd1:2380' | |
- '--listen-peer-urls=http://0.0.0.0:2380' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Will purge logs on ${IPS[@]}" | |
echo "Using SSHUSER: ${SSHUSER}, SSHKEY_PATH: ${SSHKEY_PATH}, ${SSHPORT}" | |
for ip in "${IPS[@]}"; | |
do | |
echo "Running purge docker on ${ip}" | |
ssh -i ${SSHKEY_PATH} -o StrictHostKeyChecking=no ${SSHUSER}@${ip} -p${SSHPORT} << 'ENDSSH' | |
export DOCKER_PATH_PREFIX="/var/lib/docker/containers/" | |
for id in $(sudo ls ${DOCKER_PATH_PREFIX}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:alpine AS builder | |
# Set necessary environmet variables needed for our image | |
ENV GO111MODULE=on \ | |
CGO_ENABLED=0 \ | |
GOOS=linux \ | |
GOARCH=amd64 \ | |
GOPROXY=https://goproxy.cn | |
# Move to working directory /build |
NewerOlder