Skip to content

Instantly share code, notes, and snippets.

@leopay
leopay / zle_cut_copy.zsh
Created August 12, 2021 05:33 — forked from jclosure/zle_cut_copy.zsh
Fixing zsh's zle cut/copy keys for selected region to be identical to emacs (oh-my-zsh)
# Documented in the zsh manual: http://zsh.sourceforge.net/Guide/zshguide04.html
# under sections: "4.1.1: The simple facts" and "4.5.5: Keymaps"
# the default keymap for zle is "Emacs"
# The emacs keymap bindings for kill-region and copy-region-as-kill are a little off from emacs' defaults
# the zsh defaults are:
# M-w => kill-region
# M-W => copy-region-as-kill (that's M-S-w)
tkc exec $(tkc get po -lapp=ratings -ojsonpath={.items..metadata.name}) \
-c istio-proxy \
-- curl -s http://localhost:15000/config_dump | \
jq -r '.configs[-1].dynamic_active_secrets[0].secret.tls_certificate.certificate_chain.inline_bytes' | \
base64 -d | sed -n '/-----BEGIN /,/-----END/p; /----END/q'|openssl x509 -nocert -ext "subjectAltName"
@leopay
leopay / check-etcd.sh
Created May 18, 2020 04:38
check-etcd.sh
# Check etcd Members on all Nodes
docker exec etcd etcdctl member list
# Check Endpoint Status
docker exec -e ETCDCTL_ENDPOINTS=$(docker exec etcd /bin/sh -c "etcdctl member list | cut -d, -f5 | sed -e 's/ //g' | paste -sd ','") etcd etcdctl endpoint status --write-out table
# Check Endpoint Health
docker exec -e ETCDCTL_ENDPOINTS=$(docker exec etcd /bin/sh -c "etcdctl member list | cut -d, -f5 | sed -e 's/ //g' | paste -sd ','") etcd etcdctl endpoint health
# Check Connectivity on Port TCP/2379
@leopay
leopay / installRKE.sh
Last active September 3, 2020 05:27
installRKE.sh
#!/bin/sh
set -e
UNAME=${UNAME:-ess}
GROUP=${GROUP:-ess}
HOST=${HOST:-"10.78.112.194"}
HOSTNAME="myrancher.com"
HELM_INSTALL_DIR=$(pwd)
@leopay
leopay / downloadRKE.sh
Last active October 4, 2020 18:03
get RKE
#!/bin/sh
# This script is inspired by Istio installation script
#
# The script fetches the latest RKE release
# It's derived from ../downloadRKE.sh which is for stable releases but lets
# users do curl -L https://git.io/getLatestRKE | ISTIO_VERSION=1.1.1 sh -
# for instance to change the version fetched.
# This is the latest release candidate (matches ../istio.VERSION after basic
var express = require('express')
var crypto = require('crypto')
var app = express()
var hmac = function (key, content) {
var method = crypto.createHmac('sha1', key)
method.setEncoding('base64')
method.write(content)
method.end()
return method.read()
var webWs = new WebSocket("ws://192.168.147.157:8443/ws");
webWs.onopen = () => {
webWs.send(JSON.stringify({
cmd:"register",
clientid:"web",
roomid:"adminroom"
})
);
};
@leopay
leopay / kubernetes-install.sh
Last active August 5, 2017 10:45
kubernetes-install
curl \
--progress-bar \
--location \
'https://github.com/kubernetes/kubernetes/releases/download/v1.7.3/kubernetes.tar.gz' \
| tar -zxvf -
export KUBERNETES_RELEASE_URL=https://storage-googleapis.proxy.ustclug.org/kubernetes-release/release; \
bash kubernetes/cluster/get-kube-binaries.sh
@leopay
leopay / test
Created January 3, 2017 06:24
Swagger
swagger: '2.0'
@leopay
leopay / check_docker_container_resolv_file.sh
Created June 20, 2016 03:29
check docker container reslov file
cat $(docker inspect --format='{{.ResolvConfPath}}' <container_name_or_id>)