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 / README.md
Created July 15, 2019 10:01
an example of gcp service account

GCP Service Account Example

this is an example of gcp service account. Clearly, service account has a private key and a certificate.

So GCP uses public-key cryptography (+ certificate to validate wheather public key is falsificated) to authenticate the service account.

@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]}`);
}
}
@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"
)

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>

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;
@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"
)
@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"
)
// 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);
function sleep(millisec) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, millisec);
});
}
@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に持て来るよていはある