[Kubernetes] Setup a Local Development Environment
This file contains hidden or 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 ( | |
"bytes" | |
"crypto/aes" | |
"crypto/cipher" | |
"encoding/hex" | |
"fmt" | |
) |
This file contains hidden or 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 crypto from "crypto"; | |
const algorithm = "aes-256-cbc"; | |
const Aes256 = (text, key, iv) => { | |
let cipher = crypto.createCipheriv(algorithm, new Buffer.from(key), new Buffer.from(iv)); | |
cipher.setAutoPadding(false); | |
let encrypted = cipher.update(PKCS5Padding(text)); | |
encrypted = Buffer.concat([encrypted]); | |
return encrypted.toString("hex"); |
This file contains hidden or 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
// obj === parsed.d.b.q | |
const paginateRef = (ref, obj = {}) => { | |
Object.entries(obj).forEach(([key, value]) => { | |
switch (key) { | |
case "sp": { | |
ref = ref.startAt(value); | |
break; | |
} | |
case "ep": { | |
ref = ref.endAt(value); |
This file contains hidden or 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
#!/usr/bin/env zsh | |
#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" | |
setopt promptsubst | |
autoload -U add-zsh-hook | |
PROMPT_SUCCESS_COLOR=$FG[117] | |
PROMPT_FAILURE_COLOR=$FG[124] | |
PROMPT_VCS_INFO_COLOR=$FG[242] |
This file contains hidden or 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
# Create a service account for Helm and grant the cluster admin role. | |
# It is assumed that helm should be installed with this service account | |
# (tiller). | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: tiller | |
namespace: kube-system | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 |
This file contains hidden or 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
const input = document.getElementById("input"); | |
function debounce(eventListener, msec) { | |
let timer | |
return (...args) => { | |
clearTimeout(timer); | |
timer = setTimeout(() => { | |
clearTimeout(timer); | |
timer = null; | |
eventListener.call(this, ...args); // eventListener(...args) x |
This file contains hidden or 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
type TFormSubmitOptions = { | |
body?: { [key: string]: any }; | |
method?: string; | |
}; | |
const formSubmit = (endpoint: string, options?: TFormSubmitOptions) => { | |
const { body = {}, method = 'POST' } = options || {}; | |
const form = document.createElement('form'); | |
form.setAttribute('method', method); |
OlderNewer