Pub/Sub BigQuery Subscription を利用する最小限の手順です。
利用するプロジェクトを設定してください。
gcloud config set project YOUR-PROJECT| $ go test -bench . | |
| goos: darwin | |
| goarch: arm64 | |
| pkg: example.com/m | |
| BenchmarkMiddleware-10 6388045 189.8 ns/op | |
| BenchmarkList-10 5904484 205.4 ns/op | |
| PASS | |
| ok example.com/m 2.830s |
| # frozen_string_literal: true | |
| require "bundler/inline" | |
| gemfile(true) do | |
| source "https://rubygems.org" | |
| gem "google-cloud-spanner" | |
| end | |
| require "google/cloud/spanner" |
| import io | |
| import sys | |
| from google.cloud import bigquery | |
| from vertexai.preview.language_models import TextGenerationModel | |
| client = bigquery.Client() | |
| def render_prompt(full_table_id: str, user_prompt: str) -> str: |
| class MyDeletionStrategy < DatabaseCleaner::ActiveRecord::Deletion | |
| def delete_tables(connection, table_names) | |
| # TODO | |
| end | |
| def delete_table(connection, table_name) | |
| connection.execute("DELETE FROM #{connection.quote_table_name(table_name)} WHERE true") | |
| end | |
| end |
| /* | |
| * Snippet to encode strings of Hiragana (Japanese alphabet) into a number value. | |
| * | |
| * This is written as an example for a Solidity application. | |
| */ | |
| const maxLength = 5; | |
| /* | |
| * 7 bit for each character. |
| from os import environ | |
| from google.cloud import dlp_v2 as dlp | |
| client = dlp.DlpServiceClient() | |
| def create_inspect_template(template_id: str): | |
| """ |
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| name: hello-gke | |
| spec: | |
| containers: | |
| - name: hello | |
| image: ghcr.io/shawnlabo/fun | |
| resources: | |
| requests: |
| PS1='\n' | |
| PS1=$PS1'\[\e[1;33m\]$([[ -n $DEVSHELL_PROJECT_ID ]] && printf "\[\e[1;33m\]$DEVSHELL_PROJECT_ID" || printf "\[\e[1;37m\]cloudshell")\[\e[m\]' | |
| PS1=$PS1':' | |
| PS1=$PS1'\[\e[1;34m\]\w\n\[\e[1;35m\]❯\[\e[m\] ' | |
| PS1=$PS1'\[\033k$([[ -n $DEVSHELL_PROJECT_ID ]] && printf "($DEVSHELL_PROJECT_ID)" || printf "cloudshell")\033\\\]' |
| import json | |
| from google.cloud.workflows_v1 import WorkflowsClient | |
| from google.cloud.workflows.executions_v1 import ExecutionsClient | |
| from google.cloud.workflows.executions_v1.types.executions import Execution | |
| project = 'PROJECT ID' | |
| location = 'REGION' | |
| workflow = 'WORKFLOW NAME' |