Skip to content

Instantly share code, notes, and snippets.

View yuya-takeyama's full-sized avatar
🎐
Humility, Kindness, Bonds

Yuya Takeyama yuya-takeyama

🎐
Humility, Kindness, Bonds
View GitHub Profile
@yuya-takeyama
yuya-takeyama / README.md
Last active July 4, 2019 04:34
Quipper の Envoy 現状 (この tweet 時点 https://twitter.com/yuya_takeyama/status/1138352204069216256)

モチベーション

  • とりあえずは gRPC のロードバランシングさえできればそれでよし
    • 現状 gRPC は新規サービス含めトラフィックの少ないサービスでしか使われてない
    • とはいえそれらのサービスの成長だったり、トラフィックの大きいサービスで使うときに当然困ることになるので
  • Circuit Breaker 的な仕組みが社内で運用できていないので、その辺にも使っていけたらと思ってる (そのうち検証する)
    • 現状は @ujihisa さんが作った Dark Launch で手動で落とすとかしている
    • そもそも現状は partial outage 可能なマイクロサービス化された部分が限定的だし、特に問題も起きていないのでそれがないことで日々障害が起きている!なんてこともない
  • ゆくゆくは AWS App Mesh なり Istio なりでサービスメッシュしたいと思っているが、いきなりそこに行くのはリスクが大きいのでまずは Envoy 単体に慣れたい
#!/bin/bash
ip_map=$(jq --raw-input . | jq --slurp . | jq 'to_entries | map({key: .value, value: true}) | from_entries' --compact-output)
aws --profile aya ec2 describe-instances | \
jq -r --argjson ipMap "${ip_map}" \
'.Reservations[].Instances[] | select(.PrivateIpAddress | in($ipMap)) | .InstanceId'
@yuya-takeyama
yuya-takeyama / README.md
Last active June 9, 2018 19:31
oh-my-zsh theme with kubernets current context and namespace

Screenshot

image

@yuya-takeyama
yuya-takeyama / split-k8s-yaml
Created May 23, 2018 12:25
Split List object definition YAML into separate files
#!/usr/bin/env ruby
require 'yaml'
def kind_to_sub_extension(kind)
case kind
when 'ConfigMap'
'cm'
when 'DaemonSet'
'ds'
@yuya-takeyama
yuya-takeyama / peco-kubectx
Last active February 28, 2019 13:27
Select Kubernetes context with peco
#!/bin/bash
PECO_CMD="peco"
KUBECTL_CMD="kubectl"
if ! hash "${PECO_CMD}" 2> /dev/null; then
>&2 echo "error: ${PECO_CMD} is not installed"
>&2 echo "see https://github.com/peco/peco"
exit 1
fi
@yuya-takeyama
yuya-takeyama / handleError.ts
Last active December 24, 2022 09:41
Handle Response Error of JSON API in TypeScript (using async/await)
import fetch, { Response } from 'node-fetch';
interface ResponseWithParsedJson extends Response {
parsedJson?: any;
}
const toResponseWithParsedJson = (
res: Response,
json: any,
): ResponseWithParsedJson => {
@yuya-takeyama
yuya-takeyama / handleError.ts
Last active April 21, 2022 05:50
Handle Response Error of JSON API in TypeScript
import fetch, { Response } from 'node-fetch';
interface ResponseWithParsedJson extends Response {
parsedJson?: any;
}
const toResponseWithParsedJson = (
res: Response,
json: any,
): ResponseWithParsedJson => {
@yuya-takeyama
yuya-takeyama / README.md
Last active January 1, 2018 16:52
エケペディアの欅坂46メンバー一覧ページから誕生日データを抽出する
@yuya-takeyama
yuya-takeyama / keyakizaka.json
Created December 31, 2017 11:50
欅坂情報 Alexa Skill の Intent とかの設定
{
"languageModel": {
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
var x: string | number = Math.random() > 0.5 ? 42 : 'forty-two';
var y: typeof x;
y = 's';
console.log(x); // => 42 or forty-two
console.log(y); // => s