Skip to content

Instantly share code, notes, and snippets.

View soichisumi's full-sized avatar
🔥
gRPC, Kubernetes, GCP, AWS, Azure, Firebase / Go, Javascript, Rust <- new!

Soichi Sumi soichisumi

🔥
gRPC, Kubernetes, GCP, AWS, Azure, Firebase / Go, Javascript, Rust <- new!
View GitHub Profile
@soichisumi
soichisumi / color-comparetor.js
Last active August 20, 2018 10:19
this script uses deltaE to compare the similarity of color. about deltaE: http://zschuessler.github.io/DeltaE/
const d3 = require('d3-color')
const deltaE = require('delta-e')
// a, b ... color code without #. (ex: FFFFFF)
function getDeltaE(a, b){
ar = a.substr(0, 2)
ar = parseInt(ar, 16)
ag = a.substr(2, 2)
ag = parseInt(ag, 16)
ab = a.substr(4, 2)
@soichisumi
soichisumi / Investivate_behavior_of_nodejs_require
Last active September 12, 2018 07:49
nodejs's require caches the module. the cached result is used for second call of require
title
@soichisumi
soichisumi / Investivate_CloudFunction
Last active September 12, 2018 08:08
investigate the behavior of cloud function
title
@soichisumi
soichisumi / dogrun.txt
Created September 20, 2018 19:37
dogrun 質問 メモ
dogrun
01 gcpとfirebaseのfunctionの使い分け
・function自体は同じ、違いは開発者のデプロイ方法の違い
02 functionでpythonサポートの予定はあるか
頑張るが今の所ない。
03 firebaseとgcpの壁
・モバイルならfirebase、クラウドならgcp、functionsは中間
・schedulerをfirebaseに持て来るよていはある
function sleep(millisec) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, millisec);
});
}
// jayson-promise-test
const jayson = require(`jayson/promise`);
const client = jayson.client.https(`http://url`);
client.request(`sendrawtransaction`, [`02000000000101e704a7202bd63642b45234d1d132fcd72112789a1caa08c3b6843d7d2e94b211010000001716001421aa1728d096147222c201519a8710fd1bc2f416ffffffff01405489000000000017a91400853f1aefada64964a3f602846d263f5f3630a98702483045022100dc5051daf71e46c4e297e66c4b71f8d2fb3359dc209f24ca598677215318867502203b131875c948dd996a0575b0600e3b702d29de9ac7853c388319e20babe2d7b00121038bf0cde309b16f3513725515f077178e8ff8b89269543555057edc28b16179cd00000000`])
.then((res)=>{console.log(JSON.stringify(res))})
.catch((err)=> {
console.log(JSON.stringify(err));
console.log(String(err));
if(String(err).startsWith(‘Error: ’)){
const str = String(err).slice(7);
@soichisumi
soichisumi / firestore-listen-doc.go
Last active December 2, 2018 19:57
example of listening firestore realtime update
package main
import (
"firebase.google.com/go"
"cloud.google.com/go/firestore"
"context"
"log"
"math/rand"
"fmt"
)
@soichisumi
soichisumi / firestore-listen-query.go
Created December 4, 2018 18:47
example of listening firestore realtime update in golang
package main
import (
"firebase.google.com/go"
"cloud.google.com/go/firestore"
"context"
"log"
"fmt"
)
const functions = require('firebase-functions');
const rp = require('request-promise');
const projectId = process.env.GCP_PROJECT;
const region = 'us-central1';
// GCF の List API を利用するためのサービスアカウント
// service account をリポジトリに含めたくない場合は下記のように機密データを取得する
// 設定方法: https://github.com/firebase/firebase-tools/issues/406#issuecomment-353017349
const serviceAccount = functions.config().list.cert;

install azure-cli

  1. brew update && brew install azure-cli
  2. az login

load credential to kubectl

az aks get-credentials --resource-group myResourceGroup --name myAKSCluster

load credetial to docker-cli

az acr login --name <acrName>