Skip to content

Instantly share code, notes, and snippets.

View garrydzeng's full-sized avatar

Octobrain garrydzeng

  • Xiamen, Fujian, China
  • 12:00 (UTC +08:00)
View GitHub Profile
@garrydzeng
garrydzeng / content-schema.md
Created February 21, 2022 19:00
A field parameter used to negotiate content schema (example: )

起因

内容协商 (Content Negotiation) 是 HTTP 协议重要的组成部分,它允许客户端与服务端协商内容的媒体类型 (MIME) 等信息,但不能拿来协商内容结构。日常开发当中,这个其实是刚需的功能:或许你还能记得客户端需要什么字段的时候,服务端就对应地修改返回的数据。反反复复的日子😂。为了解决这个问题,计划在 Accept 请求头当中 schema 参数用于协商数据结构

示例

POST /sessions
Accept: application/json; charset=utf-8; schema={id,user{name,id}}

这个例子里,客户端协商数据结构为 {id,user{name,id}} ,因此服务端自动地响应需要的自动为 JSON 格式

{

This tutorial explains how to modify a minimal image so that it can be booted from ESXi 7+ or VMWare Workstation

REASON

The minimal cloud image enables the GRUB_FORCE_PARTUUID option which means system boots from root filesystem only, and the well-known vmw_pvscsi module is compiled as a kernel module. Therefore, we need to enable initrd.img to load the vmw_pvscsi driver before mounting the root filesystem.

HOW TO TUTORIAL

@garrydzeng
garrydzeng / authentication.sh
Last active September 12, 2025 06:39
Script for alidns + certbot --manual-auth-hook & --manual-cleanup-hook
#!/usr/bin/env bash
set -e
which aliyun &> /dev/null
if [[ $? -eq 0 ]]; then
aliyun alidns AddDomainRecord --DomainName $CERTBOT_DOMAIN --RR _acme-challenge --Type TXT --Value $CERTBOT_VALIDATION
fi