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"
)

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>

@soichisumi
soichisumi / horizon-client-example.go
Last active June 4, 2019 04:14
an example of stellar/go/horizonclient and conversion of Embedded.Records / [Stellar] [Go]
package main
import (
"encoding/json"
"fmt"
"github.com/stellar/go/clients/horizonclient"
"github.com/stellar/go/protocols/horizon/operations"
)
@soichisumi
soichisumi / showFields.js
Created June 24, 2019 12:49
object の fieldの中身を列挙する. Objectがundefinedなパラメータがないかどうかのチェックのときに使用する
function showFields(target) {
for (var f in target) {
console.log(`${f}: ${target[f]}`);
}
}