测试页面
Code 代码
markdown的yaml-code展示
一旦完成集群中 RuntimeClasses 的配置,
你可以在 Pod spec 中指定 runtimeClassName 来使用它。例如:
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
runtimeClassName: myclass
# ...
aicode 示例
JupyterLab,打印执行次数:
# 加载环境变量
import openai
import os
from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv()) # 读取本地 .env 文件,里面定义了 OPENAI_API_KEY
openai.api_key = os.getenv('OPENAI_API_KEY')
gitcode示例
gitcode面板如下所示,点击链接可直接跳转至github-link
gitfile示例
gitdoc 示例
bash 示例1
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/user/repos \
-d '{"name":"k8s-cost-estimator-github"}' | jq
bash 示例2
curl -O "https://raw.githubusercontent.com/GoogleCloudPlatform/migrate-to-containers/main/scripts/mFit/csv_splitter.sh" chmod +x csv_splitter.sh
C++示例
// Package tips contains tips for writing Cloud Functions in Go.
package tips
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/GoogleCloudPlatform/functions-framework-go/functions"
)
func init() {
functions.HTTP("ListFiles", ListFiles)
}
// ListFiles lists the files in the current directory.
// Uses directory "serverless_function_source_code" as defined in the Go
// Functions Framework Buildpack.
// See https://github.com/GoogleCloudPlatform/buildpacks/blob/56eaad4dfe6c7bd0ecc4a175de030d2cfab9ae1c/cmd/go/functions_framework/main.go#L38.
func ListFiles(w http.ResponseWriter, r *http.Request) {
files, err := ioutil.ReadDir("./serverless_function_source_code")
if err != nil {
http.Error(w, "Unable to read files", http.StatusInternalServerError)
log.Printf("ioutil.ListFiles: %v", err)
return
}
fmt.Fprintln(w, "Files:")
for _, f := range files {
fmt.Fprintf(w, "\t%v\n", f.Name())
}
}
python 示例
import functions_framework
@functions_framework.http
def list_files(request):
import os
from os import path
root = path.dirname(path.abspath(__file__))
children = os.listdir(root)
files = [c for c in children if path.isfile(path.join(root, c))]
return f"Files: {files}"
Yaml 示例1
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: minimal-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx-example
rules:
- http:
paths:
- path: /testpath
pathType: Prefix
backend:
service:
name: test
port:
number: 80
Yaml 示例2
一旦完成集群中 RuntimeClasses 的配置,
你可以在 Pod spec 中指定 runtimeClassName 来使用它。例如:
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
runtimeClassName: myclass
# ...
接下来来看第二个例子
sed "s/GCP_PROJECT_ID/$GCP_PROJECT_ID/g; s/GITHUB_USER/$GITHUB_USER/g; s/GITHUB_EMAIL/$GITHUB_EMAIL/g;" templates/cloudbuild.yaml.tpl > cloudbuild.yaml GITHUB_SSH_URL_REPO=$(curl -X GET \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer $GITHUB_TOKEN" \ https://api.github.com/repos/$GITHUB_USER/k8s-cost-estimator-github | jq -r .ssh_url) [ -z "$GITHUB_SSH_URL_REPO" ] && echo "GITHUB_SSH_URL_REPO is not exported" || echo "GITHUB_SSH_URL_REPO is $GITHUB_SSH_URL_REPO" git init git remote add origin $GITHUB_SSH_URL_REPO git add -A . git commit -m "Initial commit" git checkout -b main git push -u origin main
Tab页
标签列表可以用来有条件地显式内容,例如,当有多种选项可供选择时,每个选项可能需要完全不同的指令或者上下文,以下是复合tab页面的展示
这是第一个tab
这是第二个tab
- 编号列表
- (或者没有编号的)
- 列表
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/user/repos \
-d '{"name":"k8s-cost-estimator-github"}' | jq
这是第三个tab,展示内联样式
- 提醒
- 代码
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/user/repos \
-d '{"name":"k8s-cost-estimator-github"}' | jq
接下来测试第二个Tab页面
这是centos系统
这是unix系统
这是ubuntu系统
提醒框
全铺开
idea
自定义
注意
提示
重要提示
预览
警告
小心
废弃
--health-check-period, 参数将在将在下一个版本中删除 will deprecated
对齐
表格
| 导航键 | 描述 |
|---|---|
h |
左移一个字符 |
j |
下一行 |
k |
上一行 |
l |
右移一个字符 |
文本框
定义
声明
Productivity is being able to do things that you were never able to do before.
效率能够让你做到你以前不曾做到的事情