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
function tohex(str) | |
return (str:gsub('.', function (c) | |
return string.format('%02X', string.byte(c)) | |
end)) | |
end | |
function fromhex(str) | |
return (str:gsub('..', function (cc) | |
return string.char(tonumber(cc, 16)) | |
end)) |
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
#OneOf: { a: string } | { b: string } | |
#E: { | |
name: string | |
#OneOf | |
} | |
ex1: #E & { | |
name: "a choice" | |
a: "bar" |
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 "list" | |
val: this={ | |
a?: string | |
b?: string | |
c?: string | |
#AnyOfABC: true & list.MinItems([for label,_ in this if list.Contains(["a", "b", "c"],label) {label}], 1) | |
d?: string | |
e?: string |
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
package function | |
import "strings" | |
// An input schema | |
#Input: { | |
count: int | |
msg: string | |
} |
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 "strings" | |
band: { | |
// hidden fiels | |
_selfIndexAlbums: ["", "II", "III", "IV"] | |
_namedAblums: [ | |
"Houses of the Holy", | |
"Physical Graffiti", | |
"Presence", | |
"In Through the Out Door", |
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
req, _ := http.NewRequest("GET", "http://your_link_url", nil) | |
req.Header.Set("Authorization", fmt.Sprintf("Bearer xxxxxxxx")) | |
req.Header.Set("Content-Type", "application/json") | |
client := &http.Client{} | |
resp, _ := client.Do(req) |
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
# add same content to the head of every line | |
:%s/^/the_content | |
# add same content to the tail of every line | |
:%s/$/the_content | |
# combine lines in vim |
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
server { | |
listen 80; | |
server_name .example.com | |
return 301 https://example.com | |
} | |
server { | |
listen 443 ssl; | |
server_name .example.com |
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
$ luarocks install --tree=/path/you/want/to/install lua-resty-ipmatcher |
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
FROM golang:1.17.5-alpine AS BUILDER | |
COPY . /go/src/app | |
WORKDIR /go/src/app | |
RUN go build -mod=mod -o app | |
FROM golang:1.17.5-alpine | |
WORKDIR /app |
NewerOlder