- GCP のすべてのリソースは プロジェクト の下に作成される
- プロジェクトごとに請求や IAM の管理が可能
- 本番やステージングといった複数環境のリソースを分離するためにもプロジェクトで分けよう
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "bytes" | |
func StreamToByte(stream io.Reader) []byte { | |
buf := new(bytes.Buffer) | |
buf.ReadFrom(stream) | |
return buf.Bytes() | |
} | |
func StreamToString(stream io.Reader) string { | |
buf := new(bytes.Buffer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Handler(w http.ResponseWriter, r *http.Request) { | |
c := appengine.NewContext(r) | |
u := user.Current(c) | |
//ログインのチェック | |
if u == nil { | |
url, err := user.LoginURL(c, r.URL.String()) | |
if err != nil { | |
http.Error(w, err.Error(), http.StatusInternalServerError) | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Google Spreadsheet向けBigQuery取り込みスクリプト | |
* http://toreta.blog.jp/archives/20649904.html | |
* License: MIT 2014- Toreta, Inc. | |
* | |
* runAllQueries() をトリガーで毎日実行してください | |
* Queries, Single row queries, Dataの三つのシートを作って下さい | |
* Queries, Single row queriesのシートには実行するクエリを書きます | |
* A列にクエリ名、B列にクエリです。 | |
* conuntなどの集約関数で1行しか返らないクエリは「Single row queries」、それ以外は「Queries」に書いて下さい |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2011 The Go Authors. All rights reserved. | |
// Use of this source code is governed by a BSD-style | |
// license that can be found in the LICENSE file. | |
// HTTP reverse proxy handler | |
package goengine | |
import ( | |
"io" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# file: ttfb.sh | |
# curl command to check the time to first byte | |
# ** usage ** | |
# 1. ./ttfb.sh "https://google.com" | |
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com" | |
curl -o /dev/null \ | |
-H 'Cache-Control: no-cache' \ | |
-s \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sample logging-quickstart writes a log entry to Stackdriver Logging. | |
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"strings" |
日時: | 2022-12-10 |
---|---|
作: | 時雨堂 |
バージョン: | 2022.1 |
URL: | https://github.com/OpenAyame |
このプロジェクトに興味がある人はこの資料や GitHub リポジトリ に Star をつけてもらえると嬉しいです。