Skip to content

Instantly share code, notes, and snippets.

@ryutah
ryutah / gemini_app_slide_sample.html
Created October 5, 2025 13:36
Gemini アプリで、 Canvas の内容などを印刷可能なスライドにしてほしい時に使えるテンプレート。貼り付けて、「この形式を参考に、 PDF で印刷可能な形式で出力して」みたいにリクエストする
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Google Cloud 2025年 動向レポート(スライド版)</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
@ryutah
ryutah / main.go
Created November 10, 2023 01:37
Impersonate API call sample to request endpoints protected by Cloud IAP
package main
import (
"context"
"fmt"
"io"
"os"
"golang.org/x/oauth2"
"google.golang.org/api/impersonate"
@ryutah
ryutah / sample.sh
Created August 3, 2020 15:46
標準入力を受け取るスクリプト
#!/usr/bin/env bash
echo "Input name"
read name
echo "Hey, ${name}"
@ryutah
ryutah / main.go
Created July 13, 2019 13:27
Stackdriver Traceを頑張ってる
package main
import (
"context"
"os"
"contrib.go.opencensus.io/exporter/stackdriver"
"contrib.go.opencensus.io/exporter/stackdriver/propagation"
"cloud.google.com/go/firestore"
@ryutah
ryutah / main.go
Created June 24, 2019 05:16
Limit number of concurrent execution of goroutine by channel
package main
import (
"context"
"fmt"
"sync"
"time"
)
func main() {
@ryutah
ryutah / main.go
Last active November 30, 2019 00:03
サービスアカウントを利用した、署名付きURL(Signed URL)での再利用可能なアップロード(Resumable Upload)のサンプル
package main
import (
"context"
"fmt"
"time"
credpb "google.golang.org/genproto/googleapis/iam/credentials/v1"
credentials "cloud.google.com/go/iam/credentials/apiv1"
@ryutah
ryutah / main.go
Created January 26, 2019 08:22
bigtable read investigation
package main
import (
"context"
"encoding/json"
"fmt"
"strings"
"cloud.google.com/go/bigtable"
)
@ryutah
ryutah / main.go
Created August 28, 2018 03:54
Go HTTP routing with prefix
package main
import (
"net/http"
"github.com/gorilla/mux"
)
func main() {
r1 := mux.NewRouter()
@ryutah
ryutah / main.go
Created August 21, 2018 05:57
Go サブネットマスク計算サンプル(netパッケージ使わない方法)
package main
import (
"encoding/binary"
"fmt"
)
func main() {
msk := uint32((1<<28 - 1) << (32 - 28))
mskBit := make([]byte, 4)
@ryutah
ryutah / omit_empty.go
Created August 9, 2018 07:24
Investigate Go json omitempty option behavior.(Playground: https://play.golang.org/p/7d8u1vjZdCJ)
package main
import (
"encoding/json"
"fmt"
"log"
"runtime"
)
const json1 = `