Skip to content

Instantly share code, notes, and snippets.

View mumoshu's full-sized avatar
🏠
Working from home

Yusuke Kuoka mumoshu

🏠
Working from home
View GitHub Profile
@mumoshu
mumoshu / helmify-kustomize
Last active April 15, 2024 10:49
Run `helmify-kustomize build $chart $env` in order to generate a local helm chart at `$chart/`, from kustomize overlay at `${chart}-kustomize/overlays/$env`
#!/usr/bin/env bash
cmd=$1
chart=$2
env=$3
dir=${chart}-kustomize
chart=${chart/.\//}
build() {
@mumoshu
mumoshu / main.go
Created September 9, 2018 03:58
httpserver in go for demo purpose
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:])
}
apiVersion: v1
kind: Secret
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard-certs
namespace: kube-system
type: Opaque
---
$ curl -s -o /dev/null -w "%{http_code}" -v https://teleport.example.com:3080/webapi/ping/onelogin
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to teleport.example.com (127.0.0.1) port 3080 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
$ k logs teleport-7ccdf686b8-dshfw
ERROR REPORT:
Original Error: *trace.BadParameterError unable to verify HTTPS certificate chain in /var/lib/certs/tls.crt: WARNING:
The proxy you are connecting to has presented a certificate signed by a
unknown authority. This is most likely due to either being presented
with a self-signed certificate or the certificate was truly signed by an
authority not known to the client.
@mumoshu
mumoshu / 0-usage
Last active March 26, 2018 09:01
Runs an arbitrary command within a bash session in which a temporary ssh-agent is running
$ DEBUG=1 ./vaulted-bash.sh bash
Starting ssh-agent...
Started ssh-agent
Type path to ssh key. Blank to continue> /Users/example/.ssh/id_rsa
Identity added: /Users/example/.ssh/id_rsa (/Users/example/.ssh/id_rsa)
Type path to ssh key. Blank to continue>
bash-3.2$ ssh-add -l
4096 SHA256:PXeBU/YU3qFCpTIQvE5HHVwa8tnaftJzgNukHswTJrc /Users/example/.ssh/id_rsa (RSA)
bash-3.2$ exit
exit
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ssm:CancelCommand",
"ssm:DescribeAssociation",
"ssm:ListCommands",
#!/usr/bin/env ruby
require 'benchmark'
# global executorの並列度を高めにしてから...
def concurrent_download(files, future_provider: Concurrent::Future)
require 'concurrent/future'
# 最大20ファイルずつ並列ダウンロード
n = 20
@mumoshu
mumoshu / dockerbuild.sh
Created March 13, 2018 06:07
An example of secure, cacheful docker-multistage-build
#!/bin/bash
if [ ! -z "$DEBUG" ]; then
set -vx
fi
set -eu
REGISTRY=${REGISTRY:-}
if [ ! -z "${REGISTRY}" ]; then
@mumoshu
mumoshu / docker-build-safe-secret-work-around.sh
Created February 28, 2018 02:54
Since Docker version released Mar. 2017
sh -c 'image=mytestimage; FTP_PROXY=$(dd if=/dev/zero of=output.dat bs=180k count=1 && cat output.dat | base64); secret=$FTP_PROXY; docker build --build-arg FTP_PROXY=$secret -t $image . && ! docker inspect $image | grep $secret && ! docker history $image | grep $secret'