Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View k2wanko's full-sized avatar
🔥
No Firebase, No Life

Kazuhiro Kubota k2wanko

🔥
No Firebase, No Life
View GitHub Profile
@k2wanko
k2wanko / main.ts
Created September 17, 2023 21:37
How to use External Account of Workload Identity with Firebase Admin SDK
// I have confirmed to the point of using Firestore from AWS Lambda (node v18).
import admin from 'firebase-admin'; // version 11.10.1
import { Credential } from 'firebase-admin/app';
import { ComputeEngineCredential } from '../node_modules/firebase-admin/lib/app/credential-internal.js';
import { ExternalAccountClient } from 'google-auth-library'; // version 9.0.0
import fs from 'fs/promises';
export class ExternalAccountCredential
extends ComputeEngineCredential // Inherits this class because it is verified to be an internal class at Firestore initialization.
implements Credential
import {
Receiver,
ReceiverEvent,
ReceiverAckTimeoutError,
ExpressReceiverOptions,
} from '@slack/bolt'
import { ConsoleLogger } from '@slack/logger'
import { verifySignatureAndParseBody } from '@slack/bolt/dist/ExpressReceiver'
import express, { Application, RequestHandler, Request, Response, NextFunction } from 'express'
import axios from 'axios'
@k2wanko
k2wanko / gist:634ac965ac4b03746d206e49d02ba621
Created July 17, 2018 06:15
travisで失敗した時のエラーログ
$ reviewdog -reporter=github-pr-check
reviewdog: status=401: The access token not provided. Get token from https://reviewdog.app/gh/line/line-bot-sdk-go
The command "reviewdog -reporter=github-pr-check" exited with 1.
@k2wanko
k2wanko / goapp
Created February 6, 2018 03:12
goapp
#!/bin/bash
# Require: $ gcloud components install app-engine-go
gcloud="$(which gcloud)"
[ -L "$gcloud" ] && gcloud="$(readlink "$gcloud")"
appdir="$(dirname "$(dirname "$gcloud")")"
goapp="${appdir}/platform/google_appengine/goapp"
if ! [ -f "$goapp" ]; then
echo "goapp is not in the Google Cloud SDK libraries." >&2
echo "Hint: try running this command:" >&2
@k2wanko
k2wanko / gist:4c242cc83e3833081c168be8431262f9
Created July 6, 2017 09:48
ハッカソンインターンについて
研修を踏まえてよかったこと、こうした方がいいと思うこと
- Heroku使ってたのはよかった
- 理想は好きなPaaSを選べるといいと思うので事前にヒアリングしてほしかった。
- BOTを消すのはよくなかった。
- 親や友達に自慢できるよう持って帰れるBOTがよさそう。
@k2wanko
k2wanko / app.go
Last active February 4, 2017 08:37
package linebot
import (
"encoding/base64"
"encoding/json"
"net/http"
"net/url"
"os"
"golang.org/x/net/context"
@k2wanko
k2wanko / main.go
Last active October 17, 2016 15:50
go-diff-demo
package main
import (
"bufio"
"bytes"
"fmt"
"net/url"
"github.com/sergi/go-diff/diffmatchpatch"
)
@k2wanko
k2wanko / RUN
Last active October 4, 2016 14:51
$ GOMAXPROCS=1 GOROOT=~/src/github.com/golang/go go test -bench .
testing: warning: no tests to run
BenchmarkSort 30000 57616 ns/op
BenchmarkSlice 30000 43650 ns/op
PASS
ok github.com/k2wanko/sort-bench 38.994s
$ GOMAXPROCS=1 GOROOT=~/src/github.com/golang/go go test -bench . -benchmem
testing: warning: no tests to run
BenchmarkSort 20000 62222 ns/op 32 B/op 1 allocs/op
append
https://play.golang.org/p/5GEE7D2e8L
copy
https://play.golang.org/p/toSjy-DiEL
cut
https://play.golang.org/p/ebi-Idf-n-
delete
//usr/bin/env go run $0 $@ ; exit
package main
import "fmt"
func main() {
fmt.Print("Hello")
}